Models can request multiple tool calls in parallel:
response = client.chat.completions.create( model="gpt-4o", messages=[{ "role": "user", "content": "What's the weather in Paris and Tokyo?" }], tools=tools)# May return two tool callsif response.choices[0].message.tool_calls: for tool_call in response.choices[0].message.tool_calls: print(f"{tool_call.function.name}: {tool_call.function.arguments}")
stream = client.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": "What's the weather in Paris?"}], tools=tools, stream=True)tool_calls = {}for chunk in stream: if not chunk.choices: continue delta = chunk.choices[0].delta if delta.tool_calls: for tc in delta.tool_calls: idx = tc.index if idx not in tool_calls: tool_calls[idx] = {"id": tc.id, "function": {"name": "", "arguments": ""}} if tc.function and tc.function.name: tool_calls[idx]["function"]["name"] += tc.function.name if tc.function and tc.function.arguments: tool_calls[idx]["function"]["arguments"] += tc.function.argumentsprint(list(tool_calls.values()))
See Streaming Guide for full streaming patterns including error handling and metadata access.
Conversion only runs when the legacy field is present and the modern field is absent. If both are present, the modern field takes precedence.Use tools/tool_choice for new code. Auriko supports the legacy format for backward compatibility.
Provider compatibility: Most major providers support function calling (tools / tool_choice), but subfeatures such as parallel_tool_calls vary by provider. Auriko filters out providers that don’t support tool calling at all, but doesn’t guarantee every provider-specific tool subfeature. Check /v1/directory/models for current capability details.