choices[].message.tool_calls
For Chat Completions, tool calling is also visible through tool_calls, but it only shows calls the model requested, not every available tool.
For chat completions, mozilla-ai/any-llm returns OpenAI-style ChatCompletion objects. The response message type extends OpenAI’s ChatCompletionMessage, so tool calls are available in the normal OpenAI place:
from any_llm import completion
resp = completion(
model="gpt-4.1-mini",
provider="openai",
messages=[{"role": "user", "content": "What is the weather in Oslo?"}],
tools=[get_weather],
)
msg = resp.choices[0].message
print(msg.tool_calls)
Tool call names:
for call in msg.tool_calls or []:
print(call.function.name)
print(call.function.arguments)
This works because any-llm uses OpenAI-compatible response types for chat completions, including OpenAI tool-call message types.
tracing: https://github.com/arize-ai/phoenix
choices[].message.tool_calls
For Chat Completions, tool calling is also visible through tool_calls, but it only shows calls the model requested, not every available tool.
For chat completions, mozilla-ai/any-llm returns OpenAI-style ChatCompletion objects. The response message type extends OpenAI’s ChatCompletionMessage, so tool calls are available in the normal OpenAI place:
Tool call names:
This works because any-llm uses OpenAI-compatible response types for chat completions, including OpenAI tool-call message types.
tracing: https://github.com/arize-ai/phoenix