VoiceAgentConnection interface
リアルタイムのボイスセッション。
サーバーイベントを1回の for await ループで読み取ります。 2つ目のイテレーターが投げる。
ループを離れると接続が閉じます。 認識されていないイベントタイプは VoiceAgentUnknownEvent として届きます。不正なイベントはプロトコルエラーで失敗します。
- Extends
-
AsyncIterable<VoiceAgentRealtimeEvent>
メソッド
| cancel |
進行中の応答をキャンセルします。 |
| clear |
バッファされた入力音声をクリアします。 |
| clear |
サービスで未処理の音声をクリアします。 |
| close(number, string) | WebSocket接続を優雅に閉じます。 |
| commit |
コミットはバッファ化された入力音声です。 |
| configure |
サポートされるリアルタイムセッション設定を更新しました。 |
| dispose() | つながりを解放します。 閉じる()に相当します。 |
| request |
新しい返答を求める。 |
| send |
生のオーディオバイトを入力バッファに送信します。 SDKは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)
生のオーディオバイトを入力バッファに送信します。 SDKは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>
受け継いだ 非同期イテラブル。[非同期イテレーター]