From 6d094fd196e5d2a337a236072d14331d2e0566c2 Mon Sep 17 00:00:00 2001 From: cthomas Date: Thu, 5 Jun 2025 13:57:43 -0700 Subject: [PATCH] fix: send message tests (#2656) --- letta/interfaces/anthropic_streaming_interface.py | 2 +- letta/llm_api/helpers.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/letta/interfaces/anthropic_streaming_interface.py b/letta/interfaces/anthropic_streaming_interface.py index 2471ba78..4e643afb 100644 --- a/letta/interfaces/anthropic_streaming_interface.py +++ b/letta/interfaces/anthropic_streaming_interface.py @@ -252,7 +252,7 @@ class AnthropicStreamingInterface: # Strip out the inner thoughts from the buffered tool call arguments before streaming tool_call_args = "" for buffered_msg in self.tool_call_buffer: - tool_call_args += buffered_msg.tool_call.arguments + tool_call_args += buffered_msg.tool_call.arguments if buffered_msg.tool_call.arguments else "" tool_call_args = tool_call_args.replace(f'"{INNER_THOUGHTS_KWARG}": "{current_inner_thoughts}"', "") tool_call_msg = ToolCallMessage( diff --git a/letta/llm_api/helpers.py b/letta/llm_api/helpers.py index c5ca5c92..749ae974 100644 --- a/letta/llm_api/helpers.py +++ b/letta/llm_api/helpers.py @@ -296,6 +296,8 @@ def unpack_inner_thoughts_from_kwargs(choice: Choice, inner_thoughts_key: str) - except json.JSONDecodeError as e: warnings.warn(f"Failed to strip inner thoughts from kwargs: {e}") + print(f"\nFailed to strip inner thoughts from kwargs: {e}") + print(f"\nTool call arguments: {tool_call.function.arguments}") raise e else: warnings.warn(f"Did not find tool call in message: {str(message)}")