MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / handleLLMEnd

Function handleLLMEnd

packages/core/src/tracing/langchain/index.ts:168–183  ·  view source on GitHub ↗
(
      output: unknown,
      runId: string,
      _parentRunId?: string,
      _tags?: string[],
      _extraParams?: Record<string, unknown>,
    )

Source from the content-addressed store, hash-verified

166
167 // LLM End Handler - note: handleLLMEnd with capital LLM (used by both LLMs and chat models!)
168 handleLLMEnd(
169 output: unknown,
170 runId: string,
171 _parentRunId?: string,
172 _tags?: string[],
173 _extraParams?: Record<string, unknown>,
174 ) {
175 const span = spanMap.get(runId);
176 if (span?.isRecording()) {
177 const attributes = extractLlmResponseAttributes(output as LangChainLLMResult, recordOutputs);
178 if (attributes) {
179 span.setAttributes(attributes);
180 }
181 exitSpan(runId);
182 }
183 },
184
185 // LLM Error Handler - note: handleLLMError with capital LLM
186 handleLLMError(error: Error, runId: string) {

Callers

nothing calls this directly

Calls 5

exitSpanFunction · 0.85
getMethod · 0.65
isRecordingMethod · 0.65
setAttributesMethod · 0.65

Tested by

no test coverage detected