(output: unknown, runId: string)
| 319 | |
| 320 | // Tool End Handler |
| 321 | handleToolEnd(output: unknown, runId: string) { |
| 322 | const span = spanMap.get(runId); |
| 323 | if (span?.isRecording()) { |
| 324 | if (recordOutputs) { |
| 325 | // LangChain tools may return ToolMessage objects — extract the content |
| 326 | const outputObj = output as Record<string, unknown> | undefined; |
| 327 | const content = |
| 328 | outputObj && typeof outputObj === 'object' && 'content' in outputObj ? outputObj.content : output; |
| 329 | span.setAttributes({ |
| 330 | [GEN_AI_TOOL_OUTPUT_ATTRIBUTE]: typeof content === 'string' ? content : JSON.stringify(content), |
| 331 | }); |
| 332 | } |
| 333 | exitSpan(runId); |
| 334 | } |
| 335 | }, |
| 336 | |
| 337 | // Tool Error Handler |
| 338 | handleToolError(error: Error, runId: string) { |
nothing calls this directly
no test coverage detected