ResponseSession Class
Base for session configuration in the response.
Constructor
ResponseSession(*args: Any, **kwargs: Any)
Variables
| Name | Description |
|---|---|
|
model
|
The model for the session. |
|
modalities
|
The modalities to be used in the session. |
|
animation
|
The animation configuration for the session. |
|
voice
|
The voice configuration for the session. Is one of the following types: Union[str, "_models.OpenAIVoiceName"], OpenAIVoice, AzureVoice |
|
instructions
|
Optional instructions to guide the model's behavior throughout the session. |
|
input_audio_sampling_rate
|
Input audio sampling rate in Hz. Available values:
|
|
input_audio_format
|
Input audio format. Default is 'pcm16'. Known values are: "pcm16", "g711_ulaw", and "g711_alaw". |
|
output_audio_format
|
Output audio format. Default is 'pcm16'. Known values are: "pcm16", "pcm16-8000hz", "pcm16-16000hz", "g711_ulaw", and "g711_alaw". |
|
turn_detection
|
Type of turn detection to use. |
|
input_audio_noise_reduction
|
Configuration for input audio noise reduction. |
|
input_audio_echo_cancellation
|
Configuration for echo cancellation during server-side audio processing. |
|
avatar
|
Configuration for avatar streaming and behavior during the session. |
|
input_audio_transcription
|
Configuration for input audio transcription. |
|
output_audio_timestamp_types
|
Types of timestamps to include in audio response content. |
|
tools
|
Configuration for tools to be used during the session, if applicable. |
|
tool_choice
|
Specifies which tools the model is allowed to call during the session. Is either a Union[str, "_models.ToolChoiceLiteral"] type or a ToolChoiceSelection type. |
|
temperature
|
Controls the randomness of the model's output. Range: 0.0 to 1.0. Default is 0.7. |
|
max_response_output_tokens
|
Maximum number of tokens to generate in the response. Default is unlimited. Is either a int type or a Literal["inf"] type. |
|
agent
|
The agent configuration for the session, if applicable. |
|
id
|
The unique identifier for the session. |
Methods
| as_dict |
Return a dict that can be turned into json using json.dump. |
| clear |
Remove all items from D. |
| 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: D[k] if k in D, else d. :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 D is empty. |
| setdefault |
Same as calling D.get(k, d), and setting D[k]=d if k not found :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: D[k] if k in D, else d. :rtype: any |
| update |
Updates D from mapping/iterable E and F. :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 D.
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: D[k] if k in D, else d. :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 |
|---|---|
|
set-like object providing a view on D's items |
keys
keys() -> KeysView[str]
Returns
| Type | Description |
|---|---|
|
a set-like object providing a view on D'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 D is empty.
popitem() -> tuple[str, Any]
setdefault
Same as calling D.get(k, d), and setting D[k]=d if k not found :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: D[k] if k in D, else d. :rtype: any
setdefault(key: str, default: ~typing.Any = <object object>) -> Any
Parameters
| Name | Description |
|---|---|
|
key
Required
|
|
|
default
|
|
update
Updates D from mapping/iterable E and F. :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 D's values |
Attributes
agent
The agent configuration for the session, if applicable.
agent: _models.AgentConfig | None
animation
The animation configuration for the session.
animation: _models.Animation | None
avatar
Configuration for avatar streaming and behavior during the session.
avatar: _models.AvatarConfig | None
id
The unique identifier for the session.
id: str | None
input_audio_echo_cancellation
Configuration for echo cancellation during server-side audio processing.
input_audio_echo_cancellation: _models.AudioEchoCancellation | None
input_audio_format
"pcm16", "g711_ulaw", and "g711_alaw".
input_audio_format: str | _models.InputAudioFormat | None
input_audio_noise_reduction
Configuration for input audio noise reduction.
input_audio_noise_reduction: _models.AudioNoiseReduction | None
input_audio_sampling_rate
Input audio sampling rate in Hz. Available values:
- For pcm16: 8000, 16000, 24000
- For g711_alaw/g711_ulaw: 8000.
input_audio_sampling_rate: int | None
input_audio_transcription
Configuration for input audio transcription.
input_audio_transcription: _models.AudioInputTranscriptionOptions | None
instructions
Optional instructions to guide the model's behavior throughout the session.
instructions: str | None
max_response_output_tokens
Maximum number of tokens to generate in the response. Default is unlimited. Is either a int type or a Literal["inf"] type.
max_response_output_tokens: int | Literal['inf'] | None
modalities
The modalities to be used in the session.
modalities: list[typing.Union[str, ForwardRef('_models.Modality')]] | None
model
The model for the session.
model: str | None
output_audio_format
"pcm16", "pcm16-8000hz", "pcm16-16000hz", "g711_ulaw", and "g711_alaw".
output_audio_format: str | _models.OutputAudioFormat | None
output_audio_timestamp_types
Types of timestamps to include in audio response content.
output_audio_timestamp_types: list[typing.Union[str, ForwardRef('_models.AudioTimestampType')]] | None
temperature
0.0 to 1.0. Default is 0.7.
temperature: float | None
tool_choice
Specifies which tools the model is allowed to call during the session. Is either a Union[str, "_models.ToolChoiceLiteral"] type or a ToolChoiceSelection type.
tool_choice: _types.ToolChoice | None
tools
Configuration for tools to be used during the session, if applicable.
tools: list['_models.Tool'] | None
turn_detection
Type of turn detection to use.
turn_detection: _models.TurnDetection | None
voice
Union[str, "_models.OpenAIVoiceName"], OpenAIVoice, AzureVoice
voice: _types.Voice | None