Add functions to prompts in the playground.
Models Supporting Function Calling
Add function(s)
button, which will open a modal to add existing functions to
your prompt or allow you to create a new one.
Functions are version-controlled. You can select the version of the functions you want and then click the switch to enable the functions.
You can also create a new function by defining your function JSON schema in the editor.
The parameters the function accepts should be described as a JSON Schema object.
See the OpenAI guide for examples,
and the JSON Schema reference for documentation about the format.
To describe a function that accepts no parameters, provide the value { "type": "object", "properties": {} }
.
Copying an existing from your IDE, click the Fix schema
button to fix the formatting automatically.
Fix schema ensures you are following OpenAI json schema requirements. Changes made include:
^[a-zA-Z0-9_-]{1,64}$
json_object
.
Note, setting response format to json_object
will require you to use the word JSON
in your prompt.
List of models supporting JSON mode
gpt-3.5-turbo
gpt-3.5-turbo-1106
gpt-3.5-turbo-0125
gpt-4-turbo-preview
gpt-4-1106-preview
gpt-4-0125-preview
mistral-small-latest
mistral-large-latest