VoiceAgentLiveConnection interface
GPT Live 음성 세션.
하나의 for await 루프로 이벤트를 읽거나 , , off, once 리스너를 사용on하세요.
루프를 떠나면 세션이 종료됩니다. 수신된 오디오 청크는 base64 문자열입니다.
- Extends
-
AsyncIterable<VoiceAgentLiveEvent>
속성
| closed | 연결이 종료될 때 해결되며, 서비스 확인 및 오류 세부 정보가 있는 경우 표시됩니다. |
| session | 최신 세션 설정. connect()가 돌아오는 즉시 사용 가능합니다. |
| session |
서비스가 제공할 때 지속된 대화 ID를 포함한 원래 시작 이벤트. |
| state | 현재 연결 상태. |
메서드
상속된 메서드
| [async |
속성 세부 정보
closed
연결이 종료될 때 해결되며, 서비스 확인 및 오류 세부 정보가 있는 경우 표시됩니다.
closed: Promise<VoiceAgentLiveCloseResult>
속성 값
Promise<VoiceAgentLiveCloseResult>
session
최신 세션 설정. connect()가 돌아오는 즉시 사용 가능합니다.
session: VoiceAgentLiveSessionResource
속성 값
sessionStarted
서비스가 제공할 때 지속된 대화 ID를 포함한 원래 시작 이벤트.
sessionStarted: LiveServerEventLiveSessionStarted
속성 값
state
메서드 세부 정보
appendCommentary(string, VoiceAgentLiveAppendOptions)
모델이 사용자에게 말할 텍스트를 추가합니다. 이것은 사용자 메시지가 아니라 맥락입니다.
function appendCommentary(content: string, options?: VoiceAgentLiveAppendOptions): Promise<void>
매개 변수
- content
-
string
- options
- VoiceAgentLiveAppendOptions
반품
Promise<void>
appendInstructions(string, VoiceAgentLiveAppendOptions)
사용자 메시지가 아닌 세션에 지침을 추가합니다.
function appendInstructions(content: string, options?: VoiceAgentLiveAppendOptions): Promise<void>
매개 변수
- content
-
string
- options
- VoiceAgentLiveAppendOptions
반품
Promise<void>
appendThinking(string, VoiceAgentLiveAppendOptions)
모델에게 말을 요구하지 않고도 배경 맥락을 추가합니다. 비밀을 숨기는 데 사용하지 마세요.
function appendThinking(content: string, options?: VoiceAgentLiveAppendOptions): Promise<void>
매개 변수
- content
-
string
- options
- VoiceAgentLiveAppendOptions
반품
Promise<void>
close(number, string)
세션을 종료하고 서비스 확인을 기다립니다. 연결 실패 또는 최종 확정이 확인되지 않은 경우 거부하며, 소켓이 이미 닫혔을 때도 포함됩니다.
function close(code?: number, reason?: string): Promise<void>
매개 변수
- code
-
number
- reason
-
string
반품
Promise<void>
configureSession(LiveSessionUpdateParams, VoiceAgentEventOptions)
위임 백엔드 설정과 전사본 트리거를 업데이트합니다. 오디오 형식, 모델 및 위임 소유자는 변경할 수 없습니다.
function configureSession(session: LiveSessionUpdateParams, options?: VoiceAgentEventOptions): Promise<void>
매개 변수
- session
- LiveSessionUpdateParams
- options
- VoiceAgentEventOptions
반품
Promise<void>
dispose()
세션을 닫습니다. close()와 동등합니다.
function dispose(): Promise<void>
반품
Promise<void>
muteInputAudio(VoiceAgentEventOptions)
모델이 입력 오디오를 처리하지 못하게 합니다. Live에는 커밋이나 클리어가 필요한 입력 버퍼가 없습니다.
function muteInputAudio(options?: VoiceAgentEventOptions): Promise<void>
매개 변수
- options
- VoiceAgentEventOptions
반품
Promise<void>
off<K>(K, VoiceAgentLiveEventHandler<K>)
이전에 등록된 리스너를 제거합니다.
function off<K>(type: K, handler: VoiceAgentLiveEventHandler<K>): this
매개 변수
- type
-
K
- handler
반품
this
on<K>(K, VoiceAgentLiveEventHandler<K>)
후속 이벤트를 위한 리스너를 추가합니다. 시작 이벤트에는 connect 옵션 onEvent를 사용하거나, 시작 메타데이터는 sessionStarted를 읽으십시오.
function on<K>(type: K, handler: VoiceAgentLiveEventHandler<K>): this
매개 변수
- type
-
K
- handler
반품
this
once<K>(K, VoiceAgentLiveEventHandler<K>)
한 번만 실행되는 리스너를 추가합니다.
function once<K>(type: K, handler: VoiceAgentLiveEventHandler<K>): this
매개 변수
- type
-
K
- handler
반품
this
requestResponse(VoiceAgentEventOptions)
응답 백엔드에 응답을 요청합니다. 응답 위임이 필요합니다.
function requestResponse(options?: VoiceAgentEventOptions): Promise<void>
매개 변수
- options
- VoiceAgentEventOptions
반품
Promise<void>
send(VoiceAgentLiveClientEvent, VoiceAgentSendOptions)
라이브 명령을 보냅니다. session.start를 보내지 마세요; 서비스가 세션을 시작합니다.
function send(event: VoiceAgentLiveClientEvent, options?: VoiceAgentSendOptions): Promise<void>
매개 변수
- options
- VoiceAgentSendOptions
반품
Promise<void>
sendAudio(ArrayBuffer | Uint8Array, VoiceAgentEventOptions)
WAV나 기타 파일 헤더 없이 구성된 입력 형식의 원시 오디오를 전송합니다.
function sendAudio(audio: ArrayBuffer | Uint8Array, options?: VoiceAgentEventOptions): Promise<void>
매개 변수
- audio
-
ArrayBuffer | Uint8Array
- options
- VoiceAgentEventOptions
반품
Promise<void>
sendEvent(VoiceAgentLiveClientEvent, VoiceAgentSendOptions)
send().
function sendEvent(event: VoiceAgentLiveClientEvent, options?: VoiceAgentSendOptions): Promise<void>
매개 변수
- options
- VoiceAgentSendOptions
반품
Promise<void>
sendResponseItem(Record<string, unknown>, VoiceAgentEventOptions)
세션에서 응답 위임을 사용할 때 대화 항목을 추가합니다.
function sendResponseItem(item: Record<string, unknown>, options?: VoiceAgentEventOptions): Promise<void>
매개 변수
- item
-
Record<string, unknown>
- options
- VoiceAgentEventOptions
반품
Promise<void>
sendToolOutput(string, string, VoiceAgentSendToolOutputOptions)
함수 결과를 Responses 백엔드로 보내고 기본적으로 후속 응답을 요청합니다.
function sendToolOutput(callId: string, output: string, options?: VoiceAgentSendToolOutputOptions): Promise<void>
매개 변수
- callId
-
string
- output
-
string
- options
- VoiceAgentSendToolOutputOptions
반품
Promise<void>
unmuteInputAudio(VoiceAgentEventOptions)
오디오 입력을 재개합니다.
function unmuteInputAudio(options?: VoiceAgentEventOptions): Promise<void>
매개 변수
- options
- VoiceAgentEventOptions
반품
Promise<void>
상속된 메서드 세부 정보
[asyncIterator]()
function [asyncIterator](): AsyncIterator<VoiceAgentLiveEvent, any, any>
반품
AsyncIterator<VoiceAgentLiveEvent, any, any>
상속됨 비동기 이변 가능. [비동기 이변기]