OpenAI's developer documentation systematically explains Function Calling : By declaring a function (tool) in a request, the model will return the function name and parameters to call when needed. The application then executes the function and returns the result to the model, forming a closed loop of "inference-call-feedback." This capability is now recommended through the Responses API , supporting multimodal interactions such as text and images, and collaboration with hosted tools, replacing the previous usage that primarily relied on Chat Completions.
The guide emphasizes describing function parameters using JSON Schema and recommends stricter constraints (such as disallowing additional attributes). This, combined with Structured Outputs , significantly improves parsability and consistency. It also provides tool_choice (auto/required/none) and multiple/parallel tool invocation paradigms, supporting the inclusion of tool return results in subsequent context for continued reasoning. The migration documentation provides differences and examples for transitioning from Assistants/Chat Completions to Responses. The documentation also reminds developers that the model is only responsible for "suggesting calls," and actual execution and security verification must be managed by the developer, with parameter validation and permission control required.
Frequently Asked Questions
Q: What is the relationship between Function Calling and Responses API?
A: Responses is the currently recommended interface, natively supporting tool calls, evented output, and multimodality, replacing the old version that was mainly based on Chat Completions.
Q: How to make the model "required" to call a function?
A: Set tool_choice to required in the request, or provide only required tools and specify the constraints in the prompt.
Q: Can it be used with structured output?
A: Yes. Use JSON Schema to strictly constrain function parameters. Combined with Structured Outputs, you can require the final answer to be returned according to the schema, reducing parsing and illusions.
Q: Can I call multiple functions at once?
A: Multiple tool calls can be returned in one response. Applications should execute them sequentially and use the results as input for subsequent rounds.
Q: What are the key points of migration?
A: Function definitions and return items use the new event/item format in Responses. Request bodies and parsing logic need to be updated according to the migration guide.