Handle an error for an LLM run.
(
self,
error: BaseException,
*,
run_id: UUID,
**kwargs: Any,
)
| 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, |
no test coverage detected