File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -295,9 +295,13 @@ def _process_provider_response(
295295 if hasattr (response , "content" ) and isinstance (response .content , list ):
296296 # Serialize Pydantic models from response.content for history
297297 try :
298- raw_assistant_content_blocks = [
299- block .model_dump () for block in response .content
300- ]
298+ for block in response .content :
299+ block_dict = block .model_dump ()
300+ if isinstance (block_dict , dict ):
301+ # Anthropic beta responses include a `caller` field on tool_use blocks
302+ # but the API rejects that key on subsequent requests.
303+ block_dict .pop ("caller" , None )
304+ raw_assistant_content_blocks .append (block_dict )
301305 except Exception as e :
302306 self .logger .error (
303307 f"Could not model_dump response.content blocks: { e } " ,
You can’t perform that action at this time.
0 commit comments