Home / Function/ include_event() — langchain Function Reference

include_event() — langchain Function Reference

Architecture documentation for the include_event() function in utils.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  66102747_5712_83fd_8c94_fc1f82e77448["include_event()"]
  68cb16ac_cba8_3cec_1e16_936f7df152ab["_RootEventFilter"]
  66102747_5712_83fd_8c94_fc1f82e77448 -->|defined in| 68cb16ac_cba8_3cec_1e16_936f7df152ab
  style 66102747_5712_83fd_8c94_fc1f82e77448 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/utils.py lines 696–725

    def include_event(self, event: StreamEvent, root_type: str) -> bool:
        """Determine whether to include an event."""
        if (
            self.include_names is None
            and self.include_types is None
            and self.include_tags is None
        ):
            include = True
        else:
            include = False

        event_tags = event.get("tags") or []

        if self.include_names is not None:
            include = include or event["name"] in self.include_names
        if self.include_types is not None:
            include = include or root_type in self.include_types
        if self.include_tags is not None:
            include = include or any(tag in self.include_tags for tag in event_tags)

        if self.exclude_names is not None:
            include = include and event["name"] not in self.exclude_names
        if self.exclude_types is not None:
            include = include and root_type not in self.exclude_types
        if self.exclude_tags is not None:
            include = include and all(
                tag not in self.exclude_tags for tag in event_tags
            )

        return include

Domain

Subdomains

Frequently Asked Questions

What does include_event() do?
include_event() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/utils.py.
Where is include_event() defined?
include_event() is defined in libs/core/langchain_core/runnables/utils.py at line 696.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free