Home / Function/ _on_chain_end() — langchain Function Reference

_on_chain_end() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6fa418f3_cafe_a81c_2caa_db95b1a520ff["_on_chain_end()"]
  178590bb_85ff_b79e_979a_46e5c3c5389f["LangChainTracer"]
  6fa418f3_cafe_a81c_2caa_db95b1a520ff -->|defined in| 178590bb_85ff_b79e_979a_46e5c3c5389f
  cf43defe_cb35_deb4_9782_55f973cdf6ca["_persist_run_single()"]
  6fa418f3_cafe_a81c_2caa_db95b1a520ff -->|calls| cf43defe_cb35_deb4_9782_55f973cdf6ca
  bce3427a_d6ea_f317_a362_d28206fa1696["_update_run_single()"]
  6fa418f3_cafe_a81c_2caa_db95b1a520ff -->|calls| bce3427a_d6ea_f317_a362_d28206fa1696
  style 6fa418f3_cafe_a81c_2caa_db95b1a520ff fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tracers/langchain.py lines 328–335

    def _on_chain_end(self, run: Run) -> None:
        """Process the Chain Run."""
        # If inputs were deferred, persist (POST) the run now that inputs are realized.
        # Otherwise, update (PATCH) the existing run.
        if run.extra.get("defers_inputs"):
            self._persist_run_single(run)
        else:
            self._update_run_single(run)

Domain

Subdomains

Frequently Asked Questions

What does _on_chain_end() do?
_on_chain_end() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/langchain.py.
Where is _on_chain_end() defined?
_on_chain_end() is defined in libs/core/langchain_core/tracers/langchain.py at line 328.
What does _on_chain_end() call?
_on_chain_end() calls 2 function(s): _persist_run_single, _update_run_single.

Analyze Your Own Codebase

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

Try Supermodel Free