OpenAI API

ChatCompletionModalities

array

Output types that you would like the model to generate for this request.
Most models are capable of generating text, which is the default:

["text"]

The gpt-4o-audio-preview model can also be used to generate audio. To
request that this model generate both text and audio responses, you can
use:

["text", "audio"]

ChatCompletionNamedToolChoice

object

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

typestringrequired

The type of the tool. Currently, only function is supported.

Allowed values:function

functionobjectrequired
Show Child Parameters
Example

Assistant message

object

Messages sent by the model in response to user messages.

contentOne Of

The contents of the assistant message. Required unless tool_calls or function_call is specified.

Text contentstring

The contents of the assistant message.

refusalstring

The refusal message by the assistant.

rolestringrequired

The role of the messages author, in this case assistant.

Allowed values:assistant

namestring

An optional name for the participant. Provides the model information to differentiate between participants of the same role.

audioobject

Data about a previous audio response from the model.
Learn more.

Show Child Parameters
tool_callsarray[object]

The tool calls generated by the model, such as function calls.

Show Child Parameters
function_callobjectDEPRECATED

Deprecated and replaced by tool_calls. The name and arguments of a function that should be called, as generated by the model.

Show Child Parameters
Example

ChatCompletionRequestAssistantMessageContentPart

One Of
typestringrequired

The type of the content part.

Allowed values:text

textstringrequired

The text content.

Example

Developer message

object

Developer-provided instructions that the model should follow, regardless of
messages sent by the user. With o1 models and newer, developer messages
replace the previous system messages.

contentOne Of
required

The contents of the developer message.

Text contentstring

The contents of the developer message.

rolestringrequired

The role of the messages author, in this case developer.

Allowed values:developer

namestring

An optional name for the participant. Provides the model information to differentiate between participants of the same role.

Example