@equos/node-sdk 3.1.1-rc.1 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -40
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -2,13 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
[Equos.ai](https://www.equos.ai) official Node.js SDK - Build AI-powered avatars with lifelike faces, voices, and brains.
|
|
4
4
|
|
|
5
|
+
## Equos SDKs
|
|
6
|
+
|
|
7
|
+
| SDK | Platform | Package |
|
|
8
|
+
|-----|----------|---------|
|
|
9
|
+
| **@equos/browser-sdk** | Browser (vanilla JS/TS) | [npm](https://www.npmjs.com/package/@equos/browser-sdk) |
|
|
10
|
+
| **@equos/react** | Browser (React) | [npm](https://www.npmjs.com/package/@equos/react) |
|
|
11
|
+
| **@equos/node-sdk** | Node.js (server-side only) | [npm](https://www.npmjs.com/package/@equos/node-sdk) |
|
|
12
|
+
| **equos** | Python (server-side only) | [PyPI](https://pypi.org/project/equos/) |
|
|
13
|
+
|
|
5
14
|
## Features
|
|
6
15
|
|
|
7
16
|
- ✅ **Full TypeScript Support** - Auto-generated types from OpenAPI specification
|
|
8
17
|
- ✅ **Automatic API Key Management** - API key automatically added to all requests
|
|
9
18
|
- ✅ **Character Management** - Create and manage AI characters with faces, voices, and brains
|
|
10
19
|
- ✅ **Resource Management** - Manage faces, voices, brains, and knowledge bases
|
|
11
|
-
- ✅ **
|
|
20
|
+
- ✅ **Conversations** - Start, stop, list, and fetch live avatar conversations
|
|
21
|
+
- ✅ **Client Tokens** - Mint short-lived tokens for browser and mobile SDKs
|
|
22
|
+
- ✅ **Health & Organization** - Monitor API health and freemium usage
|
|
12
23
|
|
|
13
24
|
## Prerequisites
|
|
14
25
|
|
|
@@ -281,7 +292,120 @@ await client.brains.deleteBrain({
|
|
|
281
292
|
});
|
|
282
293
|
```
|
|
283
294
|
|
|
284
|
-
###
|
|
295
|
+
### Knowledge Bases
|
|
296
|
+
|
|
297
|
+
Knowledge bases let characters ground responses in your own documents.
|
|
298
|
+
|
|
299
|
+
#### Create a Knowledge Base
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
import { CreateKnowledgeBaseRequest } from '@equos/node-sdk';
|
|
303
|
+
|
|
304
|
+
const kbData: CreateKnowledgeBaseRequest = {
|
|
305
|
+
name: 'Product Docs',
|
|
306
|
+
client: 'my-app', // Optional
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
const kb = await client.knowledgeBases.createKnowledgeBase({
|
|
310
|
+
createKnowledgeBaseRequest: kbData,
|
|
311
|
+
});
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
#### List Knowledge Bases
|
|
315
|
+
|
|
316
|
+
```typescript
|
|
317
|
+
const kbs = await client.knowledgeBases.listKnowledgeBases({
|
|
318
|
+
take: 10,
|
|
319
|
+
skip: 0,
|
|
320
|
+
});
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### Add and Index a Document
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
const doc = await client.knowledgeBases.addDocument({
|
|
327
|
+
id: 'kb-id',
|
|
328
|
+
createDocumentRequest: {
|
|
329
|
+
name: 'pricing.pdf',
|
|
330
|
+
url: 'https://example.com/pricing.pdf',
|
|
331
|
+
},
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
await client.knowledgeBases.indexDocument({
|
|
335
|
+
id: 'kb-id',
|
|
336
|
+
doc: doc.id,
|
|
337
|
+
});
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
#### Delete a Document or Knowledge Base
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
await client.knowledgeBases.deleteDocument({ id: 'kb-id', doc: 'doc-id' });
|
|
344
|
+
await client.knowledgeBases.deleteKnowledgeBase({ id: 'kb-id' });
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Conversations
|
|
348
|
+
|
|
349
|
+
Conversations are live sessions between a user and a character.
|
|
350
|
+
|
|
351
|
+
#### Start a Conversation
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
import { CreateEquosConversationRequest } from '@equos/node-sdk';
|
|
355
|
+
|
|
356
|
+
const conversationData: CreateEquosConversationRequest = {
|
|
357
|
+
name: 'Support chat',
|
|
358
|
+
characterId: 'character-id',
|
|
359
|
+
maxSeconds: 600, // Optional: cap the session duration
|
|
360
|
+
promptCtx: 'Customer is on the Enterprise plan.', // Optional
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
const conversation = await client.conversations.startConversation({
|
|
364
|
+
createEquosConversationRequest: conversationData,
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
console.log('Room:', conversation.room);
|
|
368
|
+
console.log('Token:', conversation.token);
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
#### List and Fetch Conversations
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
const conversations = await client.conversations.listConversations({
|
|
375
|
+
take: 10,
|
|
376
|
+
skip: 0,
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
const conversation = await client.conversations.getConversationById({
|
|
380
|
+
id: 'conversation-id',
|
|
381
|
+
});
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
#### Stop a Conversation
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
await client.conversations.stopConversation({
|
|
388
|
+
id: 'conversation-id',
|
|
389
|
+
});
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Client Tokens
|
|
393
|
+
|
|
394
|
+
Generate short-lived tokens so a browser or mobile client can connect to a character without exposing your API key.
|
|
395
|
+
|
|
396
|
+
```typescript
|
|
397
|
+
const token = await client.tokens.createToken({
|
|
398
|
+
createEquosTokenRequest: {
|
|
399
|
+
user: 'user-123',
|
|
400
|
+
character: 'character-id', // Optional
|
|
401
|
+
client: 'my-app', // Optional
|
|
402
|
+
},
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
// Hand `token` to your frontend (@equos/browser-sdk or @equos/react)
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Health & Organization
|
|
285
409
|
|
|
286
410
|
#### Check API Health
|
|
287
411
|
|
|
@@ -291,19 +415,11 @@ console.log('Status:', health.status);
|
|
|
291
415
|
console.log('Version:', health.version);
|
|
292
416
|
```
|
|
293
417
|
|
|
294
|
-
#### Get
|
|
418
|
+
#### Get Freemium Usage
|
|
295
419
|
|
|
296
420
|
```typescript
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
if (limits) {
|
|
300
|
-
console.log('Concurrent sessions:', limits.concurrent);
|
|
301
|
-
console.log('Max duration:', limits.duration);
|
|
302
|
-
console.log('Suspended:', limits.suspended);
|
|
303
|
-
if (limits.reason) {
|
|
304
|
-
console.log('Reason:', limits.reason);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
421
|
+
const used = await client.organizations.getFreemiumUsage();
|
|
422
|
+
console.log('Freemium seconds used:', used);
|
|
307
423
|
```
|
|
308
424
|
|
|
309
425
|
## Complete Example
|
|
@@ -378,7 +494,7 @@ try {
|
|
|
378
494
|
|
|
379
495
|
## TypeScript Support
|
|
380
496
|
|
|
381
|
-
|
|
497
|
+
Request and response types ship with the package:
|
|
382
498
|
|
|
383
499
|
```typescript
|
|
384
500
|
import {
|
|
@@ -393,36 +509,16 @@ import {
|
|
|
393
509
|
} from '@equos/node-sdk';
|
|
394
510
|
```
|
|
395
511
|
|
|
396
|
-
##
|
|
512
|
+
## Reach Us
|
|
397
513
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
> - **Avatars API** (`client.avatars.*`) - Use Characters API instead
|
|
401
|
-
> - **Agents API** (`client.agents.*`) - Use Brains API instead
|
|
402
|
-
> - **Sessions API** (`client.sessions.*`) - Deprecated
|
|
403
|
-
> - **Session Passes API** (`client.sessionPasses.*`) - Deprecated
|
|
404
|
-
>
|
|
405
|
-
> These APIs are marked as `deprecated: true` in the OpenAPI specification.
|
|
406
|
-
|
|
407
|
-
## Regenerating the Client
|
|
408
|
-
|
|
409
|
-
The SDK is auto-generated from the OpenAPI specification. To regenerate after API changes:
|
|
410
|
-
|
|
411
|
-
1. Ensure your backend API is running on `http://localhost:3001`
|
|
412
|
-
2. Run:
|
|
413
|
-
|
|
414
|
-
```bash
|
|
415
|
-
npm run generate
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
This fetches the latest OpenAPI spec and regenerates all TypeScript code.
|
|
514
|
+
- Equos Slack Community: [Join Equos Community Slack](https://join.slack.com/t/equosaicommunity/shared_invite/zt-3d8oy19au-jZpsJB0i~gdL0jbDswdzzQ)
|
|
515
|
+
- Support: [Support Form](https://docs.google.com/forms/d/e/1FAIpQLSdoK7LvORdQf7KOQKvhhlESStJcKc3bDB9HPsEet6LuOmVUfQ/viewform)
|
|
419
516
|
|
|
420
|
-
##
|
|
517
|
+
## Documentation
|
|
421
518
|
|
|
422
519
|
- Official Documentation: [https://docs.equos.ai](https://docs.equos.ai)
|
|
423
|
-
- Equos NodeJS Examples: [
|
|
424
|
-
- Equos
|
|
425
|
-
- Support: [Support Form](https://docs.google.com/forms/d/e/1FAIpQLSdoK7LvORdQf7KOQKvhhlESStJcKc3bDB9HPsEet6LuOmVUfQ/viewform)
|
|
520
|
+
- Equos NodeJS Examples: [https://github.com/EquosAI/equos-examples/tree/main/examples/equos-nextjs-integration](https://github.com/EquosAI/equos-examples/tree/main/examples/equos-nextjs-integration)
|
|
521
|
+
- Equos React Examples: [https://github.com/EquosAI/equos-examples/blob/main/examples/equos-react-integration/README.md](https://github.com/EquosAI/equos-examples/blob/main/examples/equos-react-integration/README.md)
|
|
426
522
|
|
|
427
523
|
## License
|
|
428
524
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equos/node-sdk",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"description": "Equos.ai node.js official SDK.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -9,14 +9,15 @@
|
|
|
9
9
|
"sdk",
|
|
10
10
|
"equos.ai",
|
|
11
11
|
"equos",
|
|
12
|
-
"
|
|
13
|
-
"elevenlabs",
|
|
12
|
+
"live",
|
|
14
13
|
"realtime",
|
|
15
14
|
"agent",
|
|
15
|
+
"avatar",
|
|
16
16
|
"webrtc",
|
|
17
17
|
"browser",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"gemini",
|
|
19
|
+
"conversation",
|
|
20
|
+
"conversational-ai"
|
|
20
21
|
],
|
|
21
22
|
"homepage": "https://github.com/EquosAI/equos-node-sdk#readme",
|
|
22
23
|
"bugs": {
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"prepare": "npm run build"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
|
-
"@equos/core": "^3.1.1
|
|
46
|
+
"@equos/core": "^3.1.1",
|
|
46
47
|
"axios": "^1.11.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|