Home / Function/ on_llm_end() — langchain Function Reference

on_llm_end() — langchain Function Reference

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

Function python Observability Tracers calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  2e5b0e88_5d49_22a7_15ba_65f2c22a4441["on_llm_end()"]
  0f6b3261_31fa_c34e_ca33_cb141bdf78ff["BaseTracer"]
  2e5b0e88_5d49_22a7_15ba_65f2c22a4441 -->|defined in| 0f6b3261_31fa_c34e_ca33_cb141bdf78ff
  50d3e466_f9d5_7579_3e8d_d6691ad916d1["on_llm_end()"]
  50d3e466_f9d5_7579_3e8d_d6691ad916d1 -->|calls| 2e5b0e88_5d49_22a7_15ba_65f2c22a4441
  9191b24f_a202_df21_16c5_e2608083aef8["_end_trace()"]
  2e5b0e88_5d49_22a7_15ba_65f2c22a4441 -->|calls| 9191b24f_a202_df21_16c5_e2608083aef8
  555ba701_f596_3e8c_da78_286234d79a89["_on_llm_end()"]
  2e5b0e88_5d49_22a7_15ba_65f2c22a4441 -->|calls| 555ba701_f596_3e8c_da78_286234d79a89
  50d3e466_f9d5_7579_3e8d_d6691ad916d1["on_llm_end()"]
  2e5b0e88_5d49_22a7_15ba_65f2c22a4441 -->|calls| 50d3e466_f9d5_7579_3e8d_d6691ad916d1
  style 2e5b0e88_5d49_22a7_15ba_65f2c22a4441 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tracers/base.py lines 193–212

    def on_llm_end(self, response: LLMResult, *, run_id: UUID, **kwargs: Any) -> Run:
        """End a trace for an LLM run.

        Args:
            response: The response.
            run_id: The run ID.
            **kwargs: Additional arguments.

        Returns:
            The run.
        """
        # "chat_model" is only used for the experimental new streaming_events format.
        # This change should not affect any existing tracers.
        llm_run = self._complete_llm_run(
            response=response,
            run_id=run_id,
        )
        self._end_trace(llm_run)
        self._on_llm_end(llm_run)
        return llm_run

Domain

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free