Function Calling
Before this, models wrote pretend function calls in prose. Now the API returns a structured call.
Deli ticket: item name plus extras, not a paragraph about a sandwich.
Visual Workflows
Start here — scroll inside each diagram frame to explore, then use + / − to zoom up to 200% if needed.
Overview
Scroll inside the frame to explore · use + / − to zoom up to 200%
Scroll inside the frame to explore · use + / − to zoom up to 200%
Weather call
Scroll inside the frame to explore · use + / − to zoom up to 200%
The model does not fetch weather. It names get_weather and fills city.
Key Takeaways
- 1.Function calling is the original name for tool calling — same idea, OpenAI shape. You send tools[]; the model returns name + JSON arguments.
- 2.tool_choice can be auto, required, or one named function. Anthropic and Gemini use different blocks — same JSON Schema idea.
- 3.OpenAI: tools with type function, parameters as JSON Schema. Response: tool_calls[]. tool_choice steers whether a call is optional.
- 4.Other providers differ in envelope, not in the idea.
Learn elsewhere
- →Tool Calling
- →Structured Outputs
Real Example
Scenario
GPT returns get_weather with {"city":"Berlin"}. Your code hits the API. Next turn the model speaks the forecast.
What you would do
In Tool Calling & Function Calling, apply Function Calling to this scenario: GPT returns get_weather with {"city":"Berlin"}. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.
Commands
Commands to Remember
tools[] + JSON Schemaname + argumentstool_choice = auto | requiredSame idea across providers
Cheat Sheet
Quick recap
quick ref- •Structured call, not prose
- •Schema describes args
- •You still run the function
- •Providers differ in envelope
Common Mistakes
- ✕Parsing prose instead of the tool_calls field
- ✕Omitting parameter types in the schema
- ✕Assuming every provider uses the OpenAI envelope
