Prompt
function calling api
Latest observation
Oct 8, 2026
OpenAI APIWeb search: off
If you mean function calling with an AI API, here’s the basic idea:
What it is
You define a tool/function in your app, send its schema to the model, and the model can respond with a request to call that function instead of plain text.
Typical flow
- You define functions the model may use.
- Send user message + function definitions to the model.
- The model replies with either:
- normal text, or
- a structured function call like
get_weather({ "city": "Paris" })
- Your app executes the function
- You send the function result back to the model
- The model produces the final answer
Example concept
Suppose you define:
{
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": {
"city": { "type": "string" }
},
"required": ["city"]
}
}
User asks:
What’s the weather in London?
The model may return:
{
"name": "get_weather",
"arguments": {
"city": "London"
}
}
Your code calls your weather API, then passes the result back to the model.
If you want code
Tell me which API you’re using:
- OpenAI
- Anthropic
- Google Gemini
- Azure OpenAI
- another
and I can give you a working example in Python or JavaScript.