Class RealtimeSessionController
Inheritance
object
RealtimeSessionController
Assembly: .dll
Syntax
public class RealtimeSessionController
Constructors
RealtimeSessionController(Model, Model, SystemLanguage, Action<float[]>, Action<float[]>, Action<AudioClip>, Action<string>, Action<string>, Action<string>, Action<string>, Action<string>, Action<ErrorResponse>, Action<string>, Action<RealtimeItemStatus>, FunctionManager, bool, bool, bool)
Create a new RealtimeSessionController instance.
Declaration
public RealtimeSessionController(Model rtmModel = null, Model sttModel = null, SystemLanguage spokenLanguage = null, Action<float[]> onReceiveAudio = null, Action<float[]> onReceiveAudioDone = null, Action<AudioClip> onReceiveAudioClip = null, Action<string> onReceiveText = null, Action<string> onReceiveTextDone = null, Action<string> onReceiveTranscript = null, Action<string> onReceiveTranscriptDone = null, Action<string> onReceiveInputTranscriptionSuccess = null, Action<ErrorResponse> onReceiveInputTranscriptionFailed = null, Action<string> onSessionStateChanged = null, Action<RealtimeItemStatus> onItemStatusChanged = null, FunctionManager functionManager = null, bool enableAudio = true, bool enableTranscript = true, bool autoManageWebSocketState = false)
Parameters
Type |
Name |
Description |
Model |
rtmModel |
|
Model |
sttModel |
|
SystemLanguage |
spokenLanguage |
|
Action<float[]> |
onReceiveAudio |
|
Action<float[]> |
onReceiveAudioDone |
|
Action<AudioClip> |
onReceiveAudioClip |
|
Action<string> |
onReceiveText |
|
Action<string> |
onReceiveTextDone |
|
Action<string> |
onReceiveTranscript |
|
Action<string> |
onReceiveTranscriptDone |
|
Action<string> |
onReceiveInputTranscriptionSuccess |
|
Action<ErrorResponse> |
onReceiveInputTranscriptionFailed |
|
Action<string> |
onSessionStateChanged |
|
Action<RealtimeItemStatus> |
onItemStatusChanged |
|
FunctionManager |
functionManager |
|
bool |
enableAudio |
|
bool |
enableTranscript |
|
bool |
autoManageWebSocketState |
|
RealtimeSessionController(RealtimeEventReceiverBase, Model, Model, SystemLanguage, bool, bool, bool)
Create a new RealtimeSessionController instance with a event receiver.
Declaration
public RealtimeSessionController(RealtimeEventReceiverBase eventReceiver, Model rtmModel = null, Model sttModel = null, SystemLanguage spokenLanguage = null, bool enableAudio = true, bool enableTranscript = true, bool autoManageWebSocketState = false)
Parameters
Type |
Name |
Description |
RealtimeEventReceiverBase |
eventReceiver |
|
Model |
rtmModel |
|
Model |
sttModel |
|
SystemLanguage |
spokenLanguage |
|
bool |
enableAudio |
|
bool |
enableTranscript |
|
bool |
autoManageWebSocketState |
|
Properties
AudioEnabled
Declaration
public bool AudioEnabled { get; set; }
Property Value
Declaration
public RealtimeAudioFormat InputFormat { get; set; }
Property Value
Declaration
public RealtimeAudioFormat OutputFormat { get; set; }
Property Value
RTMModel
Declaration
public Model RTMModel { get; set; }
Property Value
STTModel
Declaration
public Model STTModel { get; set; }
Property Value
SpokenLanguage
Declaration
public SystemLanguage SpokenLanguage { get; set; }
Property Value
Type |
Description |
SystemLanguage |
|
TranscriptEnabled
Declaration
public bool TranscriptEnabled { get; set; }
Property Value
Voice
Declaration
public Voice Voice { get; set; }
Property Value
WebSocket
Declaration
public IWebSocket WebSocket { get; }
Property Value
Type |
Description |
IWebSocket |
|
WebSocketState
Declaration
public WebSocketState WebSocketState { get; }
Property Value
Type |
Description |
WebSocketState |
|
Methods
CloseConnection(string)
Declaration
public UniTask CloseConnection(string closeReason = null)
Parameters
Type |
Name |
Description |
string |
closeReason |
|
Returns
Declaration
public UniTask CommitUserAudioStreamInput()
Returns
ConfigureSession(string, Model, Modality[], Voice, RealtimeAudioFormat, RealtimeAudioFormat, SpeechToTextOptions, TurnDetection, FunctionDeclaration[], ToolChoice, float, int?)
Declaration
public UniTask ConfigureSession(string instructions, Model model = null, Modality[] modalities = null, Voice voice = null, RealtimeAudioFormat inputAudioFormat = RealtimeAudioFormat.PCM16, RealtimeAudioFormat outputAudioFormat = RealtimeAudioFormat.PCM16, SpeechToTextOptions inputAudioTranscription = null, TurnDetection turnDetection = null, FunctionDeclaration[] tools = null, ToolChoice toolChoice = null, float temperature = 0.8, int? maxOutputTokens = null)
Parameters
Returns
ConnectAsync()
Declaration
public UniTask ConnectAsync()
Returns
ReconnectAsync(Model)
Declaration
public UniTask ReconnectAsync(Model model = null)
Parameters
Type |
Name |
Description |
Model |
model |
|
Returns
SendUserAudioClip(AudioClip)
Declaration
public UniTask SendUserAudioClip(AudioClip audioClip)
Parameters
Type |
Name |
Description |
AudioClip |
audioClip |
|
Returns
SendUserAudioFile(string)
Declaration
public UniTask SendUserAudioFile(string audioFilePath)
Parameters
Type |
Name |
Description |
string |
audioFilePath |
|
Returns
SendUserText(string)
Declaration
public UniTask SendUserText(string text)
Parameters
Type |
Name |
Description |
string |
text |
|
Returns
Declaration
public UniTask SetInputAudioTranscriptionEnabledAsync(bool enabled)
Parameters
Type |
Name |
Description |
bool |
enabled |
|
Returns
SetInstructionsAsync(string)
Declaration
public UniTask SetInstructionsAsync(string instructions)
Parameters
Type |
Name |
Description |
string |
instructions |
|
Returns
SetMaxOutputTokensAsync(int)
Declaration
public UniTask SetMaxOutputTokensAsync(int maxOutputTokens)
Parameters
Type |
Name |
Description |
int |
maxOutputTokens |
|
Returns
SetModelAsync(Model)
Declaration
public UniTask SetModelAsync(Model model)
Parameters
Type |
Name |
Description |
Model |
model |
|
Returns
SetTemperatureAsync(float)
Declaration
public UniTask SetTemperatureAsync(float temperature)
Parameters
Type |
Name |
Description |
float |
temperature |
|
Returns
SetVoiceAsync(Voice)
Declaration
public UniTask SetVoiceAsync(Voice voice)
Parameters
Type |
Name |
Description |
Voice |
voice |
|
Returns
StreamUserAudioClips(List<AudioClip>)
Declaration
public UniTask StreamUserAudioClips(List<AudioClip> audioClips)
Parameters
Type |
Name |
Description |
List<AudioClip> |
audioClips |
|
Returns
StreamUserAudioData(float[])
Declaration
public UniTask StreamUserAudioData(float[] audioData)
Parameters
Type |
Name |
Description |
float[] |
audioData |
|
Returns
StreamUserAudioFiles(List<string>)
Declaration
public UniTask StreamUserAudioFiles(List<string> audioFilePaths)
Parameters
Type |
Name |
Description |
List<string> |
audioFilePaths |
|
Returns