Home / Function/ __init__() — langchain Function Reference

__init__() — langchain Function Reference

Architecture documentation for the __init__() function in core.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  89630da9_d03e_0386_2869_2e0177350aba["__init__()"]
  70348e44_de0f_ccb4_c06a_8453289ed93e["_TracerCore"]
  89630da9_d03e_0386_2869_2e0177350aba -->|defined in| 70348e44_de0f_ccb4_c06a_8453289ed93e
  style 89630da9_d03e_0386_2869_2e0177350aba fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tracers/core.py lines 48–84

    def __init__(
        self,
        *,
        _schema_format: Literal[
            "original", "streaming_events", "original+chat"
        ] = "original",
        **kwargs: Any,
    ) -> None:
        """Initialize the tracer.

        Args:
            _schema_format: Primarily changes how the inputs and outputs are handled.

                For internal use only. This API will change.

                - `'original'` is the format used by all current tracers.

                    This format is slightly inconsistent with respect to inputs and
                    outputs.
                - `'streaming_events'` is used for supporting streaming events, for
                    internal usage. It will likely change in the future, or be
                    deprecated entirely in favor of a dedicated async tracer for
                    streaming events.
                - `'original+chat'` is a format that is the same as `'original'` except
                    it does NOT raise an attribute error `on_chat_model_start`
            **kwargs: Additional keyword arguments that will be passed to the
                superclass.
        """
        super().__init__(**kwargs)

        self._schema_format = _schema_format  # For internal use only API will change.

        self.run_map: dict[str, Run] = {}
        """Map of run ID to run. Cleared on run end."""

        self.order_map: dict[UUID, tuple[UUID, str]] = {}
        """Map of run ID to (trace_id, dotted_order). Cleared when tracer GCed."""

Domain

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/core.py.
Where is __init__() defined?
__init__() is defined in libs/core/langchain_core/tracers/core.py at line 48.

Analyze Your Own Codebase

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

Try Supermodel Free