OpenAI API

FileSearch tool

object
typestringrequired

The type of tool being defined: file_search

Allowed values:file_search

Example

Function tool

object
typestringrequired

The type of tool being defined: function

Allowed values:function

functionobjectrequired
Show Child Parameters
Example

AssistantsApiResponseFormatOption

Specifies the format that the model must output. Compatible with GPT-4o, GPT-4 Turbo, and all GPT-3.5 Turbo models since gpt-3.5-turbo-1106.

Setting to { "type": "json_schema", "json_schema": {...} } enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.

Setting to { "type": "json_object" } enables JSON mode, which ensures the message the model generates is valid JSON.

Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly “stuck” request. Also note that the message content may be partially cut off if finish_reason="length", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.

One Of

AssistantsApiToolChoiceOption

Controls which (if any) tool is called by the model.
none means the model will not call any tools and instead generates a message.
auto is the default value and means the model can pick between generating a message or calling one or more tools.
required means the model must call one or more tools before responding to the user.
Specifying a particular tool like {"type": "file_search"} or {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.

One Of

AssistantsNamedToolChoice

object

Specifies a tool the model should use. Use to force the model to call a specific tool.

typestringrequired

The type of the tool. If type is function, the function name must be set

Allowed values:functioncode_interpreterfile_search

functionobject
Show Child Parameters
Example