VoiceAgentConnection interface

실시간 음성 세션.

한 번 for await 의 루프로 서버 이벤트를 읽으세요. 두 번째 반복자가 던진다. 루프를 벗어나면 연결이 끊깁니다. 인식되지 않은 이벤트 유형은 VoiceAgentUnknownEvent로 나타납니다; 잘못된 형식의 이벤트는 프로토콜 오류로 실패합니다.

Extends

AsyncIterable<VoiceAgentRealtimeEvent>

속성

closed

연결이 종료되면 해결됩니다.

state

현재 연결 상태.

메서드

cancelResponse(VoiceAgentCancelResponseOptions)

진행 중인 응답을 취소합니다.

clearInputAudio(VoiceAgentEventOptions)

버퍼된 입력 오디오를 지우는 기능입니다.

clearOutputAudio(VoiceAgentEventOptions)

예배 중 대기 중인 출력 오디오를 지우는 기능입니다.

close(number, string)

우아하게 WebSocket 연결을 닫습니다.

commitAudio(VoiceAgentEventOptions)

버퍼드 입력 오디오를 커밋합니다.

configureSession(VoiceAgentSessionUpdateConfig, VoiceAgentSessionUpdateOptions)

지원되는 실시간 세션 설정 업데이트.

dispose()

연결이 해제됩니다. close()와 동등합니다.

requestResponse(VoiceAgentResponseOptions)

새로운 답변을 요청합니다.

sendAudio(ArrayBuffer | Uint8Array, VoiceAgentEventOptions)

원시 오디오 바이트를 입력 버퍼로 보냅니다. SDK는 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()

연결이 해제됩니다. close()와 동등합니다.

function dispose(): Promise<void>

반품

Promise<void>

requestResponse(VoiceAgentResponseOptions)

새로운 답변을 요청합니다.

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

매개 변수

반품

Promise<void>

sendAudio(ArrayBuffer | Uint8Array, VoiceAgentEventOptions)

원시 오디오 바이트를 입력 버퍼로 보냅니다. SDK는 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>

상속됨 비동기 이변 가능. [비동기 이변기]