Skip to content

Commit

Permalink
anthropic[patch]: Pass usage_metadata and response_metadata through w…
Browse files Browse the repository at this point in the history
…hen streaming tool calls (#6042)

* anthropic[patch]: Pass usage_metadata through when streaming tool calls

* chore: lint files

* pass response metadata through too

* drop test - alr in standard-tests
  • Loading branch information
bracesproul authored Jul 11, 2024
1 parent d0d0c2f commit 58da6a9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libs/langchain-anthropic/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function anthropicResponseToChatMessages(
content: messages[0].text,
additional_kwargs: additionalKwargs,
usage_metadata: usageMetadata,
response_metadata: additionalKwargs,
}),
},
];
Expand All @@ -138,6 +139,7 @@ function anthropicResponseToChatMessages(
additional_kwargs: additionalKwargs,
tool_calls: toolCalls,
usage_metadata: usageMetadata,
response_metadata: additionalKwargs,
}),
},
];
Expand Down Expand Up @@ -691,6 +693,8 @@ export class ChatAnthropicMessages<
content: result.content,
additional_kwargs: result.additional_kwargs,
tool_call_chunks: toolCallChunks,
usage_metadata: result.usage_metadata,
response_metadata: result.response_metadata,
}),
text: generations[0].text,
});
Expand Down

0 comments on commit 58da6a9

Please sign in to comment.