VoiceAgentConnection interface
接続された双方向のボイスエージェントストリームです。
サーバーイベントに対して正確に1回 for await 反復をサポートします。2回目の試みはスローします。
ループを早期に終了する(break、 return、またはループボディの未検出エラー)は、副次的に接続を閉じます。
認識されないサーバーイベントタイプは、ストリームを中断することなく VoiceAgentUnknownEvent として配信されます。 誤った形のイベントは依然としてプロトコルエラーで反復失敗します。
- Extends
-
AsyncIterable<VoiceAgentRealtimeEvent>
メソッド
| cancel |
進行中の応答をキャンセルします。 |
| clear |
バッファされた入力音声をクリアします。 |
| clear |
サービスで未処理の音声をクリアします。 |
| close(number, string) | WebSocket接続を優雅に閉じます。 |
| commit |
コミットはバッファ化された入力音声です。 |
| configure |
アップデートはライブセッション設定に対応しました。 |
| dispose() | つながりを解放します。 閉じる()に相当します。 |
| request |
新しい返答を求める。 |
| send |
入力バッファにbase64でエンコードされたオーディオバイトを追加します。 |
| send |
生成されたクライアントプロトコルイベントを送信します。 |
| send |
ユーザーテキスト項目を追加し、デフォルトで応答を要求します。 |
| send |
クライアントが実行した関数の結果をエージェントに返します。 |
継承されたメソッド
| [async |
プロパティの詳細
closed
state
メソッドの詳細
cancelResponse(VoiceAgentCancelResponseOptions)
進行中の応答をキャンセルします。
function cancelResponse(options?: VoiceAgentCancelResponseOptions): Promise<void>
パラメーター
- options
- VoiceAgentCancelResponseOptions
返品
Promise<void>
clearInputAudio(VoiceAgentEventOptions)
バッファされた入力音声をクリアします。
function clearInputAudio(options?: VoiceAgentEventOptions): Promise<void>
パラメーター
- options
- VoiceAgentEventOptions
返品
Promise<void>
clearOutputAudio(VoiceAgentEventOptions)
サービスで未処理の音声をクリアします。
function clearOutputAudio(options?: VoiceAgentEventOptions): Promise<void>
パラメーター
- options
- VoiceAgentEventOptions
返品
Promise<void>
close(number, string)
WebSocket接続を優雅に閉じます。
function close(code?: number, reason?: string): Promise<void>
パラメーター
- code
-
number
- reason
-
string
返品
Promise<void>
commitAudio(VoiceAgentEventOptions)
コミットはバッファ化された入力音声です。
function commitAudio(options?: VoiceAgentEventOptions): Promise<void>
パラメーター
- options
- VoiceAgentEventOptions
返品
Promise<void>
configureSession(VoiceAgentSessionUpdateConfig, VoiceAgentSessionUpdateOptions)
アップデートはライブセッション設定に対応しました。
function configureSession(session: VoiceAgentSessionUpdateConfig, options?: VoiceAgentSessionUpdateOptions): Promise<void>
パラメーター
- session
- VoiceAgentSessionUpdateConfig
- options
- VoiceAgentSessionUpdateOptions
返品
Promise<void>
dispose()
つながりを解放します。 閉じる()に相当します。
function dispose(): Promise<void>
返品
Promise<void>
requestResponse(VoiceAgentResponseOptions)
新しい返答を求める。
function requestResponse(options?: VoiceAgentResponseOptions): Promise<void>
パラメーター
- options
- VoiceAgentResponseOptions
返品
Promise<void>
sendAudio(ArrayBuffer | Uint8Array, VoiceAgentEventOptions)
入力バッファにbase64でエンコードされたオーディオバイトを追加します。
function sendAudio(audio: ArrayBuffer | Uint8Array, options?: VoiceAgentEventOptions): Promise<void>
パラメーター
- audio
-
ArrayBuffer | Uint8Array
- options
- VoiceAgentEventOptions
返品
Promise<void>
sendEvent(VoiceAgentClientEvent, VoiceAgentSendOptions)
生成されたクライアントプロトコルイベントを送信します。
function sendEvent(event: VoiceAgentClientEvent, options?: VoiceAgentSendOptions): Promise<void>
パラメーター
- event
- VoiceAgentClientEvent
- options
- VoiceAgentSendOptions
返品
Promise<void>
sendText(string, VoiceAgentSendTextOptions)
ユーザーテキスト項目を追加し、デフォルトで応答を要求します。
function sendText(text: string, options?: VoiceAgentSendTextOptions): Promise<void>
パラメーター
- text
-
string
- options
- VoiceAgentSendTextOptions
返品
Promise<void>
sendToolOutput(string, string, VoiceAgentSendToolOutputOptions)
クライアントが実行した関数の結果をエージェントに返します。
function sendToolOutput(callId: string, output: string, options?: VoiceAgentSendToolOutputOptions): Promise<void>
パラメーター
- callId
-
string
- output
-
string
- options
- VoiceAgentSendToolOutputOptions
返品
Promise<void>
継承済みメソッドの詳細
[asyncIterator]()
function [asyncIterator](): AsyncIterator<VoiceAgentRealtimeEvent, any, any>
返品
AsyncIterator<VoiceAgentRealtimeEvent, any, any>
継承 非同期イテラブル。[非同期イテレーター]