VoiceAgentResponseCreateParams Class

Parameters accepted by a voice-agent response.create event.

Constructor

VoiceAgentResponseCreateParams(*args: Any, **kwargs: Any)

Variables

Name Description
instructions
str

The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. Note that the server sets default instructions which will be used if this field is not set and are visible in the session.created event at the start of the session.

tools

Tools available to the model.

tool_choice

How the model chooses tools. Provide one of the string modes or force a specific function/MCP tool. Is one of the following types: Union[str, "_models.ToolChoiceOptions"], ToolChoiceFunction, ToolChoiceMCP

parallel_tool_calls

Whether the model may call multiple tools in parallel. Only supported by reasoning Realtime models such as gpt-realtime-2.

reasoning
max_output_tokens
int or str

Maximum number of output tokens for a single assistant response, inclusive of tool calls. Provide an integer between 1 and 4096 to limit output tokens, or inf for the maximum available tokens for a given model. Defaults to inf. Is either a int type or a Literal["inf"] type.

conversation
str or str or str

Controls which conversation the response is added to. Currently supports auto and none, with auto as the default value. The auto value means that the contents of the response will be added to the default conversation. Set this to none to create an out-of-band response which will not add items to default conversation. Is one of the following types: Literal["auto"], Literal["none"], str

metadata
output_modalities

Modalities that the response may return.

audio

Response-specific audio settings.

input

Conversation items used as inline response input.

pre_generated_assistant_message

A pre-generated assistant message used to begin the response.

interim_response

Interim-response settings for this response.

Methods

as_dict

Return a dict that can be turned into json using json.dump.

clear

Remove all items from the dictionary.

copy
get

Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None :returns: The value for key if key is in the dictionary, else default. :rtype: any

items
keys
pop

Removes specified key and return the corresponding value. :param str key: The key to pop. :param any default: The value to return if key is not in the dictionary :returns: The value corresponding to the key. :rtype: any :raises KeyError: If key is not found and default is not given.

popitem

Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple :raises KeyError: if the dictionary is empty.

setdefault

Return the value for key if key is in the dictionary; otherwise set the key to default and return default. :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: The value for key if key is in the dictionary, else default. :rtype: any

update

Update the dictionary from a mapping or an iterable of key-value pairs. :param any args: Either a mapping object or an iterable of key-value pairs.

values

as_dict

Return a dict that can be turned into json using json.dump.

as_dict(*, exclude_readonly: bool = False) -> dict[str, Any]

Keyword-Only Parameters

Name Description
exclude_readonly

Whether to remove the readonly properties.

Default value: False

Returns

Type Description

A dict JSON compatible object

clear

Remove all items from the dictionary.

clear() -> None

copy

copy() -> Model

get

Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None :returns: The value for key if key is in the dictionary, else default. :rtype: any

get(key: str, default: Any = None) -> Any

Parameters

Name Description
key
Required
default
Default value: None

items

items() -> ItemsView[str, Any]

Returns

Type Description

a set-like object providing a view on the mapping's items

keys

keys() -> KeysView[str]

Returns

Type Description

a set-like object providing a view on the mapping's keys

pop

Removes specified key and return the corresponding value. :param str key: The key to pop. :param any default: The value to return if key is not in the dictionary :returns: The value corresponding to the key. :rtype: any :raises KeyError: If key is not found and default is not given.

pop(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

popitem

Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple :raises KeyError: if the dictionary is empty.

popitem() -> tuple[str, Any]

setdefault

Return the value for key if key is in the dictionary; otherwise set the key to default and return default. :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: The value for key if key is in the dictionary, else default. :rtype: any

setdefault(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

update

Update the dictionary from a mapping or an iterable of key-value pairs. :param any args: Either a mapping object or an iterable of key-value pairs.

update(*args: Any, **kwargs: Any) -> None

values

values() -> ValuesView[Any]

Returns

Type Description

an object providing a view on the mapping's values

Attributes

audio

Response-specific audio settings.

audio: _models.PickPropertiesVoiceAgentAudioConfig | None

conversation

Controls which conversation the response is added to. Currently supports auto and none, with auto as the default value. The auto value means that the contents of the response will be added to the default conversation. Set this to none to create an out-of-band response which will not add items to default conversation. Is one of the following types: Literal["auto"], Literal["none"], str

conversation: Literal['auto'] | Literal['none'] | str | None

input

Conversation items used as inline response input.

input: list['_models.RealtimeConversationItem'] | None

instructions

The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. Note that the server sets default instructions which will be used if this field is not set and are visible in the session.created event at the start of the session.

instructions: str | None

interim_response

Interim-response settings for this response.

interim_response: _models.VoiceAgentInterimResponseConfig | None

max_output_tokens

Maximum number of output tokens for a single assistant response, inclusive of tool calls. Provide an integer between 1 and 4096 to limit output tokens, or inf for the maximum available tokens for a given model. Defaults to inf. Is either a int type or a Literal["inf"] type.

max_output_tokens: int | Literal['inf'] | None

metadata

metadata: _models.Metadata | None

output_modalities

Modalities that the response may return.

output_modalities: list[typing.Union[str, ForwardRef('_models.VoiceOutputModality')]] | None

parallel_tool_calls

Whether the model may call multiple tools in parallel. Only supported by reasoning Realtime models such as gpt-realtime-2.

parallel_tool_calls: bool | None

pre_generated_assistant_message

A pre-generated assistant message used to begin the response.

pre_generated_assistant_message: _models.RealtimeConversationItem | None

reasoning

reasoning: _models.RealtimeReasoning | None

tool_choice

How the model chooses tools. Provide one of the string modes or force a specific function/MCP tool. Is one of the following types: Union[str, "_models.ToolChoiceOptions"], ToolChoiceFunction, ToolChoiceMCP

tool_choice: str | _models.ToolChoiceOptions | _models.ToolChoiceFunction | _models.ToolChoiceMCP | None

tools

Tools available to the model.

tools: list[typing.Union[ForwardRef('_models.RealtimeFunctionTool'), ForwardRef('_models.MCPTool')]] | None