From a8f394d6755bb6cd20d260889f43b7209ed33835 Mon Sep 17 00:00:00 2001 From: cthomas Date: Wed, 4 Jun 2025 17:06:44 -0700 Subject: [PATCH] feat: populate tool call name and id in when token streaming (#2639) --- letta/interfaces/anthropic_streaming_interface.py | 4 +++- letta/interfaces/openai_streaming_interface.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/letta/interfaces/anthropic_streaming_interface.py b/letta/interfaces/anthropic_streaming_interface.py index 3d9c24da..48c57f48 100644 --- a/letta/interfaces/anthropic_streaming_interface.py +++ b/letta/interfaces/anthropic_streaming_interface.py @@ -277,7 +277,9 @@ class AnthropicStreamingInterface: # Otherwise, it is a normal tool call - buffer or yield based on inner thoughts status tool_call_msg = ToolCallMessage( id=self.letta_tool_message_id, - tool_call=ToolCallDelta(arguments=delta.partial_json), + tool_call=ToolCallDelta( + name=self.tool_call_name, tool_call_id=self.tool_call_id, arguments=delta.partial_json + ), date=datetime.now(timezone.utc).isoformat(), ) if self.inner_thoughts_complete: diff --git a/letta/interfaces/openai_streaming_interface.py b/letta/interfaces/openai_streaming_interface.py index 86397ad8..d73f06a5 100644 --- a/letta/interfaces/openai_streaming_interface.py +++ b/letta/interfaces/openai_streaming_interface.py @@ -295,7 +295,7 @@ class OpenAIStreamingInterface: id=self.letta_tool_message_id, date=datetime.now(timezone.utc), tool_call=ToolCallDelta( - name=None, + name=self.function_name_buffer, arguments=combined_chunk, tool_call_id=self.function_id_buffer, ),