The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Merge main into fix-openai-sparse-response-objects
Bryan Bednarskia51337ecee2a
diff --cc agent/chat_completion_helpers.pyindex b7c37c61afc,d7feafc97c7..48053627312--- a/agent/chat_completion_helpers.py+++ b/agent/chat_completion_helpers.py@@@ -3530,12 -4140,18 +4140,19 @@@ def interruptible_streaming_api_call(agagent._fire_reasoning_delta(reasoning_text)# Accumulate text content — fire callback only when no tool calls- if delta and delta.content:- content_parts.append(delta.content)+ delta_content = getattr(delta, "content", None)+ if delta_content:+ content_parts.append(delta_content)if not tool_calls_acc:+ if pending_text_parts or _provider_stream_text_may_be_sse(delta.content):+ pending_text_parts.append(delta.content)+ pending_text = "".join(pending_text_parts)+ if _provider_stream_text_may_be_sse(pending_text):+ continue+ _flush_pending_stream_text()+ continue_fire_first_delta()- agent._fire_stream_delta(delta.content)+ agent._fire_stream_delta(delta_content)deltas_were_sent["yes"] = True# Tool calls suppress regular content streaming (avoids# displaying chatty "I'll use the tool..." text alongside@@@ -3556,12 -4172,11 +4173,13 @@@pass# Accumulate tool call deltas — notify display on first name- if delta and delta.tool_calls:+ delta_tool_calls = getattr(delta, "tool_calls", None)+ if delta_tool_calls:+ _flush_pending_stream_text()- for tc_delta in delta.tool_calls:- raw_idx = tc_delta.index if tc_delta.index is not None else 0- delta_id = tc_delta.id or ""+ for tc_delta in delta_tool_calls:+ raw_index = getattr(tc_delta, "index", None)+ raw_idx = raw_index if raw_index is not None else 0+ delta_id = getattr(tc_delta, "id", None) or ""# Ollama fix: detect a new tool call reusing the same# raw index (different id) and redirect to a fresh slot.