From d90035835bb23ce8978bdb7e7ff39e5a59c72e03 Mon Sep 17 00:00:00 2001 From: Lume Date: Sun, 5 Apr 2026 07:32:50 +0100 Subject: [PATCH] refactor: use _should_sanitize_tool_calls in run_conversation() Replaces hardcoded Mistral check with the new _should_sanitize_tool_calls() method. Updates comment to mention Fireworks alongside Mistral as strict APIs requiring tool_call field sanitization. --- run_agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run_agent.py b/run_agent.py index e4b82b073..d374e080f 100644 --- a/run_agent.py +++ b/run_agent.py @@ -6810,10 +6810,10 @@ class AIAgent: if "finish_reason" in api_msg: api_msg.pop("finish_reason") # Strip Codex Responses API fields (call_id, response_item_id) for - # strict providers like Mistral that reject unknown fields with 422. + # strict providers like Mistral, Fireworks, etc. that reject unknown fields. # Uses new dicts so the internal messages list retains the fields # for Codex Responses compatibility. - if "api.mistral.ai" in self._base_url_lower: + if self._should_sanitize_tool_calls(): self._sanitize_tool_calls_for_strict_api(api_msg) # Keep 'reasoning_details' - OpenRouter uses this for multi-turn reasoning context # The signature field helps maintain reasoning continuity