OpenAI

Function calling in the Chat Playground

You can use function calling in the OpenA Playground.

Updated: 13 days 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 "+Tools > Functions" in the configuration panel on the left side of the screen for Responses API or, simply, "+Function" for Chat Completions API.

Then, enter the JSON schema with function's parameters. You can use Beta "Generate" functionality to describe what you would like the function to do in plain text, to get a suggested JSON schema.

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

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" in schema

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.


Learn more about function calling with structured outputs.

How to force Function Choice in Playground

  1. Click on the "Settings" icon next to the model name

  2. Click on Tool Choice

  3. Change from "Auto" to "Required" or to desired function (previously created).

Was this article helpful?