Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

feat: populate tool call name and id in when token streaming (#2639)

cthomasf8c0002fbcb3
diff --git a/letta/interfaces/anthropic_streaming_interface.py b/letta/interfaces/anthropic_streaming_interface.py
index 3d9c24da2..48c57f48a 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 86397ad88..d73f06a5d 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,
),