0.3.2 • Published 9 months ago

ultravox-client v0.3.2

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

Ultravox Client SDK (JavaScript)

This is the web client library for Ultravox.

Written in TypeScript, this library allows you to easily integrate Ultravox's real-time, speech-to-speech AI into web applications.

Quick Start

import { UltravoxSession } from 'ultravox-client';

const session = new UltravoxSession();
session.joinCall('wss://your-call-join-url');

session.leaveCall();

Note: Join URL's are created using the Ultravox API. See the docs for more info.

Events

If we continue with the quick start code above, we can add event listeners for two events:

session.addEventListener('status', (event) => {
  console.log('Session status changed: ', session.status);
});

session.addEventListener('transcripts', (event) => {
  console.log('Transcripts updated: ', session.transcripts);
});

Session Status

The session status is based on the UltravoxSessionStatus enum and can be one of the following:

statedescription
disconnectedThe session is not connected and not attempting to connect. This is the initial state.
disconnectingThe client is disconnecting from the session.
connectingThe client is attempting to connect to the session.
idleThe client is connected to the session and the server is warming up.
listeningThe client is connected and the server is listening for voice input.
thinkingThe client is connected and the server is considering its response. The user can still interrupt.
speakingThe client is connected and the server is playing response audio. The user can interrupt as needed.

Transcripts

Transcripts are an array of transcript objects. Each transcript has the following properties:

propertytypedefinition
textstringText transcript of the speech from the end user or the agent.
isFinalbooleanTrue if the transcript represents a complete utterance. False if it is a fragment of an utterance that is still underway.
speakerRoleEither "user" or "agent". Denotes who was speaking.
mediumMediumEither "voice" or "text". Denotes how the message was sent.
0.2.18

10 months ago

0.2.17

10 months ago

0.2.16

10 months ago

0.2.15

10 months ago

0.2.14

11 months ago

0.2.13

11 months ago

0.2.12

11 months ago

0.3.0

9 months ago

0.3.2

9 months ago

0.3.1

9 months ago

0.2.11

11 months ago

0.2.10

11 months ago

0.2.9

11 months ago

0.2.8

11 months ago

0.2.7

11 months ago

0.2.6

11 months ago

0.2.5

11 months ago

0.2.4

11 months ago

0.2.2

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago