VoiceAgentConnection interface

接続された双方向のボイスエージェントストリームです。

サーバーイベントに対して正確に1回 for await 反復をサポートします。2回目の試みはスローします。 ループを早期に終了する(breakreturn、またはループボディの未検出エラー)は、副次的に接続を閉じます。 認識されないサーバーイベントタイプは、ストリームを中断することなく VoiceAgentUnknownEvent として配信されます。 誤った形のイベントは依然としてプロトコルエラーで反復失敗します。

Extends

AsyncIterable<VoiceAgentRealtimeEvent>

プロパティ

closed

接続が閉じると解決します。

state

現在の接続状態。

メソッド

cancelResponse(VoiceAgentCancelResponseOptions)

進行中の応答をキャンセルします。

clearInputAudio(VoiceAgentEventOptions)

バッファされた入力音声をクリアします。

clearOutputAudio(VoiceAgentEventOptions)

サービスで未処理の音声をクリアします。

close(number, string)

WebSocket接続を優雅に閉じます。

commitAudio(VoiceAgentEventOptions)

コミットはバッファ化された入力音声です。

configureSession(VoiceAgentSessionUpdateConfig, VoiceAgentSessionUpdateOptions)

アップデートはライブセッション設定に対応しました。

dispose()

つながりを解放します。 閉じる()に相当します。

requestResponse(VoiceAgentResponseOptions)

新しい返答を求める。

sendAudio(ArrayBuffer | Uint8Array, VoiceAgentEventOptions)

入力バッファにbase64でエンコードされたオーディオバイトを追加します。

sendEvent(VoiceAgentClientEvent, VoiceAgentSendOptions)

生成されたクライアントプロトコルイベントを送信します。

sendText(string, VoiceAgentSendTextOptions)

ユーザーテキスト項目を追加し、デフォルトで応答を要求します。

sendToolOutput(string, string, VoiceAgentSendToolOutputOptions)

クライアントが実行した関数の結果をエージェントに返します。

継承されたメソッド

[asyncIterator]()

プロパティの詳細

closed

接続が閉じると解決します。

closed: Promise<VoiceAgentCloseResult>

プロパティ値

state

現在の接続状態。

state: VoiceAgentConnectionState

プロパティ値

メソッドの詳細

cancelResponse(VoiceAgentCancelResponseOptions)

進行中の応答をキャンセルします。

function cancelResponse(options?: VoiceAgentCancelResponseOptions): Promise<void>

パラメーター

返品

Promise<void>

clearInputAudio(VoiceAgentEventOptions)

バッファされた入力音声をクリアします。

function clearInputAudio(options?: VoiceAgentEventOptions): Promise<void>

パラメーター

返品

Promise<void>

clearOutputAudio(VoiceAgentEventOptions)

サービスで未処理の音声をクリアします。

function clearOutputAudio(options?: VoiceAgentEventOptions): Promise<void>

パラメーター

返品

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>

パラメーター

返品

Promise<void>

configureSession(VoiceAgentSessionUpdateConfig, VoiceAgentSessionUpdateOptions)

アップデートはライブセッション設定に対応しました。

function configureSession(session: VoiceAgentSessionUpdateConfig, options?: VoiceAgentSessionUpdateOptions): Promise<void>

パラメーター

返品

Promise<void>

dispose()

つながりを解放します。 閉じる()に相当します。

function dispose(): Promise<void>

返品

Promise<void>

requestResponse(VoiceAgentResponseOptions)

新しい返答を求める。

function requestResponse(options?: VoiceAgentResponseOptions): Promise<void>

パラメーター

返品

Promise<void>

sendAudio(ArrayBuffer | Uint8Array, VoiceAgentEventOptions)

入力バッファにbase64でエンコードされたオーディオバイトを追加します。

function sendAudio(audio: ArrayBuffer | Uint8Array, options?: VoiceAgentEventOptions): Promise<void>

パラメーター

audio

ArrayBuffer | Uint8Array

返品

Promise<void>

sendEvent(VoiceAgentClientEvent, VoiceAgentSendOptions)

生成されたクライアントプロトコルイベントを送信します。

function sendEvent(event: VoiceAgentClientEvent, options?: VoiceAgentSendOptions): Promise<void>

パラメーター

返品

Promise<void>

sendText(string, VoiceAgentSendTextOptions)

ユーザーテキスト項目を追加し、デフォルトで応答を要求します。

function sendText(text: string, options?: VoiceAgentSendTextOptions): Promise<void>

パラメーター

text

string

返品

Promise<void>

sendToolOutput(string, string, VoiceAgentSendToolOutputOptions)

クライアントが実行した関数の結果をエージェントに返します。

function sendToolOutput(callId: string, output: string, options?: VoiceAgentSendToolOutputOptions): Promise<void>

パラメーター

callId

string

output

string

返品

Promise<void>

継承済みメソッドの詳細

[asyncIterator]()

function [asyncIterator](): AsyncIterator<VoiceAgentRealtimeEvent, any, any>

返品

AsyncIterator<VoiceAgentRealtimeEvent, any, any>

継承 非同期イテラブル。[非同期イテレーター]