2727from ccproxy .llms .models import openai as openai_models
2828from ccproxy .llms .streaming .accumulators import ClaudeAccumulator
2929
30- from ._helpers import build_openai_tool_call
30+ from ._helpers import build_openai_tool_call_chunk
3131from .requests import _build_responses_payload_from_anthropic_request
3232from .responses import convert__anthropic_usage_to_openai_responses__usage
3333
@@ -88,10 +88,10 @@ def _anthropic_delta_to_text(
8888 return None
8989
9090
91- def _build_openai_tool_call (
91+ def _build_openai_tool_call_chunk (
9292 accumulator : ClaudeAccumulator ,
9393 block_index : int ,
94- ) -> openai_models .ToolCall | None :
94+ ) -> openai_models .ToolCallChunk | None :
9595 for tool_call in accumulator .get_complete_tool_calls ():
9696 if tool_call .get ("index" ) != block_index :
9797 continue
@@ -102,7 +102,8 @@ def _build_openai_tool_call(
102102 tool_name = function_payload .get ("name" ) or tool_call .get ("name" )
103103 arguments = function_payload .get ("arguments" )
104104
105- return build_openai_tool_call (
105+ return build_openai_tool_call_chunk (
106+ index = tool_call .get ("index" , block_index ),
106107 tool_id = tool_call .get ("id" ),
107108 tool_name = tool_name ,
108109 tool_input = tool_call .get ("input" , {}),
@@ -1413,7 +1414,7 @@ async def generator() -> AsyncGenerator[
14131414 continue
14141415 if block_index in emitted_tool_indices :
14151416 continue
1416- tool_call = _build_openai_tool_call (accumulator , block_index )
1417+ tool_call = _build_openai_tool_call_chunk (accumulator , block_index )
14171418 if tool_call is None :
14181419 continue
14191420 emitted_tool_indices .add (block_index )
0 commit comments