mixpeek 1.3.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mixpeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,369 @@
1
+ # Mixpeek TypeScript/JavaScript SDK
2
+
3
+ Official TypeScript/JavaScript SDK for the [Mixpeek](https://mixpeek.com) multimodal data processing and retrieval platform.
4
+
5
+ [![npm version](https://badge.fury.io/js/mixpeek.svg)](https://www.npmjs.com/package/mixpeek)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## Features
9
+
10
+ - ✅ **100% Type-Safe** - Built with TypeScript for complete type safety
11
+ - ✅ **Auto-Generated** - Always up-to-date with the latest Mixpeek API
12
+ - ✅ **Runtime Validation** - Zod schemas for request/response validation
13
+ - ✅ **Modern** - Supports both CommonJS and ESM
14
+ - ✅ **Promise-Based** - Clean async/await API
15
+ - ✅ **Comprehensive** - Covers all Mixpeek API endpoints
16
+ - ✅ **Developer-Friendly** - Intuitive method names and excellent autocomplete
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ # npm
22
+ npm install mixpeek
23
+
24
+ # yarn
25
+ yarn add mixpeek
26
+
27
+ # pnpm
28
+ pnpm add mixpeek
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ ```typescript
34
+ import { Mixpeek } from 'mixpeek';
35
+
36
+ // Initialize the client
37
+ const client = new Mixpeek({
38
+ apiKey: process.env.MIXPEEK_API_KEY, // Get your API key at https://dash.mixpeek.com
39
+ namespace: 'my-namespace' // Optional: for multi-tenant isolation
40
+ });
41
+
42
+ // List collections
43
+ const collections = await client.collections.listCollections();
44
+ console.log('Collections:', collections);
45
+
46
+ // Create a collection
47
+ const newCollection = await client.collections.createCollection({
48
+ alias: 'my-collection',
49
+ description: 'My first collection'
50
+ });
51
+
52
+ // Execute a retriever
53
+ const results = await client.retrievers.executeRetriever({
54
+ retrieverId: 'ret_abc123',
55
+ query: 'find relevant documents'
56
+ });
57
+ ```
58
+
59
+ ## Configuration
60
+
61
+ ### Environment Variables
62
+
63
+ The SDK can be configured using environment variables:
64
+
65
+ ```bash
66
+ # Required
67
+ MIXPEEK_API_KEY=sk_your_api_key_here
68
+
69
+ # Optional
70
+ MIXPEEK_BASE_URL=https://api.mixpeek.com # Default
71
+ MIXPEEK_NAMESPACE=default # Default
72
+ ```
73
+
74
+ ### Constructor Options
75
+
76
+ ```typescript
77
+ const client = new Mixpeek({
78
+ apiKey: 'sk_...', // Required (or set MIXPEEK_API_KEY)
79
+ baseUrl: 'https://...', // Optional: custom API endpoint
80
+ namespace: 'my-namespace', // Optional: namespace for isolation
81
+ timeout: 30000, // Optional: request timeout in ms
82
+ axiosConfig: { // Optional: additional axios config
83
+ // Any axios configuration options
84
+ }
85
+ });
86
+ ```
87
+
88
+ ## Usage Examples
89
+
90
+ ### Collections
91
+
92
+ ```typescript
93
+ // Create a collection
94
+ const collection = await client.collections.createCollection({
95
+ alias: 'my-collection',
96
+ description: 'Store multimodal documents',
97
+ metadata: { project: 'demo' }
98
+ });
99
+
100
+ // Get a collection
101
+ const retrieved = await client.collections.getCollection({
102
+ collectionIdentifier: 'my-collection'
103
+ });
104
+
105
+ // List all collections
106
+ const allCollections = await client.collections.listCollections();
107
+
108
+ // Delete a collection
109
+ await client.collections.deleteCollection({
110
+ collectionIdentifier: 'my-collection'
111
+ });
112
+ ```
113
+
114
+ ### Retrievers
115
+
116
+ ```typescript
117
+ // Create a retriever
118
+ const retriever = await client.retrievers.createRetriever({
119
+ retrieverName: 'semantic-search',
120
+ description: 'Search across all documents',
121
+ collectionIdentifiers: ['my-collection'],
122
+ stages: [
123
+ {
124
+ type: 'embed',
125
+ model: 'openai-text-embedding-3-small'
126
+ },
127
+ {
128
+ type: 'vector_search',
129
+ top_k: 10
130
+ }
131
+ ]
132
+ });
133
+
134
+ // Execute a retriever
135
+ const results = await client.retrievers.executeRetriever({
136
+ retrieverId: retriever.retrieverId,
137
+ query: 'find relevant documents about AI'
138
+ });
139
+
140
+ // List retrievers
141
+ const retrievers = await client.retrievers.listRetrievers();
142
+ ```
143
+
144
+ ### Documents
145
+
146
+ ```typescript
147
+ // Upload documents to a collection
148
+ const documents = await client.documents.uploadDocuments({
149
+ collectionId: 'col_abc123',
150
+ documents: [
151
+ {
152
+ url: 's3://bucket/video.mp4',
153
+ metadata: { title: 'Demo Video' }
154
+ },
155
+ {
156
+ url: 's3://bucket/image.jpg',
157
+ metadata: { title: 'Demo Image' }
158
+ }
159
+ ]
160
+ });
161
+
162
+ // Search documents
163
+ const searchResults = await client.documents.searchDocuments({
164
+ collectionId: 'col_abc123',
165
+ query: 'search query',
166
+ limit: 20
167
+ });
168
+ ```
169
+
170
+ ### Buckets (Object Storage)
171
+
172
+ ```typescript
173
+ // Create a bucket
174
+ const bucket = await client.buckets.createBucket({
175
+ alias: 'my-bucket',
176
+ provider: 's3',
177
+ credentials: {
178
+ accessKeyId: 'YOUR_ACCESS_KEY',
179
+ secretAccessKey: 'YOUR_SECRET_KEY',
180
+ region: 'us-east-1'
181
+ }
182
+ });
183
+
184
+ // List buckets
185
+ const buckets = await client.buckets.listBuckets();
186
+ ```
187
+
188
+ ## Error Handling
189
+
190
+ The SDK provides comprehensive error handling:
191
+
192
+ ```typescript
193
+ try {
194
+ const collection = await client.collections.getCollection({
195
+ collectionIdentifier: 'non-existent'
196
+ });
197
+ } catch (error) {
198
+ if (error.response) {
199
+ // API error
200
+ console.error('Status:', error.response.status);
201
+ console.error('Message:', error.response.data?.error?.message);
202
+ } else if (error.request) {
203
+ // Network error
204
+ console.error('Network error:', error.message);
205
+ } else {
206
+ // Other error
207
+ console.error('Error:', error.message);
208
+ }
209
+ }
210
+ ```
211
+
212
+ ## TypeScript Support
213
+
214
+ The SDK is built with TypeScript and provides full type definitions:
215
+
216
+ ```typescript
217
+ import { Mixpeek, MixpeekOptions } from 'mixpeek';
218
+ import type {
219
+ Collection,
220
+ Retriever,
221
+ CreateCollectionRequest,
222
+ CreateRetrieverRequest
223
+ } from 'mixpeek';
224
+
225
+ // All types are fully typed
226
+ const options: MixpeekOptions = {
227
+ apiKey: 'sk_...',
228
+ namespace: 'default'
229
+ };
230
+
231
+ const client = new Mixpeek(options);
232
+
233
+ // TypeScript will autocomplete and type-check all methods
234
+ const collection: Collection = await client.collections.createCollection({
235
+ alias: 'typed-collection'
236
+ // TypeScript will suggest all available fields
237
+ });
238
+ ```
239
+
240
+ ## Advanced Usage
241
+
242
+ ### Custom Axios Configuration
243
+
244
+ ```typescript
245
+ const client = new Mixpeek({
246
+ apiKey: 'sk_...',
247
+ axiosConfig: {
248
+ timeout: 60000,
249
+ headers: {
250
+ 'X-Custom-Header': 'value'
251
+ },
252
+ proxy: {
253
+ host: 'proxy.example.com',
254
+ port: 8080
255
+ }
256
+ }
257
+ });
258
+ ```
259
+
260
+ ### Updating Configuration
261
+
262
+ ```typescript
263
+ const client = new Mixpeek({ apiKey: 'sk_old' });
264
+
265
+ // Update API key
266
+ client.setApiKey('sk_new');
267
+
268
+ // Update namespace
269
+ client.setNamespace('new-namespace');
270
+
271
+ // Get current configuration
272
+ const config = client.getConfig();
273
+ console.log(config);
274
+ // { apiKey: 'sk_new...', baseUrl: '...', namespace: 'new-namespace' }
275
+ ```
276
+
277
+ ### Raw HTTP Requests
278
+
279
+ For endpoints not yet covered by the SDK:
280
+
281
+ ```typescript
282
+ const client = new Mixpeek({ apiKey: 'sk_...' });
283
+
284
+ // Make a raw request
285
+ const response = await client.request({
286
+ method: 'GET',
287
+ url: '/v1/custom-endpoint',
288
+ params: { limit: 10 }
289
+ });
290
+ ```
291
+
292
+ ## Examples
293
+
294
+ See the [`examples/`](./examples) directory for complete working examples:
295
+
296
+ - [Quickstart](./examples/quickstart.ts) - Basic usage
297
+ - [Collections](./examples/collections.ts) - Working with collections
298
+ - [Retrievers](./examples/retrievers.ts) - Creating and executing retrievers
299
+ - [Error Handling](./examples/error-handling.ts) - Comprehensive error handling
300
+
301
+ ## API Documentation
302
+
303
+ For complete API documentation, visit:
304
+
305
+ - **API Reference**: https://docs.mixpeek.com/api-reference
306
+ - **Guides**: https://docs.mixpeek.com/guides
307
+ - **Examples**: https://docs.mixpeek.com/examples
308
+
309
+ ## Development
310
+
311
+ ### Building from Source
312
+
313
+ ```bash
314
+ # Clone the repository
315
+ git clone https://github.com/mixpeek/server.git
316
+ cd server/sdk/javascript-client
317
+
318
+ # Install dependencies
319
+ npm install
320
+
321
+ # Generate SDK from OpenAPI spec
322
+ npm run generate
323
+
324
+ # Build
325
+ npm run build
326
+
327
+ # Run tests
328
+ npm test
329
+ ```
330
+
331
+ ### Regenerating the SDK
332
+
333
+ The SDK is auto-generated from the Mixpeek OpenAPI specification:
334
+
335
+ ```bash
336
+ # Download latest OpenAPI spec
337
+ curl -s https://api.mixpeek.com/docs/openapi.json -o openapi.json
338
+
339
+ # Generate SDK
340
+ npm run generate
341
+
342
+ # Build
343
+ npm run build
344
+ ```
345
+
346
+ ## Contributing
347
+
348
+ We welcome contributions! Please see our [Contributing Guide](../../CONTRIBUTING.md) for details.
349
+
350
+ ## Support
351
+
352
+ - **Documentation**: https://docs.mixpeek.com
353
+ - **Discord**: https://discord.gg/mixpeek
354
+ - **Email**: support@mixpeek.com
355
+ - **GitHub Issues**: https://github.com/mixpeek/server/issues
356
+
357
+ ## License
358
+
359
+ MIT License - see [LICENSE](./LICENSE) for details.
360
+
361
+ ## Changelog
362
+
363
+ See [CHANGELOG.md](./CHANGELOG.md) for version history.
364
+
365
+ ---
366
+
367
+ **Built with** ❤️ **by the Mixpeek team**
368
+
369
+ Auto-generated from OpenAPI spec using [OpenAPI Generator](https://openapi-generator.tech)