RequestSession Class
Extended RequestSession that tracks explicitly set None values.
Constructor
RequestSession(*args: Any, **kwargs: Any)
Methods
| as_dict |
Convert to dict, including explicitly set None values. |
| 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
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
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
include
List of include options for the session (e.g., logprobs, phrases, file search results).
include: list[str | '_models.SessionIncludeOption'] | 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
interim_response
Configuration for interim response generation during latency or tool calls. Is either a StaticInterimResponseConfig type or a LlmInterimResponseConfig type.
interim_response: '_types.InterimResponseConfig' | 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
metadata
Set of up to 16 key-value pairs that can be attached to the session. This is useful for storing additional information about the session in a structured format, such as tracking IDs, user context, or application-specific labels. These key-value pairs are also included in Foundry resource logs for tracing and diagnostics. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
metadata: dict[str, str] | None
modalities
The modalities to be used in the session.
modalities: list[str | '_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[str | '_models.AudioTimestampType'] | None
reasoning_effort
Constrains effort on reasoning for reasoning models. Check model documentation for supported values for each model. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. Known values are: "none", "minimal", "low", "medium", "high", and "xhigh".
reasoning_effort: str | '_models.ReasoningEffort' | 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