JSPM

  • Created
  • Published
  • Downloads 94
  • Score
    100M100P100Q89115F
  • License ISC

Equos.ai node.js official SDK.

Package Exports

  • @equos/node-sdk
  • @equos/node-sdk/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@equos/node-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@equos/node-sdk

Equos.ai official node js SDK.

Prerequisites

  • Go to Equos Studio.
  • Create an organization.
  • Create an API Key.

Installation

npm install @equos/node-sdk

Usage

Setup Equos Client

import { Equos } from '@equos/node-sdk';

const  client = Equos.client(process.env.EQUOS_API_KEY!);

You don't have an api key ? Create one here

Create Avatar

import { EquosAvatar, CreateEquosAvatarRequest } from '@equos/node-sdk';


const data: CreateEquosAvatarRequest = {
  identity: "equos-avatar-jeremy",
  name: "Jeremy"
  refImage: "<base64 data url of the reference image>" // 5Mo max.
}

// Create an avatar.
const avatar: EquosAvatar = await client.avatars.create(data);

console.log(avatar);

Create Agent

import { 
    EquosAgent, 
    CreateEquosAgentRequest, 
    AgentProvider, 
    OpenaiRealtimeVoices, 
    OpenaiRealtimeModels 
} from '@equos/node-sdk';


const data: CreateEquosAgentRequest = {
  name: "My Agent",
  provider: AgentProvider.openai,
  config: {
    instructions: "You are a Korean teacher...",
    voice: OpenaiRealtimeVoices.ash,
    model: OpenaiRealtimeModels.gpt_realtime
  }
}

const agent: EquosAgent = await client.agents.create(data);
console.log(agent);

Start a Session

This will create and start a session. The avatar will join the room as soon as possible.

const sessionOptions: CreateEquosSessionRequest = {
    name: 'Equos Session',
    agent: {
        id: "<your agent id>"
    }, // agent accepts either an object with id of existing agent, or CreateEquosAgent object.
    avatar: {
        id: "<your avatar id>"
    }, // avatar accepts either an object with id of existing avatar, or CreateEquosAvatar object.
    consumerIdentity: {
        identity: 'client-identity',
        name: 'Client Name'
    }
}

const result = await client.sessions.create(sessionOptions);

console.log(result.session);
console.log(result.consumerAccessToken);

Stop a Session

const session = await client.sessions.stop("<session id>");

Reach Us

Documentation