Skip to main content
All CollectionsAPI
Function calling in the Chat Playground
Function calling in the Chat Playground

You can now use function calling in the OpenAI Chat Playground.

Updated over 5 months ago

Function calling allows you to describe any custom functions or external APIs to the assistant, which enables the assistant to intelligently call those functions by outputting a JSON object containing the relevant arguments.

How to use function calling in the Chat Playground

To add a new function, click "+ Add function" in the configuration panel on the right side of the screen.

Then, enter the JSON schema with function's parameters.

You’ll now see the function listed on the right side of the screen under “Functions.”

To test the function in the playground, enter a message that would trigger the model to call the function.

For example, for the get_weather function, enter: "what is the weather in Berkeley?"

When the function is called, enter the output of your function, e.g. "{temp: 80}" and press “Run.” The Assistant will then use the output of the function you’ve supplied for its response.

Does this support parallel function calling?

Yes, parallel function calling is supported in the Chat Playground.

Parallel function calling is the model's ability to perform multiple function calls together, allowing the effects and results of these function calls to be resolved in parallel. This is especially useful if functions take a long time, and reduces round trips with the API.

Turn on Structured Outputs by setting strict: "true"

When Structured Outputs is turned on, the arguments generated by the model for function calls are guaranteed to match the JSON Schema that you provide.

If you are not using Structured Outputs, then the structure of arguments is not guaranteed to be correct, so we recommend the use of a validation library like Pydantic to first verify the arguments prior to using them.

What are known limitations of function calling in the Chat Playground?

  • You cannot currently force the model to call a function in the Playground.

  • There is currently no way to save a function definition outside of saving a preset with a defined function.

Did this answer your question?