Home / Function/ _llm_run_with_token_event() — langchain Function Reference

_llm_run_with_token_event() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  135ae62b_492a_3797_bd6f_3072486fcb45["_llm_run_with_token_event()"]
  178590bb_85ff_b79e_979a_46e5c3c5389f["LangChainTracer"]
  135ae62b_492a_3797_bd6f_3072486fcb45 -->|defined in| 178590bb_85ff_b79e_979a_46e5c3c5389f
  style 135ae62b_492a_3797_bd6f_3072486fcb45 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tracers/langchain.py lines 276–294

    def _llm_run_with_token_event(
        self,
        token: str,
        run_id: UUID,
        chunk: GenerationChunk | ChatGenerationChunk | None = None,
        parent_run_id: UUID | None = None,
    ) -> Run:
        run_id_str = str(run_id)
        if run_id_str not in self.run_has_token_event_map:
            self.run_has_token_event_map[run_id_str] = True
        else:
            return self._get_run(run_id, run_type={"llm", "chat_model"})
        return super()._llm_run_with_token_event(
            # Drop the chunk; we don't need to save it
            token,
            run_id,
            chunk=None,
            parent_run_id=parent_run_id,
        )

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free