VoiceAgentAPIClient
Methods
addEventListener
Adds a handler for the specified QwenCloud.VoiceAgentAPIEvents or QwenCloud.Events event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.
Parameters
clearMediaBuffer
Clears the Qwen Cloud WebSocket media buffer.
Parameters
close
Closes the Qwen Cloud connection (over WebSocket) or connection attempt.
conversationItemCreate
Inserts a conversation item (message, function_call, or function_call_output). https://docs.qwencloud.com/api-reference/qwen-audio-realtime/client-events#conversation-item-create
Parameters
conversationItemDelete
Deletes a conversation item. https://docs.qwencloud.com/api-reference/qwen-audio-realtime/client-events#conversation-item-delete
Parameters
conversationItemRetrieve
Retrieves a conversation item. Audio content is returned as a transcript. https://docs.qwencloud.com/api-reference/qwen-audio-realtime/client-events#conversation-item-retrieve
Parameters
id
Returns the VoiceAgentAPIClient id.
inputAudioBufferClear
Clears uncommitted input audio. Push-to-talk mode only. https://docs.qwencloud.com/api-reference/qwen-audio-realtime/client-events#input-audio-buffer-clear
Parameters
inputAudioBufferCommit
Commits the input audio buffer. Push-to-talk mode only. Does not start a response; call QwenCloud.VoiceAgentAPIClient.responseCreate after this. https://docs.qwencloud.com/api-reference/qwen-audio-realtime/client-events#input-audio-buffer-commit
Parameters
removeEventListener
Removes a handler for the specified QwenCloud.VoiceAgentAPIEvents or QwenCloud.Events event.
Parameters
responseCancel
Cancels the response currently being generated. https://docs.qwencloud.com/api-reference/qwen-audio-realtime/client-events#response-cancel
Parameters
responseCreate
Starts a response. Required in push-to-talk mode and after a function_call_output. Optional overrides: response.modalities, response.voice. https://docs.qwencloud.com/api-reference/qwen-audio-realtime/client-events#response-create
Parameters
sendMediaTo
Starts sending media from Qwen Cloud (via WebSocket) to the media unit. Qwen Cloud works in real time.
Parameters
sessionUpdate
Updates the session configuration. Send this before the first audio frame. turn_detection: null selects push-to-talk. https://docs.qwencloud.com/api-reference/qwen-audio-realtime/client-events#session-update
Parameters
stopMediaTo
Stops sending media from Qwen Cloud (via WebSocket) to the media unit.
Parameters
webSocketId
Returns the Qwen Cloud WebSocket id.