Rate this page:

VoiceAgentClient

Methods

addEventListener

Copy URL
addEventListener(event: 

Events

|

VoiceAgentEvents

,
callback:

Function

):

void

Adds a handler for the specified Deepgram.VoiceAgentEvents or Deepgram.Events event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.

Parameters

Returns

  • type:

    void

clearMediaBuffer

Copy URL
clearMediaBuffer(parameters: 

ClearMediaBufferParameters

):

void

Clears the VoiceAgent WebSocket media buffer.

Parameters

Returns

  • type:

    void

close

Copy URL
close(): 

void

Closes the VoiceAgent connection (over WebSocket) or connection attempt.

Returns

  • type:

    void

id

Copy URL
id(): 

string

Returns the VoiceAgentClient id.

Returns

  • type:

    string

removeEventListener

Copy URL
removeEventListener(event: 

Events

|

VoiceAgentEvents

,
callback:

Function

):

void

Removes a handler for the specified Deepgram.VoiceAgentEvents or Deepgram.Events event.

Parameters

Returns

  • type:

    void

sendFunctionCallResponse

Copy URL
sendFunctionCallResponse(input: 

Object

):

void

Send a message to provide a function call response in the middle of a conversation. https://developers.deepgram.com/reference/voice-agent/voice-agent#send.AgentV1SendFunctionCallResponse

Parameters

  • input:

    Object

Returns

  • type:

    void

sendInjectAgentMessage

Copy URL
sendInjectAgentMessage(input: 

Object

):

void

Parameters

  • input:

    Object

Returns

  • type:

    void

sendInjectUserMessage

Copy URL
sendInjectUserMessage(input: 

Object

):

void

Parameters

  • input:

    Object

Returns

  • type:

    void

sendMediaTo

Copy URL
sendMediaTo(mediaUnit: 

VoxMediaUnit

,
parameters:

SendMediaParameters

):

void

Starts sending media from the VoiceAgent (via WebSocket) to the media unit. VoiceAgent works in real time.

Parameters

Returns

  • type:

    void

sendUpdatePrompt

Copy URL
sendUpdatePrompt(input: 

Object

):

void

Parameters

  • input:

    Object

Returns

  • type:

    void

sendUpdateSpeak

Copy URL
sendUpdateSpeak(input: 

Object

):

void

Send a message to change the Speak model in the middle of a conversation. https://developers.deepgram.com/reference/voice-agent/voice-agent#send.AgentV1UpdateSpeak

Parameters

  • input:

    Object

Returns

  • type:

    void

stopMediaTo

Copy URL
stopMediaTo(mediaUnit: 

VoxMediaUnit

):

void

Stops sending media from the VoiceAgent (via WebSocket) to the media unit.

Parameters

Returns

  • type:

    void

webSocketId

Copy URL
webSocketId(): 

string

Returns the VoiceAgent WebSocket id.

Returns

  • type:

    string