fix: send message tests (#2656)

This commit is contained in:
cthomas
2025-06-05 13:57:43 -07:00
committed by GitHub
parent da49024a5a
commit 6d094fd196
2 changed files with 3 additions and 1 deletions

View File

@@ -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(

View File

@@ -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)}")