@voxta/voxta-client
v1.1.4
Published
This library allows you to connect to a [Voxta Server](https://doc.voxta.ai/).
Readme
Voxta: voxta-client
This library allows you to connect to a Voxta Server.
This library is early beta and subject to change.
Example usage
import { VoxtaWebSocketClient } from '@voxta/voxta-client';
// Connect to your Voxta Server instance
// This does not currently support API Key authentication.
const voxtaClient = new VoxtaWebSocketClient('ws://127.0.0.1:5384/hub');
await this.voxtaClient.connect({
$type: 'authenticate',
client: 'MyAppName',
clientVersion: '1.0.0',
// This can be role:provider or role:app, depending whether you want to augment existing chats or write a client
scope: 'role:provider',
capabilities: {
// WebSocketStream requires to implement audio streaming, otherwise None to rely on server recording
audioInput: 'None',
// Url requires you to download and playback audio from replyChunk messages, otherwise None to rely on server playback
audioOutput: 'None',
// Only required when doing the audio playback. Add audio/pcm to allow raw PCM streaming
acceptedAudioContentTypes: ['audio/wav', 'audio/mpeg', 'audio/webm'],
// PostImage requires you to implement vision requests support, otherwise None to rely on the server
visionCapture: 'None',
// When implementing visionCapture, the kind of captures the client can do
visionSources: ['Screen', 'Eyes', 'Attachment'],
},
});
// wait for welcome...
var welcome = await new Promise(resolve => {
voxtaClient.addEventListener('welcome', (e) => {
resolve(e.detail);
});
});
console.log(`Logged in as ${welcome.user.name}`)
// listen to events
voxtaClient.addEventListener('replyChunk', (e) => {
console.log(`Received text: ${e.detail.text}`);
});
// send messages
await this.voxtaClient.send({
$type: 'send',
sessionId: sessionId,
"Hello!",
});