Class RealtimeResponseCreateParams
Create a new Realtime response with these parameters.
public sealed class RealtimeResponseCreateParams
- Inheritance
-
RealtimeResponseCreateParams
- Inherited Members
Constructors
RealtimeResponseCreateParams()
public RealtimeResponseCreateParams()
RealtimeResponseCreateParams(Modality, string, string, RealtimeAudioFormat, IEnumerable<Tool>, string, float?, int?, ConversationResponseType, IReadOnlyDictionary<string, string>, IEnumerable<ConversationItem>)
Constructor.
public RealtimeResponseCreateParams(Modality modalities = Modality.Text | Modality.Audio, string instructions = null, string voice = null, RealtimeAudioFormat outputAudioFormat = RealtimeAudioFormat.PCM16, IEnumerable<Tool> tools = null, string toolChoice = null, float? temperature = null, int? maxResponseOutputTokens = null, ConversationResponseType conversation = ConversationResponseType.Auto, IReadOnlyDictionary<string, string> metadata = null, IEnumerable<ConversationItem> input = null)
Parameters
modalities
ModalityThe set of modalities the model can respond with. To disable audio, set this to ["text"].
instructions
stringThe 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 thesession.created
event at the start of the session.voice
stringThe voice the model uses to respond. Voice cannot be changed during the session once the model has responded with audio at least once. Current voice options are
alloy
,ash
,ballad
,coral
,echo
sage
,shimmer
andverse
.outputAudioFormat
RealtimeAudioFormatThe format of output audio. Options are
pcm16
,g711_ulaw
, org711_alaw
.tools
IEnumerable<Tool>The description of the function, including guidance on when and how to call it, and guidance about what to tell the user when calling (if anything).
toolChoice
stringHow the model chooses tools. Options are
auto
,none
,required
, or specify a function, like{"type": "function", "function": {"name": "my_function"}}
.temperature
float?Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.
maxResponseOutputTokens
int?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 toinf
.conversation
ConversationResponseTypeControls which conversation the response is added to. Currently, supports
auto
andnone
, withauto
as the default value. Theauto
value means that the contents of the response will be added to the default conversation. Set this tonone
to create an out-of-band response which will not add items to default conversation.metadata
IReadOnlyDictionary<string, string>Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
input
IEnumerable<ConversationItem>Input items to include in the prompt for the model. Using this field creates a new context for this Response instead of using the default conversation. An empty array
[]
will clear the context for this Response.
Note that this can include references to items from the default conversation.
Properties
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.
[JsonInclude]
[JsonPropertyName("conversation")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public ConversationResponseType Conversation { get; }
Property Value
Input
Input items to include in the prompt for the model. Using this field
creates a new context for this Response instead of using the default
conversation. An empty array []
will clear the context for this Response.
Note that this can include references to items from the default conversation.
[JsonInclude]
[JsonPropertyName("input")]
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public IReadOnlyList<ConversationItem> Input { get; }
Property Value
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.
[JsonInclude]
[JsonPropertyName("instructions")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string Instructions { get; }
Property Value
MaxResponseOutputTokens
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
.
[JsonInclude]
[JsonPropertyName("max_response_output_tokens")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public object MaxResponseOutputTokens { get; }
Property Value
Metadata
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
[JsonInclude]
[JsonPropertyName("metadata")]
public IReadOnlyDictionary<string, string> Metadata { get; }
Property Value
Modalities
The set of modalities the model can respond with. To disable audio, set this to ["text"].
[JsonInclude]
[JsonPropertyName("modalities")]
[JsonConverter(typeof(ModalityConverter))]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public Modality Modalities { get; }
Property Value
OutputAudioFormat
The format of output audio. Options are pcm16
, g711_ulaw
, or g711_alaw
.
[JsonInclude]
[JsonPropertyName("output_audio_format")]
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[JsonConverter(typeof(JsonStringEnumConverter<RealtimeAudioFormat>))]
public RealtimeAudioFormat OutputAudioFormat { get; }
Property Value
Temperature
Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.
[JsonInclude]
[JsonPropertyName("temperature")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public float? Temperature { get; }
Property Value
ToolChoice
How the model chooses tools. Options are auto
, none
, required
, or
specify a function, like {"type": "function", "function": {"name": "my_function"}}
.
[JsonInclude]
[JsonPropertyName("tool_choice")]
public object ToolChoice { get; }
Property Value
Tools
The description of the function, including guidance on when and how to call it, and guidance about what to tell the user when calling (if anything).
[JsonInclude]
[JsonPropertyName("tools")]
public IReadOnlyList<Function> Tools { get; }
Property Value
Voice
The voice the model uses to respond.
Voice cannot be changed during the session once the model has responded with audio at least once.
Current voice options are alloy
, ash
, ballad
, coral
, echo
sage
, shimmer
and verse
.
[JsonInclude]
[JsonPropertyName("voice")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string Voice { get; }