MCPcopy
hub / github.com/langchain-ai/langchain / on_llm_error

Method on_llm_error

libs/core/langchain_core/tracers/base.py:154–170  ·  view source on GitHub ↗

Handle an error for an LLM run.

(
        self,
        error: BaseException,
        *,
        run_id: UUID,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

152 return llm_run
153
154 def on_llm_error(
155 self,
156 error: BaseException,
157 *,
158 run_id: UUID,
159 **kwargs: Any,
160 ) -> Run:
161 """Handle an error for an LLM run."""
162 # "chat_model" is only used for the experimental new streaming_events format.
163 # This change should not affect any existing tracers.
164 llm_run = self._errored_llm_run(
165 error=error,
166 run_id=run_id,
167 )
168 self._end_trace(llm_run)
169 self._on_llm_error(llm_run)
170 return llm_run
171
172 def on_chain_start(
173 self,

Callers 8

streamMethod · 0.45
astreamMethod · 0.45
_generate_helperMethod · 0.45
_agenerate_helperMethod · 0.45
streamMethod · 0.45
astreamMethod · 0.45
generateMethod · 0.45
agenerateMethod · 0.45

Calls 3

_end_traceMethod · 0.95
_errored_llm_runMethod · 0.80
_on_llm_errorMethod · 0.45

Tested by

no test coverage detected