RealtimeAPIClient
Methods
addEventListener
addEventListener(event: | , callback: Function
): void
Adds a handler for the specified Yandex.RealtimeAPIEvents or Yandex.Events event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.
Parameters
event:
Event class (i.e., Yandex.RealtimeAPIEvents.InputAudioBufferCommitted)
callback:
Function
Handler function. A single parameter is passed - object with event information
Returns
type:
void
clearMediaBuffer
clearMediaBuffer(parameters: ): void
Clears the Yandex WebSocket media buffer.
Parameters
parameters:
OptionalOptional. Media buffer clearing parameters
Returns
type:
void
close
close(): void
Closes the Yandex connection (over WebSocket) or connection attempt.
Returns
type:
void
conversationItemCreate
conversationItemCreate(parameters: Object
): void
Add a new Item to the Conversation's context.
Parameters
parameters:
Object
Returns
type:
void
conversationItemDelete
conversationItemDelete(parameters: Object
): void
Send this event when you want to remove any item from the conversation history.
Parameters
parameters:
Object
Returns
type:
void
conversationItemRetrieve
conversationItemRetrieve(parameters: Object
): void
Send this event when you want to retrieve the server's representation of a specific item in the conversation history.
Parameters
parameters:
Object
Returns
type:
void
conversationItemTruncate
conversationItemTruncate(parameters: Object
): void
Send this event to truncate a previous assistant message’s audio.
Parameters
parameters:
Object
Returns
type:
void
id
id(): string
Returns the RealtimeAPIClient id.
Returns
type:
string
removeEventListener
removeEventListener(event: | , callback: Function
): void
Removes a handler for the specified Yandex.RealtimeAPIEvents or Yandex.Events event.
Parameters
event:
Event class (i.e., Yandex.RealtimeAPIEvents.InputAudioBufferCommitted)
callback:
Function
OptionalOptional. Handler function. If not specified, all handler functions are removed
Returns
type:
void
responseCancel
responseCancel(parameters: Object
): void
Send this event to cancel an in-progress response.
Parameters
parameters:
Object
Returns
type:
void
responseCreate
responseCreate(parameters: Object
): void
This event instructs the server to create a Response, which means triggering model inference.
Parameters
parameters:
Object
Returns
type:
void
sendMediaTo
sendMediaTo(mediaUnit: , parameters: ): void
Starts sending media from the Yandex (via WebSocket) to the media unit. Yandex works in real time.
Parameters
mediaUnit:
Media unit that receives media
parameters:
OptionalOptional interaction parameters
Returns
type:
void
sessionUpdate
sessionUpdate(parameters: Object
): void
Send this event to update the session’s configuration.
Parameters
parameters:
Object
Returns
type:
void
stopMediaTo
stopMediaTo(mediaUnit: ): void
Stops sending media from the Yandex (via WebSocket) to the media unit.
Parameters
mediaUnit:
Media unit that stops receiving media
Returns
type:
void
webSocketId
webSocketId(): string
Returns the Yandex WebSocket id.
Returns
type:
string