Home / Function/ on_llm_start() — langchain Function Reference

on_llm_start() — langchain Function Reference

Architecture documentation for the on_llm_start() function in base.py from the langchain codebase.

Function python Observability Tracers calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  d89ecf66_57c7_5671_97a2_4cb2416c215f["on_llm_start()"]
  0f6b3261_31fa_c34e_ca33_cb141bdf78ff["BaseTracer"]
  d89ecf66_57c7_5671_97a2_4cb2416c215f -->|defined in| 0f6b3261_31fa_c34e_ca33_cb141bdf78ff
  250dea62_af5d_b691_60f6_419e79310ae9["on_llm_start()"]
  250dea62_af5d_b691_60f6_419e79310ae9 -->|calls| d89ecf66_57c7_5671_97a2_4cb2416c215f
  e367264b_d5e2_1e7f_2b3a_e362236bcd24["_start_trace()"]
  d89ecf66_57c7_5671_97a2_4cb2416c215f -->|calls| e367264b_d5e2_1e7f_2b3a_e362236bcd24
  b4438399_97b7_d6fc_517e_dee981c4ae5e["_on_llm_start()"]
  d89ecf66_57c7_5671_97a2_4cb2416c215f -->|calls| b4438399_97b7_d6fc_517e_dee981c4ae5e
  250dea62_af5d_b691_60f6_419e79310ae9["on_llm_start()"]
  d89ecf66_57c7_5671_97a2_4cb2416c215f -->|calls| 250dea62_af5d_b691_60f6_419e79310ae9
  style d89ecf66_57c7_5671_97a2_4cb2416c215f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tracers/base.py lines 93–132

    def on_llm_start(
        self,
        serialized: dict[str, Any],
        prompts: list[str],
        *,
        run_id: UUID,
        tags: list[str] | None = None,
        parent_run_id: UUID | None = None,
        metadata: dict[str, Any] | None = None,
        name: str | None = None,
        **kwargs: Any,
    ) -> Run:
        """Start a trace for an LLM run.

        Args:
            serialized: The serialized model.
            prompts: The prompts to start the LLM with.
            run_id: The run ID.
            tags: The tags for the run.
            parent_run_id: The parent run ID.
            metadata: The metadata for the run.
            name: The name of the run.
            **kwargs: Additional arguments.

        Returns:
            The run.
        """
        llm_run = self._create_llm_run(
            serialized=serialized,
            prompts=prompts,
            run_id=run_id,
            parent_run_id=parent_run_id,
            tags=tags,
            metadata=metadata,
            name=name,
            **kwargs,
        )
        self._start_trace(llm_run)
        self._on_llm_start(llm_run)
        return llm_run

Domain

Subdomains

Called By

Frequently Asked Questions

What does on_llm_start() do?
on_llm_start() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/base.py.
Where is on_llm_start() defined?
on_llm_start() is defined in libs/core/langchain_core/tracers/base.py at line 93.
What does on_llm_start() call?
on_llm_start() calls 3 function(s): _on_llm_start, _start_trace, on_llm_start.
What calls on_llm_start()?
on_llm_start() is called by 1 function(s): on_llm_start.

Analyze Your Own Codebase

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

Try Supermodel Free