Java Script SDK
Every option, method and property of @nuancelabs/js-sdk, read from the published package.
@nuancelabs/js-sdk runs a conversation in a web page. JavaScript SDK shows how to use it; this page lists its API. It is read from the package's own types, so it matches the version on npm.
import { createNuanceConversation } from "@nuancelabs/js-sdk";
import { useNuanceConversation } from "@nuancelabs/js-sdk/react";createNuanceConversation(options)
Returns a Conversation, idle until you call connect().
Prop
Type
MediaDevicePreferences
What mediaDevices takes.
Prop
Type
Conversation
Prop
Type
state is idle, connecting, queued (waiting out a busy service before it tries again), connected, disconnected or failed. Follow the conversation lists the events onChange reports, and Events you get the Nuance Live events onInterfaceEvent hands you.
ToolCall
What onToolCall hands you: one call of one of your tools. Tools and appends shows the round trip.
Prop
Type
sendToolResult takes a string, an object (sent as JSON text) or parts: { type: "input_text", text } and up to 4 { type: "input_image", image_url }, each a base64 data: URL of a JPEG or PNG.
AppendOptions
What append takes after its kind and content.
Prop
Type
AvatarParticipant
conversation.avatar, the AI persona in the call, once connected.
Prop
Type
UserParticipant
conversation.user, once connected.
Prop
Type
VideoTrack and AudioTrack
Prop
Type
Prop
Type
Errors
connect() rejects with one of these when the conversation can't start. Test with instanceof, and act on the fields, never on message.
ApiError
Prop
Type
MediaAccessError
Prop
Type
PolicyCurfewError
Prop
Type
MaintenanceError carries only a message, written to show the person.
useNuanceConversation(options)
From @nuancelabs/js-sdk/react. Takes the same options as createNuanceConversation, and returns:
Prop
Type
Session token types
The SDK also exports the shapes your server sends to and gets from POST /session-tokens, for a TypeScript server.
Prop
Type
Prop
Type