Skip to content

[Feature]: make function calling work with azure openai o3-mini #9053

@anmolbhatia05

Description

@anmolbhatia05

The Feature

Hey, it looks like o3-mini via azure openai doesn't support function calling through litellm yet. Although the model itself does support it!

Let me know if you cant reproduce this. My request body has valid tools object but still the response returned through litellm says function call not recognised.

request -
{ "provider": "azure", "model": "o3-mini", "messages": [{ "content": "What's the weather like in San Francisco, Tokyo, and Paris?","role": "user"}], "tools": [ { "type": "function", "function": { "name": "get_current_weather", "description": "Get the current weather in a given location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" }, "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]} }, "required": ["location"] } } } ] }

response -
{"id":"chatcmpl-B8SIaaHiSRxvmA2nsLrblbqgDno3i","created":1741355104,"model":"azure/o3-mini-2025-01-31","object":"chat.completion","system_fingerprint":"fp_db33bdfc5e","choices":[{"finish_reason":"stop","index":0,"message":{"content":"I don’t have real-time weather data at my disposal. However, I can offer a brief overview of the typical weather patterns for each city and suggest how you can get current forecasts:\n\n• San Francisco: The city is known for its mild, often cool climate. Thanks to its coastal location and marine layer, you might experience fog and cooler temperatures even during summer mornings, with temperatures generally staying moderate throughout the day.\n\n• Tokyo: Tokyo has a humid subtropical climate. Summers tend to be hot and humid with the possibility of occasional heat waves, while winters are relatively mild but can feel chilly. The city also has a rainy season (tsuyu) in early summer.\n\n• Paris: Paris generally experiences an oceanic climate with moderate seasonal variations. Summers are typically warm but not excessively hot, and winters are cool with occasional chilly spells. Rain can occur throughout the year but rarely is it consistently heavy.\n\nFor the most accurate, up-to-date weather conditions, I recommend checking a trusted weather website or app (such as Weather.com, AccuWeather, or your preferred local service).","role":"assistant","tool_calls":null,"function_call":null,"refusal":null}}],"usage":{"completion_tokens":1187,"prompt_tokens":19,"total_tokens":1206,"completion_tokens_details":{"accepted_prediction_tokens":0,"audio_tokens":0,"reasoning_tokens":960,"rejected_prediction_tokens":0},"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0}},"service_tier":null,"prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"jailbreak":{"filtered":false,"detected":false},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}]}

Motivation, pitch

It would be nice if reasoning models support function calling in litellm.

Are you a ML Ops Team?

Yes

Twitter / LinkedIn details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions