File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed
packages/core/src/tracing/langchain Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ export interface LangChainMessage {
4747 // LangChain serialized format
4848 lc ?: number ;
4949 id ?: string [ ] ;
50+ response_metadata ?: {
51+ model_name ?: string ;
52+ finish_reason ?: string ;
53+ } ;
5054 kwargs ?: {
5155 [ key : string ] : unknown ;
5256 content ?: string ;
@@ -70,6 +74,7 @@ export interface LangChainLLMResult {
7074 finish_reason ?: string ;
7175 logprobs ?: unknown ;
7276 } ;
77+ // v1+ uses generationInfo instead of generation_info
7378 generationInfo ?: {
7479 [ key : string ] : unknown ;
7580 finish_reason ?: string ;
Original file line number Diff line number Diff line change @@ -419,19 +419,11 @@ export function extractLlmResponseAttributes(
419419
420420 addTokenUsageAttributes ( llmResult . llmOutput , attrs ) ;
421421
422- const llmOutput = llmResult . llmOutput as { model_name ?: string ; model ?: string ; id ?: string ; stop_reason ?: string } ;
422+ const llmOutput = llmResult . llmOutput ;
423423
424424 // Extract from v1 generations structure if available
425425 const firstGeneration = llmResult . generations ?. [ 0 ] ?. [ 0 ] ;
426- const v1Message = firstGeneration ?. message as
427- | {
428- id ?: string ;
429- response_metadata ?: {
430- model_name ?: string ;
431- finish_reason ?: string ;
432- } ;
433- }
434- | undefined ;
426+ const v1Message = firstGeneration ?. message ;
435427
436428 // Provider model identifier: `model_name` (OpenAI-style) or `model` (others)
437429 // v1 stores this in message.response_metadata.model_name
You can’t perform that action at this time.
0 commit comments