Class RealtimeSession
A session refers to a single WebSocket connection between a client and the server.
Once a client creates a session, it then sends JSON-formatted events containing text and audio chunks. The server will respond in kind with audio containing voice output, a text transcript of that voice output, and function calls (if functions are provided by the client).
A realtime Session represents the overall client-server interaction, and contains default configuration.
It has a set of default values which can be updated at any time (via session.update) or on a per-response level (via response.create).
Inheritance
Namespace: Glitch9.AIDevKit.OpenAI.Realtime
Assembly: .dll
Syntax
public class RealtimeSession
Properties
Id
The unique ID of the session.
Declaration
public string Id { get; set; }
Property Value
Type | Description |
---|---|
string |
InputAudioFormat
The format of input audio.
Declaration
public RealtimeAudioFormat? InputAudioFormat { get; set; }
Property Value
Type | Description |
---|---|
RealtimeAudioFormat? |
InputAudioTranscription
Configuration for input audio transcription.
Declaration
public SpeechToTextOptions InputAudioTranscription { get; set; }
Property Value
Type | Description |
---|---|
SpeechToTextOptions |
Instructions
The default system instructions.
Declaration
public string Instructions { get; set; }
Property Value
Type | Description |
---|---|
string |
MaxOutputTokens
Maximum number of output tokens.
Declaration
public int? MaxOutputTokens { get; set; }
Property Value
Type | Description |
---|---|
int? |
Modalities
The set of modalities the model can respond with.
Declaration
public Modality[] Modalities { get; set; }
Property Value
Type | Description |
---|---|
Modality[] |
Model
The default model used for this session.
Declaration
public Model Model { get; set; }
Property Value
Type | Description |
---|---|
Model |
Object
The object type, must be "realtime.session".
Declaration
public string Object { get; set; }
Property Value
Type | Description |
---|---|
string |
OutputAudioFormat
The format of output audio.
Declaration
public RealtimeAudioFormat? OutputAudioFormat { get; set; }
Property Value
Type | Description |
---|---|
RealtimeAudioFormat? |
Temperature
Sampling temperature.
Declaration
public float? Temperature { get; set; }
Property Value
Type | Description |
---|---|
float? |
ToolChoice
How the model chooses tools.
Declaration
public ToolChoice ToolChoice { get; set; }
Property Value
Type | Description |
---|---|
ToolChoice |
Tools
Tools (functions) available to the model.
Declaration
public FunctionDeclaration[] Tools { get; set; }
Property Value
Type | Description |
---|---|
FunctionDeclaration[] |
TurnDetection
Configuration for turn detection.
Declaration
public TurnDetection TurnDetection { get; set; }
Property Value
Type | Description |
---|---|
TurnDetection |
Voice
The voice the model uses to respond.
Declaration
public Voice Voice { get; set; }
Property Value
Type | Description |
---|---|
Voice |
Methods
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |