@rapidaai/nodejs 1.0.17 → 1.0.19
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 +201 -1
- package/dist/index.d.mts +2953 -2015
- package/dist/index.d.ts +2953 -2015
- package/dist/index.js +22595 -18908
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22595 -18900
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1 +1,201 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Rapida Node.js SDK
|
|
2
|
+
|
|
3
|
+
The official Node.js SDK for the Rapida Voice AI platform. This SDK provides comprehensive API clients for building voice-enabled applications with Rapida's microservices.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @rapidaai/nodejs
|
|
9
|
+
# or
|
|
10
|
+
yarn add @rapidaai/nodejs
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @rapidaai/nodejs
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import {
|
|
19
|
+
ConnectionConfig,
|
|
20
|
+
GetAssistant,
|
|
21
|
+
GetAssistantRequest
|
|
22
|
+
} from '@rapidaai/nodejs';
|
|
23
|
+
|
|
24
|
+
// Create a connection to Rapida services
|
|
25
|
+
const config = new ConnectionConfig({
|
|
26
|
+
assistantHost: 'localhost:9007',
|
|
27
|
+
integrationHost: 'localhost:9004',
|
|
28
|
+
endpointHost: 'localhost:9005',
|
|
29
|
+
documentHost: 'localhost:9010',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Use the assistant service
|
|
33
|
+
const request = new GetAssistantRequest();
|
|
34
|
+
request.setId('your-assistant-id');
|
|
35
|
+
|
|
36
|
+
const response = await GetAssistant(config, request);
|
|
37
|
+
console.log(response);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Available Clients
|
|
41
|
+
|
|
42
|
+
The SDK provides clients for the following Rapida services:
|
|
43
|
+
|
|
44
|
+
### Core Services
|
|
45
|
+
|
|
46
|
+
- **Assistant API** - Manage assistants, conversations, and voice deployments
|
|
47
|
+
- **Integration API** - LLM provider integrations (OpenAI, Anthropic, Gemini, etc.)
|
|
48
|
+
- **Endpoint API** - Endpoint management and invocation
|
|
49
|
+
- **Knowledge API** - Knowledge base and document management
|
|
50
|
+
- **Deployment API** - Assistant deployment configuration
|
|
51
|
+
- **Document API** - Document processing and indexing
|
|
52
|
+
|
|
53
|
+
### Auth & Account Services
|
|
54
|
+
|
|
55
|
+
- **Web API** - Authentication, users, organizations, projects, vaults
|
|
56
|
+
- **Auth Client** - User authentication flows (OAuth, email/password)
|
|
57
|
+
- **Connect Client** - OAuth provider connections
|
|
58
|
+
|
|
59
|
+
### Utility Services
|
|
60
|
+
|
|
61
|
+
- **Talk Client** - Telephony and real-time communication
|
|
62
|
+
- **WebRTC Client** - WebRTC signaling and media
|
|
63
|
+
- **Notification Client** - Notification management
|
|
64
|
+
- **Invocation Client** - Custom endpoint invocation
|
|
65
|
+
|
|
66
|
+
## API Reference
|
|
67
|
+
|
|
68
|
+
### Connection Configuration
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
const config = new ConnectionConfig({
|
|
72
|
+
// Service endpoints
|
|
73
|
+
assistantHost: 'localhost:9007',
|
|
74
|
+
integrationHost: 'localhost:9004',
|
|
75
|
+
endpointHost: 'localhost:9005',
|
|
76
|
+
documentHost: 'localhost:9010',
|
|
77
|
+
webHost: 'localhost:9001',
|
|
78
|
+
|
|
79
|
+
// Authentication
|
|
80
|
+
auth: {
|
|
81
|
+
principal: 'user-or-service',
|
|
82
|
+
apiKey: 'your-api-key', // optional
|
|
83
|
+
token: 'jwt-token', // optional
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Example: Create an Assistant
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import {
|
|
92
|
+
CreateAssistantRequest,
|
|
93
|
+
CreateAssistant,
|
|
94
|
+
ConnectionConfig,
|
|
95
|
+
} from '@rapidaai/nodejs';
|
|
96
|
+
|
|
97
|
+
const config = new ConnectionConfig({
|
|
98
|
+
assistantHost: 'localhost:9007',
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const request = new CreateAssistantRequest();
|
|
102
|
+
request.setName('My Voice Assistant');
|
|
103
|
+
request.setDescription('A great voice assistant');
|
|
104
|
+
request.setLanguage('en');
|
|
105
|
+
|
|
106
|
+
const response = await CreateAssistant(config, request);
|
|
107
|
+
console.log('Assistant created:', response.getId());
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Example: Retrieve Knowledge Base
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import {
|
|
114
|
+
GetAllKnowledgeRequest,
|
|
115
|
+
GetAllKnowledge,
|
|
116
|
+
ConnectionConfig,
|
|
117
|
+
} from '@rapidaai/nodejs';
|
|
118
|
+
|
|
119
|
+
const config = new ConnectionConfig({
|
|
120
|
+
documentHost: 'localhost:9010',
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const request = new GetAllKnowledgeRequest();
|
|
124
|
+
const response = await GetAllKnowledge(config, request);
|
|
125
|
+
console.log('Knowledge bases:', response.getKnowledgesList());
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Build Output
|
|
129
|
+
|
|
130
|
+
The SDK is built in three formats:
|
|
131
|
+
|
|
132
|
+
- **ESM** - `dist/index.mjs` - For use with `import` statements
|
|
133
|
+
- **CJS** - `dist/index.cjs` - For use with `require()` statements
|
|
134
|
+
- **DTS** - `dist/index.d.ts` / `dist/index.d.mts` - TypeScript type definitions
|
|
135
|
+
|
|
136
|
+
All formats are automatically selected based on your module resolution in `package.json`.
|
|
137
|
+
|
|
138
|
+
## Known Limitations
|
|
139
|
+
|
|
140
|
+
The following features are not yet available in the proto definitions and will return "not implemented" errors:
|
|
141
|
+
|
|
142
|
+
- `GetAllDeployment()` - Marketplace API proto definitions not available
|
|
143
|
+
- `GetAllProvider()`, `GetAllToolProvider()` - Provider API proto definitions not available
|
|
144
|
+
- `CreateToolCredential()` - Tool credential management not yet implemented
|
|
145
|
+
- Content type utilities - Core Content proto type not available in common_pb
|
|
146
|
+
|
|
147
|
+
These will be implemented once the corresponding proto definitions are generated and available.
|
|
148
|
+
|
|
149
|
+
## Development
|
|
150
|
+
|
|
151
|
+
### Building from Source
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npm install
|
|
155
|
+
npm run build
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Running Tests
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
npm test
|
|
162
|
+
npm run test:watch
|
|
163
|
+
npm run test:coverage
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Cleaning Build Output
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
npm run clean
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Architecture
|
|
173
|
+
|
|
174
|
+
The SDK is structured around gRPC services with the following key components:
|
|
175
|
+
|
|
176
|
+
- **Connection Config** - Manages service client connections
|
|
177
|
+
- **Proto Clients** - Auto-generated gRPC service clients
|
|
178
|
+
- **Client Functions** - High-level async functions wrapping gRPC calls
|
|
179
|
+
- **Types** - TypeScript interfaces and proto message types
|
|
180
|
+
|
|
181
|
+
All inter-service communication uses gRPC with multiplexed HTTP/2, gRPC-Web, and HTTP support on single ports per service.
|
|
182
|
+
|
|
183
|
+
## Contributing
|
|
184
|
+
|
|
185
|
+
Contributions are welcome! Please ensure all changes pass the build and tests:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npm run build
|
|
189
|
+
npm test
|
|
190
|
+
npm run test:coverage
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT
|
|
196
|
+
|
|
197
|
+
## Support
|
|
198
|
+
|
|
199
|
+
For issues, feature requests, or questions:
|
|
200
|
+
- GitHub Issues: [rapida-nodejs](https://github.com/rapidaai/rapida-nodejs/issues)
|
|
201
|
+
- Rapida Docs: https://docs.rapida.ai/
|