@mastra/pinecone 1.0.0-beta.1 → 1.0.0-beta.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @mastra/pinecone
2
2
 
3
+ ## 1.0.0-beta.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Standardize error IDs across all storage and vector stores using centralized helper functions (`createStorageErrorId` and `createVectorErrorId`). This ensures consistent error ID patterns (`MASTRA_STORAGE_{STORE}_{OPERATION}_{STATUS}` and `MASTRA_VECTOR_{STORE}_{OPERATION}_{STATUS}`) across the codebase for better error tracking and debugging. ([#10913](https://github.com/mastra-ai/mastra/pull/10913))
8
+
9
+ - Updated dependencies [[`3076c67`](https://github.com/mastra-ai/mastra/commit/3076c6778b18988ae7d5c4c5c466366974b2d63f), [`85d7ee1`](https://github.com/mastra-ai/mastra/commit/85d7ee18ff4e14d625a8a30ec6656bb49804989b), [`c6c1092`](https://github.com/mastra-ai/mastra/commit/c6c1092f8fbf76109303f69e000e96fd1960c4ce), [`81dc110`](https://github.com/mastra-ai/mastra/commit/81dc11008d147cf5bdc8996ead1aa61dbdebb6fc), [`7aedb74`](https://github.com/mastra-ai/mastra/commit/7aedb74883adf66af38e270e4068fd42e7a37036), [`8f02d80`](https://github.com/mastra-ai/mastra/commit/8f02d800777397e4b45d7f1ad041988a8b0c6630), [`d7aad50`](https://github.com/mastra-ai/mastra/commit/d7aad501ce61646b76b4b511e558ac4eea9884d0), [`ce0a73a`](https://github.com/mastra-ai/mastra/commit/ce0a73abeaa75b10ca38f9e40a255a645d50ebfb), [`a02e542`](https://github.com/mastra-ai/mastra/commit/a02e542d23179bad250b044b17ff023caa61739f), [`a372c64`](https://github.com/mastra-ai/mastra/commit/a372c640ad1fd12e8f0613cebdc682fc156b4d95), [`8846867`](https://github.com/mastra-ai/mastra/commit/8846867ffa9a3746767618e314bebac08eb77d87), [`42a42cf`](https://github.com/mastra-ai/mastra/commit/42a42cf3132b9786feecbb8c13c583dce5b0e198), [`ae08bf0`](https://github.com/mastra-ai/mastra/commit/ae08bf0ebc6a4e4da992b711c4a389c32ba84cf4), [`21735a7`](https://github.com/mastra-ai/mastra/commit/21735a7ef306963554a69a89b44f06c3bcd85141), [`1d877b8`](https://github.com/mastra-ai/mastra/commit/1d877b8d7b536a251c1a7a18db7ddcf4f68d6f8b)]:
10
+ - @mastra/core@1.0.0-beta.7
11
+
12
+ ## 1.0.0-beta.2
13
+
14
+ ### Patch Changes
15
+
16
+ - Add new deleteVectors, updateVector by filter ([#10408](https://github.com/mastra-ai/mastra/pull/10408))
17
+
18
+ - Updated dependencies [[`21a15de`](https://github.com/mastra-ai/mastra/commit/21a15de369fe82aac26bb642ed7be73505475e8b), [`feb7ee4`](https://github.com/mastra-ai/mastra/commit/feb7ee4d09a75edb46c6669a3beaceec78811747), [`b0e2ea5`](https://github.com/mastra-ai/mastra/commit/b0e2ea5b52c40fae438b9e2f7baee6f0f89c5442), [`c456e01`](https://github.com/mastra-ai/mastra/commit/c456e0149e3c176afcefdbd9bb1d2c5917723725), [`ab035c2`](https://github.com/mastra-ai/mastra/commit/ab035c2ef6d8cc7bb25f06f1a38508bd9e6f126b), [`1a46a56`](https://github.com/mastra-ai/mastra/commit/1a46a566f45a3fcbadc1cf36bf86d351f264bfa3), [`3cf540b`](https://github.com/mastra-ai/mastra/commit/3cf540b9fbfea8f4fc8d3a2319a4e6c0b0cbfd52), [`1c6ce51`](https://github.com/mastra-ai/mastra/commit/1c6ce51f875915ab57fd36873623013699a2a65d), [`898a972`](https://github.com/mastra-ai/mastra/commit/898a9727d286c2510d6b702dfd367e6aaf5c6b0f), [`a97003a`](https://github.com/mastra-ai/mastra/commit/a97003aa1cf2f4022a41912324a1e77263b326b8), [`ccc141e`](https://github.com/mastra-ai/mastra/commit/ccc141ed27da0abc3a3fc28e9e5128152e8e37f4), [`fe3b897`](https://github.com/mastra-ai/mastra/commit/fe3b897c2ccbcd2b10e81b099438c7337feddf89), [`00123ba`](https://github.com/mastra-ai/mastra/commit/00123ba96dc9e5cd0b110420ebdba56d8f237b25), [`29c4309`](https://github.com/mastra-ai/mastra/commit/29c4309f818b24304c041bcb4a8f19b5f13f6b62), [`16785ce`](https://github.com/mastra-ai/mastra/commit/16785ced928f6f22638f4488cf8a125d99211799), [`de8239b`](https://github.com/mastra-ai/mastra/commit/de8239bdcb1d8c0cfa06da21f1569912a66bbc8a), [`b5e6cd7`](https://github.com/mastra-ai/mastra/commit/b5e6cd77fc8c8e64e0494c1d06cee3d84e795d1e), [`3759cb0`](https://github.com/mastra-ai/mastra/commit/3759cb064935b5f74c65ac2f52a1145f7352899d), [`651e772`](https://github.com/mastra-ai/mastra/commit/651e772eb1475fb13e126d3fcc01751297a88214), [`b61b93f`](https://github.com/mastra-ai/mastra/commit/b61b93f9e058b11dd2eec169853175d31dbdd567), [`bae33d9`](https://github.com/mastra-ai/mastra/commit/bae33d91a63fbb64d1e80519e1fc1acaed1e9013), [`c0b731f`](https://github.com/mastra-ai/mastra/commit/c0b731fb27d712dc8582e846df5c0332a6a0c5ba), [`43ca8f2`](https://github.com/mastra-ai/mastra/commit/43ca8f2c7334851cc7b4d3d2f037d8784bfbdd5f), [`2ca67cc`](https://github.com/mastra-ai/mastra/commit/2ca67cc3bb1f6a617353fdcab197d9efebe60d6f), [`9e67002`](https://github.com/mastra-ai/mastra/commit/9e67002b52c9be19936c420a489dbee9c5fd6a78), [`35edc49`](https://github.com/mastra-ai/mastra/commit/35edc49ac0556db609189641d6341e76771b81fc)]:
19
+ - @mastra/core@1.0.0-beta.5
20
+
3
21
  ## 1.0.0-beta.1
4
22
 
5
23
  ### Patch Changes
package/README.md CHANGED
@@ -62,6 +62,9 @@ Optional:
62
62
  - `createIndex({indexName, dimension, metric?})`: Create a new index
63
63
  - `upsert({indexName, vectors, metadata?, ids?})`: Add or update vectors
64
64
  - `query({indexName, queryVector, topK?, filter?, includeVector?})`: Search for similar vectors
65
+ - `updateVector({ indexName, id?, filter?, namespace?, update })`: Update a single vector by ID or metadata filter
66
+ - `deleteVector({ indexName, id })`: Delete a single vector by ID
67
+ - `deleteVectors({ indexName, ids?, filter?, namespace? })`: Delete multiple vectors by IDs or metadata filter
65
68
  - `listIndexes()`: List all indexes
66
69
  - `describeIndex(indexName)`: Get index statistics
67
70
  - `deleteIndex(indexName)`: Delete an index
package/dist/index.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var error = require('@mastra/core/error');
4
+ var storage = require('@mastra/core/storage');
4
5
  var vector = require('@mastra/core/vector');
5
6
  var pinecone = require('@pinecone-database/pinecone');
6
7
  var filter = require('@mastra/core/vector/filter');
@@ -126,7 +127,7 @@ var PineconeVector = class extends vector.MastraVector {
126
127
  } catch (validationError) {
127
128
  throw new error.MastraError(
128
129
  {
129
- id: "STORAGE_PINECONE_VECTOR_CREATE_INDEX_INVALID_ARGS",
130
+ id: storage.createVectorErrorId("PINECONE", "CREATE_INDEX", "INVALID_ARGS"),
130
131
  domain: error.ErrorDomain.STORAGE,
131
132
  category: error.ErrorCategory.USER,
132
133
  details: { indexName, dimension, metric }
@@ -154,7 +155,7 @@ var PineconeVector = class extends vector.MastraVector {
154
155
  }
155
156
  throw new error.MastraError(
156
157
  {
157
- id: "STORAGE_PINECONE_VECTOR_CREATE_INDEX_FAILED",
158
+ id: storage.createVectorErrorId("PINECONE", "CREATE_INDEX", "FAILED"),
158
159
  domain: error.ErrorDomain.STORAGE,
159
160
  category: error.ErrorCategory.THIRD_PARTY,
160
161
  details: { indexName, dimension, metric }
@@ -189,7 +190,7 @@ var PineconeVector = class extends vector.MastraVector {
189
190
  } catch (error$1) {
190
191
  throw new error.MastraError(
191
192
  {
192
- id: "STORAGE_PINECONE_VECTOR_UPSERT_FAILED",
193
+ id: storage.createVectorErrorId("PINECONE", "UPSERT", "FAILED"),
193
194
  domain: error.ErrorDomain.STORAGE,
194
195
  category: error.ErrorCategory.THIRD_PARTY,
195
196
  details: { indexName, vectorCount: vectors.length }
@@ -234,7 +235,7 @@ var PineconeVector = class extends vector.MastraVector {
234
235
  } catch (error$1) {
235
236
  throw new error.MastraError(
236
237
  {
237
- id: "STORAGE_PINECONE_VECTOR_QUERY_FAILED",
238
+ id: storage.createVectorErrorId("PINECONE", "QUERY", "FAILED"),
238
239
  domain: error.ErrorDomain.STORAGE,
239
240
  category: error.ErrorCategory.THIRD_PARTY,
240
241
  details: { indexName, topK }
@@ -250,7 +251,7 @@ var PineconeVector = class extends vector.MastraVector {
250
251
  } catch (error$1) {
251
252
  throw new error.MastraError(
252
253
  {
253
- id: "STORAGE_PINECONE_VECTOR_LIST_INDEXES_FAILED",
254
+ id: storage.createVectorErrorId("PINECONE", "LIST_INDEXES", "FAILED"),
254
255
  domain: error.ErrorDomain.STORAGE,
255
256
  category: error.ErrorCategory.THIRD_PARTY
256
257
  },
@@ -278,7 +279,7 @@ var PineconeVector = class extends vector.MastraVector {
278
279
  } catch (error$1) {
279
280
  throw new error.MastraError(
280
281
  {
281
- id: "STORAGE_PINECONE_VECTOR_DESCRIBE_INDEX_FAILED",
282
+ id: storage.createVectorErrorId("PINECONE", "DESCRIBE_INDEX", "FAILED"),
282
283
  domain: error.ErrorDomain.STORAGE,
283
284
  category: error.ErrorCategory.THIRD_PARTY,
284
285
  details: { indexName }
@@ -293,7 +294,7 @@ var PineconeVector = class extends vector.MastraVector {
293
294
  } catch (error$1) {
294
295
  throw new error.MastraError(
295
296
  {
296
- id: "STORAGE_PINECONE_VECTOR_DELETE_INDEX_FAILED",
297
+ id: storage.createVectorErrorId("PINECONE", "DELETE_INDEX", "FAILED"),
297
298
  domain: error.ErrorDomain.STORAGE,
298
299
  category: error.ErrorCategory.THIRD_PARTY,
299
300
  details: { indexName }
@@ -304,42 +305,102 @@ var PineconeVector = class extends vector.MastraVector {
304
305
  }
305
306
  /**
306
307
  * Updates a vector by its ID with the provided vector and/or metadata.
307
- * @param indexName - The name of the index containing the vector.
308
- * @param id - The ID of the vector to update.
309
- * @param update - An object containing the vector and/or metadata to update.
310
- * @param update.vector - An optional array of numbers representing the new vector.
311
- * @param update.metadata - An optional record containing the new metadata.
312
- * @param namespace - The namespace of the index (optional).
308
+ * Note: Pinecone only supports update by ID, not by filter.
309
+ * @param params - Parameters containing the id for targeting the vector to update
310
+ * @param params.indexName - The name of the index containing the vector.
311
+ * @param params.id - The ID of the vector to update.
312
+ * @param params.update - An object containing the vector and/or metadata to update.
313
+ * @param namespace - The namespace of the index (optional, Pinecone-specific).
313
314
  * @returns A promise that resolves when the update is complete.
314
315
  * @throws Will throw an error if no updates are provided or if the update operation fails.
315
316
  */
316
- async updateVector({ indexName, id, update, namespace }) {
317
+ async updateVector(params) {
318
+ const { indexName, update } = params;
319
+ if ("id" in params && params.id && "filter" in params && params.filter) {
320
+ throw new error.MastraError({
321
+ id: storage.createVectorErrorId("PINECONE", "UPDATE_VECTOR", "MUTUALLY_EXCLUSIVE"),
322
+ text: "Cannot specify both id and filter - they are mutually exclusive",
323
+ domain: error.ErrorDomain.STORAGE,
324
+ category: error.ErrorCategory.USER,
325
+ details: { indexName }
326
+ });
327
+ }
328
+ if (!("id" in params && params.id) && !("filter" in params && params.filter)) {
329
+ throw new error.MastraError({
330
+ id: storage.createVectorErrorId("PINECONE", "UPDATE_VECTOR", "NO_TARGET"),
331
+ text: "Either id or filter must be provided",
332
+ domain: error.ErrorDomain.STORAGE,
333
+ category: error.ErrorCategory.USER,
334
+ details: { indexName }
335
+ });
336
+ }
317
337
  if (!update.vector && !update.metadata) {
318
338
  throw new error.MastraError({
319
- id: "STORAGE_PINECONE_VECTOR_UPDATE_VECTOR_INVALID_ARGS",
339
+ id: storage.createVectorErrorId("PINECONE", "UPDATE_VECTOR", "NO_PAYLOAD"),
320
340
  domain: error.ErrorDomain.STORAGE,
321
341
  category: error.ErrorCategory.USER,
322
342
  text: "No updates provided",
323
- details: { indexName, id }
343
+ details: { indexName }
324
344
  });
325
345
  }
346
+ const namespace = params.namespace;
326
347
  try {
327
348
  const index = this.client.Index(indexName).namespace(namespace || "");
328
- const updateObj = { id };
329
- if (update.vector) {
330
- updateObj.values = update.vector;
331
- }
332
- if (update.metadata) {
333
- updateObj.metadata = update.metadata;
349
+ if ("id" in params && params.id) {
350
+ const updateObj = { id: params.id };
351
+ if (update.vector) {
352
+ updateObj.values = update.vector;
353
+ }
354
+ if (update.metadata) {
355
+ updateObj.metadata = update.metadata;
356
+ }
357
+ await index.update(updateObj);
358
+ } else if ("filter" in params && params.filter) {
359
+ if (Object.keys(params.filter).length === 0) {
360
+ throw new error.MastraError({
361
+ id: storage.createVectorErrorId("PINECONE", "UPDATE_VECTOR", "EMPTY_FILTER"),
362
+ text: "Filter cannot be an empty filter object",
363
+ domain: error.ErrorDomain.STORAGE,
364
+ category: error.ErrorCategory.USER,
365
+ details: { indexName }
366
+ });
367
+ }
368
+ const translatedFilter = this.transformFilter(params.filter);
369
+ if (translatedFilter) {
370
+ const stats = await this.describeIndex({ indexName });
371
+ const dummyVector = new Array(stats.dimension).fill(1 / Math.sqrt(stats.dimension));
372
+ const results = await index.query({
373
+ vector: dummyVector,
374
+ topK: 1e4,
375
+ filter: translatedFilter,
376
+ includeMetadata: false,
377
+ includeValues: false
378
+ });
379
+ const idsToUpdate = results.matches.map((m) => m.id);
380
+ for (const id of idsToUpdate) {
381
+ const updateObj = { id };
382
+ if (update.vector) {
383
+ updateObj.values = update.vector;
384
+ }
385
+ if (update.metadata) {
386
+ updateObj.metadata = update.metadata;
387
+ }
388
+ await index.update(updateObj);
389
+ }
390
+ }
334
391
  }
335
- await index.update(updateObj);
336
392
  } catch (error$1) {
393
+ if (error$1 instanceof error.MastraError) throw error$1;
337
394
  throw new error.MastraError(
338
395
  {
339
- id: "STORAGE_PINECONE_VECTOR_UPDATE_VECTOR_FAILED",
396
+ id: storage.createVectorErrorId("PINECONE", "UPDATE_VECTOR", "FAILED"),
340
397
  domain: error.ErrorDomain.STORAGE,
341
398
  category: error.ErrorCategory.THIRD_PARTY,
342
- details: { indexName, id }
399
+ details: {
400
+ indexName,
401
+ ..."id" in params && params.id && { id: params.id },
402
+ ..."filter" in params && params.filter && { filter: JSON.stringify(params.filter) }
403
+ }
343
404
  },
344
405
  error$1
345
406
  );
@@ -360,10 +421,100 @@ var PineconeVector = class extends vector.MastraVector {
360
421
  } catch (error$1) {
361
422
  throw new error.MastraError(
362
423
  {
363
- id: "STORAGE_PINECONE_VECTOR_DELETE_VECTOR_FAILED",
424
+ id: storage.createVectorErrorId("PINECONE", "DELETE_VECTOR", "FAILED"),
364
425
  domain: error.ErrorDomain.STORAGE,
365
426
  category: error.ErrorCategory.THIRD_PARTY,
366
- details: { indexName, id }
427
+ details: {
428
+ indexName,
429
+ ...id && { id }
430
+ }
431
+ },
432
+ error$1
433
+ );
434
+ }
435
+ }
436
+ /**
437
+ * Deletes multiple vectors by IDs or filter.
438
+ * @param indexName - The name of the index containing the vectors.
439
+ * @param ids - Array of vector IDs to delete (mutually exclusive with filter).
440
+ * @param filter - Filter to match vectors to delete (mutually exclusive with ids).
441
+ * @param namespace - The namespace of the index (optional, Pinecone-specific).
442
+ * @returns A promise that resolves when the deletion is complete.
443
+ * @throws Will throw an error if both ids and filter are provided, or if neither is provided.
444
+ */
445
+ async deleteVectors(params) {
446
+ const { indexName, filter, ids } = params;
447
+ const namespace = params.namespace;
448
+ if (ids && filter) {
449
+ throw new error.MastraError({
450
+ id: storage.createVectorErrorId("PINECONE", "DELETE_VECTORS", "MUTUALLY_EXCLUSIVE"),
451
+ text: "Cannot specify both ids and filter - they are mutually exclusive",
452
+ domain: error.ErrorDomain.STORAGE,
453
+ category: error.ErrorCategory.USER,
454
+ details: { indexName }
455
+ });
456
+ }
457
+ if (!ids && !filter) {
458
+ throw new error.MastraError({
459
+ id: storage.createVectorErrorId("PINECONE", "DELETE_VECTORS", "NO_TARGET"),
460
+ text: "Either filter or ids must be provided",
461
+ domain: error.ErrorDomain.STORAGE,
462
+ category: error.ErrorCategory.USER,
463
+ details: { indexName }
464
+ });
465
+ }
466
+ if (ids && ids.length === 0) {
467
+ throw new error.MastraError({
468
+ id: storage.createVectorErrorId("PINECONE", "DELETE_VECTORS", "EMPTY_IDS"),
469
+ text: "Cannot delete with empty ids array",
470
+ domain: error.ErrorDomain.STORAGE,
471
+ category: error.ErrorCategory.USER,
472
+ details: { indexName }
473
+ });
474
+ }
475
+ if (filter && Object.keys(filter).length === 0) {
476
+ throw new error.MastraError({
477
+ id: storage.createVectorErrorId("PINECONE", "DELETE_VECTORS", "EMPTY_FILTER"),
478
+ text: "Cannot delete with empty filter object",
479
+ domain: error.ErrorDomain.STORAGE,
480
+ category: error.ErrorCategory.USER,
481
+ details: { indexName }
482
+ });
483
+ }
484
+ try {
485
+ const index = this.client.Index(indexName).namespace(namespace || "");
486
+ if (ids) {
487
+ await index.deleteMany(ids);
488
+ } else if (filter) {
489
+ const translatedFilter = this.transformFilter(filter);
490
+ if (translatedFilter) {
491
+ const stats = await this.describeIndex({ indexName });
492
+ const dummyVector = new Array(stats.dimension).fill(1 / Math.sqrt(stats.dimension));
493
+ const results = await index.query({
494
+ vector: dummyVector,
495
+ topK: 1e4,
496
+ filter: translatedFilter,
497
+ includeMetadata: false,
498
+ includeValues: false
499
+ });
500
+ const idsToDelete = results.matches.map((m) => m.id);
501
+ if (idsToDelete.length > 0) {
502
+ await index.deleteMany(idsToDelete);
503
+ }
504
+ }
505
+ }
506
+ } catch (error$1) {
507
+ if (error$1 instanceof error.MastraError) throw error$1;
508
+ throw new error.MastraError(
509
+ {
510
+ id: storage.createVectorErrorId("PINECONE", "DELETE_VECTORS", "FAILED"),
511
+ domain: error.ErrorDomain.STORAGE,
512
+ category: error.ErrorCategory.THIRD_PARTY,
513
+ details: {
514
+ indexName,
515
+ ...filter && { filter: JSON.stringify(filter) },
516
+ ...ids && { idsCount: ids.length }
517
+ }
367
518
  },
368
519
  error$1
369
520
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/vector/filter.ts","../src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ACJ,QAAQC,iBAAA,CAAY,OAAA;AAAA,UACpB,UAAUC,mBAAA,CAAc,WAAA;AAAA,UACxB,OAAA,EAAS,EAAE,SAAA,EAAW,EAAA;AAAG,SAC3B;AAAA,QACAC;AAAA,OACF;AAAA,IACF;AAAA,EACF;AACF;;;ACnXO,IAAM,eAAA,GAAkB,CAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA","file":"index.cjs","sourcesContent":["import { BaseFilterTranslator } from '@mastra/core/vector/filter';\nimport type {\n VectorFilter,\n OperatorSupport,\n OperatorValueMap,\n LogicalOperatorValueMap,\n BlacklistedRootOperators,\n QueryOperator,\n FilterValue,\n OperatorCondition,\n} from '@mastra/core/vector/filter';\n\ntype InitialOperatorValueMap = Omit<OperatorValueMap, '$regex' | '$options' | '$elemMatch' | '$all'> & {\n $contains: string;\n $gt: number | Date;\n $gte: number | Date;\n $lt: number | Date;\n $lte: number | Date;\n};\n\ntype PineconeOperatorValueMap = InitialOperatorValueMap & {\n $all: OperatorCondition<keyof InitialOperatorValueMap, InitialOperatorValueMap>[] | FilterValue[];\n};\ntype PineconeLogicalOperatorValueMap = Omit<LogicalOperatorValueMap, '$not' | '$nor'>;\n\ntype PineconeBlacklisted = BlacklistedRootOperators | '$not' | '$nor';\n\nexport type PineconeVectorFilter = VectorFilter<\n keyof PineconeOperatorValueMap,\n PineconeOperatorValueMap,\n PineconeLogicalOperatorValueMap,\n PineconeBlacklisted\n>;\n\nexport class PineconeFilterTranslator extends BaseFilterTranslator<PineconeVectorFilter> {\n protected override getSupportedOperators(): OperatorSupport {\n return {\n ...BaseFilterTranslator.DEFAULT_OPERATORS,\n logical: ['$and', '$or'],\n array: ['$in', '$all', '$nin'],\n element: ['$exists'],\n regex: [],\n custom: [],\n };\n }\n\n translate(filter?: PineconeVectorFilter): PineconeVectorFilter {\n if (this.isEmpty(filter)) return filter;\n this.validateFilter(filter);\n return this.translateNode(filter);\n }\n\n private translateNode(node: PineconeVectorFilter, currentPath: string = ''): any {\n if (this.isRegex(node)) {\n throw new Error('Regex is not supported in Pinecone');\n }\n if (this.isPrimitive(node)) return this.normalizeComparisonValue(node);\n if (Array.isArray(node)) return { $in: this.normalizeArrayValues(node) };\n\n const entries = Object.entries(node as Record<string, any>);\n const firstEntry = entries[0];\n\n // Handle single operator case\n if (entries.length === 1 && firstEntry && this.isOperator(firstEntry[0])) {\n const [operator, value] = firstEntry;\n const translated = this.translateOperator(operator, value, currentPath);\n return this.isLogicalOperator(operator) ? { [operator]: translated } : translated;\n }\n\n // Process each entry\n const result: Record<string, any> = {};\n\n for (const [key, value] of entries) {\n const newPath = currentPath ? `${currentPath}.${key}` : key;\n\n if (this.isOperator(key)) {\n result[key] = this.translateOperator(key, value, currentPath);\n continue;\n }\n\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n // Handle nested $all\n if (Object.keys(value).length === 1 && '$all' in value) {\n const translated = this.translateNode(value, key);\n if (translated.$and) {\n return translated;\n }\n }\n\n // Check if the nested object contains operators\n if (Object.keys(value).length === 0) {\n result[newPath] = this.translateNode(value);\n } else {\n const hasOperators = Object.keys(value).some(k => this.isOperator(k));\n if (hasOperators) {\n // For objects with operators, normalize each operator value\n const normalizedValue: Record<string, any> = {};\n for (const [op, opValue] of Object.entries(value)) {\n normalizedValue[op] = this.isOperator(op) ? this.translateOperator(op, opValue) : opValue;\n }\n result[newPath] = normalizedValue;\n } else {\n // For objects without operators, flatten them\n Object.assign(result, this.translateNode(value, newPath));\n }\n }\n } else {\n result[newPath] = this.translateNode(value);\n }\n }\n\n return result;\n }\n\n private translateOperator(operator: QueryOperator, value: any, currentPath: string = ''): any {\n // Handle $all specially\n if (operator === '$all') {\n if (!Array.isArray(value) || value.length === 0) {\n throw new Error('A non-empty array is required for the $all operator');\n }\n\n return this.simulateAllOperator(currentPath, value);\n }\n\n // Handle logical operators\n if (this.isLogicalOperator(operator)) {\n return Array.isArray(value) ? value.map(item => this.translateNode(item)) : this.translateNode(value);\n }\n\n // Handle comparison and element operators\n return this.normalizeComparisonValue(value);\n }\n}\n","import { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\nimport { MastraVector } from '@mastra/core/vector';\nimport type {\n QueryResult,\n IndexStats,\n CreateIndexParams,\n UpsertVectorParams,\n QueryVectorParams,\n DescribeIndexParams,\n DeleteIndexParams,\n DeleteVectorParams,\n UpdateVectorParams,\n} from '@mastra/core/vector';\nimport { Pinecone } from '@pinecone-database/pinecone';\nimport type {\n IndexStatsDescription,\n QueryOptions,\n RecordSparseValues,\n ServerlessSpecCloudEnum,\n UpdateOptions,\n} from '@pinecone-database/pinecone';\n\nimport { PineconeFilterTranslator } from './filter';\nimport type { PineconeVectorFilter } from './filter';\n\ninterface PineconeIndexStats extends IndexStats {\n namespaces?: IndexStatsDescription['namespaces'];\n}\n\ninterface PineconeQueryVectorParams extends QueryVectorParams<PineconeVectorFilter> {\n namespace?: string;\n sparseVector?: RecordSparseValues;\n}\n\ninterface PineconeUpsertVectorParams extends UpsertVectorParams {\n namespace?: string;\n sparseVectors?: RecordSparseValues[];\n}\n\ninterface PineconeUpdateVectorParams extends UpdateVectorParams {\n namespace?: string;\n}\n\ninterface PineconeDeleteVectorParams extends DeleteVectorParams {\n namespace?: string;\n}\n\nexport class PineconeVector extends MastraVector<PineconeVectorFilter> {\n private client: Pinecone;\n private cloud: ServerlessSpecCloudEnum;\n private region: string;\n\n /**\n * Creates a new PineconeVector client.\n * @param id - The unique identifier for this vector store instance.\n * @param apiKey - The API key for Pinecone.\n * @param environment - The environment for Pinecone.\n * @param cloud - The cloud provider for Pinecone.\n * @param region - The region for Pinecone.\n */\n constructor({\n id,\n apiKey,\n environment,\n cloud,\n region,\n }: {\n id: string;\n apiKey: string;\n environment?: string;\n region?: string;\n cloud?: ServerlessSpecCloudEnum;\n }) {\n super({ id });\n const opts: { apiKey: string; controllerHostUrl?: string } = { apiKey };\n if (environment) {\n opts['controllerHostUrl'] = environment;\n }\n this.client = new Pinecone(opts);\n this.cloud = cloud || 'aws';\n this.region = region || 'us-east-1';\n }\n\n get indexSeparator(): string {\n return '-';\n }\n\n async createIndex({ indexName, dimension, metric = 'cosine' }: CreateIndexParams): Promise<void> {\n try {\n if (!Number.isInteger(dimension) || dimension <= 0) {\n throw new Error('Dimension must be a positive integer');\n }\n if (metric && !['cosine', 'euclidean', 'dotproduct'].includes(metric)) {\n throw new Error('Metric must be one of: cosine, euclidean, dotproduct');\n }\n } catch (validationError) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_CREATE_INDEX_INVALID_ARGS',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName, dimension, metric },\n },\n validationError,\n );\n }\n\n try {\n await this.client.createIndex({\n name: indexName,\n dimension: dimension,\n metric: metric,\n spec: {\n serverless: {\n cloud: this.cloud,\n region: this.region,\n },\n },\n });\n } catch (error: any) {\n // Check for 'already exists' error\n const message = error?.errors?.[0]?.message || error?.message;\n if (\n error.status === 409 ||\n (typeof message === 'string' &&\n (message.toLowerCase().includes('already exists') || message.toLowerCase().includes('duplicate')))\n ) {\n // Fetch index info and check dimensions\n await this.validateExistingIndex(indexName, dimension, metric);\n return;\n }\n // For any other errors, wrap in MastraError\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_CREATE_INDEX_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, dimension, metric },\n },\n error,\n );\n }\n }\n\n async upsert({\n indexName,\n vectors,\n metadata,\n ids,\n namespace,\n sparseVectors,\n }: PineconeUpsertVectorParams): Promise<string[]> {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n // Generate IDs if not provided\n const vectorIds = ids || vectors.map(() => crypto.randomUUID());\n\n const records = vectors.map((vector, i) => ({\n id: vectorIds[i]!,\n values: vector,\n ...(sparseVectors?.[i] && { sparseValues: sparseVectors?.[i] }),\n metadata: metadata?.[i] || {},\n }));\n\n // Pinecone has a limit of 100 vectors per upsert request\n const batchSize = 100;\n try {\n for (let i = 0; i < records.length; i += batchSize) {\n const batch = records.slice(i, i + batchSize);\n await index.upsert(batch);\n }\n\n return vectorIds;\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_UPSERT_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, vectorCount: vectors.length },\n },\n error,\n );\n }\n }\n\n transformFilter(filter?: PineconeVectorFilter) {\n const translator = new PineconeFilterTranslator();\n return translator.translate(filter);\n }\n\n async query({\n indexName,\n queryVector,\n topK = 10,\n filter,\n includeVector = false,\n namespace,\n sparseVector,\n }: PineconeQueryVectorParams): Promise<QueryResult[]> {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n const translatedFilter = this.transformFilter(filter) ?? undefined;\n\n const queryParams: QueryOptions = {\n vector: queryVector,\n topK,\n includeMetadata: true,\n includeValues: includeVector,\n filter: translatedFilter,\n };\n\n // If sparse vector is provided, use hybrid search\n if (sparseVector) {\n queryParams.sparseVector = sparseVector;\n }\n\n try {\n const results = await index.query(queryParams);\n\n return results.matches.map(match => ({\n id: match.id,\n score: match.score || 0,\n metadata: match.metadata as Record<string, any>,\n ...(includeVector && { vector: match.values || [] }),\n }));\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_QUERY_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, topK },\n },\n error,\n );\n }\n }\n\n async listIndexes(): Promise<string[]> {\n try {\n const indexesResult = await this.client.listIndexes();\n return indexesResult?.indexes?.map(index => index.name) || [];\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_LIST_INDEXES_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n },\n error,\n );\n }\n }\n\n /**\n * Retrieves statistics about a vector index.\n *\n * @param {string} indexName - The name of the index to describe\n * @returns A promise that resolves to the index statistics including dimension, count and metric\n */\n async describeIndex({ indexName }: DescribeIndexParams): Promise<PineconeIndexStats> {\n try {\n const index = this.client.Index(indexName);\n const stats = await index.describeIndexStats();\n const description = await this.client.describeIndex(indexName);\n\n return {\n dimension: description.dimension,\n count: stats.totalRecordCount || 0,\n metric: description.metric as 'cosine' | 'euclidean' | 'dotproduct',\n namespaces: stats.namespaces,\n };\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_DESCRIBE_INDEX_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName },\n },\n error,\n );\n }\n }\n\n async deleteIndex({ indexName }: DeleteIndexParams): Promise<void> {\n try {\n await this.client.deleteIndex(indexName);\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_DELETE_INDEX_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName },\n },\n error,\n );\n }\n }\n\n /**\n * Updates a vector by its ID with the provided vector and/or metadata.\n * @param indexName - The name of the index containing the vector.\n * @param id - The ID of the vector to update.\n * @param update - An object containing the vector and/or metadata to update.\n * @param update.vector - An optional array of numbers representing the new vector.\n * @param update.metadata - An optional record containing the new metadata.\n * @param namespace - The namespace of the index (optional).\n * @returns A promise that resolves when the update is complete.\n * @throws Will throw an error if no updates are provided or if the update operation fails.\n */\n async updateVector({ indexName, id, update, namespace }: PineconeUpdateVectorParams): Promise<void> {\n if (!update.vector && !update.metadata) {\n throw new MastraError({\n id: 'STORAGE_PINECONE_VECTOR_UPDATE_VECTOR_INVALID_ARGS',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n text: 'No updates provided',\n details: { indexName, id },\n });\n }\n\n try {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n const updateObj: UpdateOptions = { id };\n\n if (update.vector) {\n updateObj.values = update.vector;\n }\n\n if (update.metadata) {\n updateObj.metadata = update.metadata;\n }\n\n await index.update(updateObj);\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_UPDATE_VECTOR_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, id },\n },\n error,\n );\n }\n }\n\n /**\n * Deletes a vector by its ID.\n * @param indexName - The name of the index containing the vector.\n * @param id - The ID of the vector to delete.\n * @param namespace - The namespace of the index (optional).\n * @returns A promise that resolves when the deletion is complete.\n * @throws Will throw an error if the deletion operation fails.\n */\n async deleteVector({ indexName, id, namespace }: PineconeDeleteVectorParams): Promise<void> {\n try {\n const index = this.client.Index(indexName).namespace(namespace || '');\n await index.deleteOne(id);\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_DELETE_VECTOR_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, id },\n },\n error,\n );\n }\n }\n}\n","/**\n * Vector store specific prompt that details supported operators and examples.\n * This prompt helps users construct valid filters for Pinecone Vector.\n */\nexport const PINECONE_PROMPT = `When querying Pinecone, you can ONLY use the operators listed below. Any other operators will be rejected.\nImportant: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.\nIf a user tries to give an explicit operator that is not supported, reject the filter entirely and let them know that the operator is not supported.\n\nBasic Comparison Operators:\n- $eq: Exact match (default when using field: value)\n Example: { \"category\": \"electronics\" }\n- $ne: Not equal\n Example: { \"category\": { \"$ne\": \"electronics\" } }\n- $gt: Greater than\n Example: { \"price\": { \"$gt\": 100 } }\n- $gte: Greater than or equal\n Example: { \"price\": { \"$gte\": 100 } }\n- $lt: Less than\n Example: { \"price\": { \"$lt\": 100 } }\n- $lte: Less than or equal\n Example: { \"price\": { \"$lte\": 100 } }\n\nArray Operators:\n- $in: Match any value in array\n Example: { \"category\": { \"$in\": [\"electronics\", \"books\"] } }\n- $nin: Does not match any value in array\n Example: { \"category\": { \"$nin\": [\"electronics\", \"books\"] } }\n- $all: Match all values in array\n Example: { \"tags\": { \"$all\": [\"premium\", \"sale\"] } }\n\nLogical Operators:\n- $and: Logical AND (can be implicit or explicit)\n Implicit Example: { \"price\": { \"$gt\": 100 }, \"category\": \"electronics\" }\n Explicit Example: { \"$and\": [{ \"price\": { \"$gt\": 100 } }, { \"category\": \"electronics\" }] }\n- $or: Logical OR\n Example: { \"$or\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n\nElement Operators:\n- $exists: Check if field exists\n Example: { \"rating\": { \"$exists\": true } }\n\nRestrictions:\n- Regex patterns are not supported\n- Only $and and $or logical operators are supported at the top level\n- Empty arrays in $in/$nin will return no results\n- A non-empty array is required for $all operator\n- Nested fields are supported using dot notation\n- Multiple conditions on the same field are supported with both implicit and explicit $and\n- At least one key-value pair is required in filter object\n- Empty objects and undefined values are treated as no filter\n- Invalid types in comparison operators will throw errors\n- All non-logical operators must be used within a field condition\n Valid: { \"field\": { \"$gt\": 100 } }\n Valid: { \"$and\": [...] }\n Invalid: { \"$gt\": 100 }\n- Logical operators must contain field conditions, not direct operators\n Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n Invalid: { \"$and\": [{ \"$gt\": 100 }] }\n- Logical operators ($and, $or):\n - Can only be used at top level or nested within other logical operators\n - Can not be used on a field level, or be nested inside a field\n - Can not be used inside an operator\n - Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n - Valid: { \"$or\": [{ \"$and\": [{ \"field\": { \"$gt\": 100 } }] }] }\n - Invalid: { \"field\": { \"$and\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$or\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$gt\": { \"$and\": [{...}] } } }\n\nExample Complex Query:\n{\n \"$and\": [\n { \"category\": { \"$in\": [\"electronics\", \"computers\"] } },\n { \"price\": { \"$gte\": 100, \"$lte\": 1000 } },\n { \"tags\": { \"$all\": [\"premium\", \"sale\"] } },\n { \"rating\": { \"$exists\": true, \"$gt\": 4 } },\n { \"$or\": [\n { \"stock\": { \"$gt\": 0 } },\n { \"preorder\": true }\n ]}\n ]\n}`;\n"]}
1
+ {"version":3,"sources":["../src/vector/filter.ts","../src/vector/index.ts","../src/vector/prompt.ts"],"names":["BaseFilterTranslator","MastraVector","Pinecone","MastraError","createVectorErrorId","ErrorDomain","ErrorCategory","error"],"mappings":";;;;;;;;;AAkCO,IAAM,wBAAA,GAAN,cAAuCA,2BAAA,CAA2C;AAAA,EACpE,qBAAA,GAAyC;AAC1D,IAAA,OAAO;AAAA,MACL,GAAGA,2BAAA,CAAqB,iBAAA;AAAA,MACxB,OAAA,EAAS,CAAC,MAAA,EAAQ,KAAK,CAAA;AAAA,MACvB,KAAA,EAAO,CAAC,KAAA,EAAO,MAAA,EAAQ,MAAM,CAAA;AAAA,MAC7B,OAAA,EAAS,CAAC,SAAS,CAAA;AAAA,MACnB,OAAO,EAAC;AAAA,MACR,QAAQ;AAAC,KACX;AAAA,EACF;AAAA,EAEA,UAAU,MAAA,EAAqD;AAC7D,IAAA,IAAI,IAAA,CAAK,OAAA,CAAQ,MAAM,CAAA,EAAG,OAAO,MAAA;AACjC,IAAA,IAAA,CAAK,eAAe,MAAM,CAAA;AAC1B,IAAA,OAAO,IAAA,CAAK,cAAc,MAAM,CAAA;AAAA,EAClC;AAAA,EAEQ,aAAA,CAAc,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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA","file":"index.cjs","sourcesContent":["import { BaseFilterTranslator } from '@mastra/core/vector/filter';\nimport type {\n VectorFilter,\n OperatorSupport,\n OperatorValueMap,\n LogicalOperatorValueMap,\n BlacklistedRootOperators,\n QueryOperator,\n FilterValue,\n OperatorCondition,\n} from '@mastra/core/vector/filter';\n\ntype InitialOperatorValueMap = Omit<OperatorValueMap, '$regex' | '$options' | '$elemMatch' | '$all'> & {\n $contains: string;\n $gt: number | Date;\n $gte: number | Date;\n $lt: number | Date;\n $lte: number | Date;\n};\n\ntype PineconeOperatorValueMap = InitialOperatorValueMap & {\n $all: OperatorCondition<keyof InitialOperatorValueMap, InitialOperatorValueMap>[] | FilterValue[];\n};\ntype PineconeLogicalOperatorValueMap = Omit<LogicalOperatorValueMap, '$not' | '$nor'>;\n\ntype PineconeBlacklisted = BlacklistedRootOperators | '$not' | '$nor';\n\nexport type PineconeVectorFilter = VectorFilter<\n keyof PineconeOperatorValueMap,\n PineconeOperatorValueMap,\n PineconeLogicalOperatorValueMap,\n PineconeBlacklisted\n>;\n\nexport class PineconeFilterTranslator extends BaseFilterTranslator<PineconeVectorFilter> {\n protected override getSupportedOperators(): OperatorSupport {\n return {\n ...BaseFilterTranslator.DEFAULT_OPERATORS,\n logical: ['$and', '$or'],\n array: ['$in', '$all', '$nin'],\n element: ['$exists'],\n regex: [],\n custom: [],\n };\n }\n\n translate(filter?: PineconeVectorFilter): PineconeVectorFilter {\n if (this.isEmpty(filter)) return filter;\n this.validateFilter(filter);\n return this.translateNode(filter);\n }\n\n private translateNode(node: PineconeVectorFilter, currentPath: string = ''): any {\n if (this.isRegex(node)) {\n throw new Error('Regex is not supported in Pinecone');\n }\n if (this.isPrimitive(node)) return this.normalizeComparisonValue(node);\n if (Array.isArray(node)) return { $in: this.normalizeArrayValues(node) };\n\n const entries = Object.entries(node as Record<string, any>);\n const firstEntry = entries[0];\n\n // Handle single operator case\n if (entries.length === 1 && firstEntry && this.isOperator(firstEntry[0])) {\n const [operator, value] = firstEntry;\n const translated = this.translateOperator(operator, value, currentPath);\n return this.isLogicalOperator(operator) ? { [operator]: translated } : translated;\n }\n\n // Process each entry\n const result: Record<string, any> = {};\n\n for (const [key, value] of entries) {\n const newPath = currentPath ? `${currentPath}.${key}` : key;\n\n if (this.isOperator(key)) {\n result[key] = this.translateOperator(key, value, currentPath);\n continue;\n }\n\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n // Handle nested $all\n if (Object.keys(value).length === 1 && '$all' in value) {\n const translated = this.translateNode(value, key);\n if (translated.$and) {\n return translated;\n }\n }\n\n // Check if the nested object contains operators\n if (Object.keys(value).length === 0) {\n result[newPath] = this.translateNode(value);\n } else {\n const hasOperators = Object.keys(value).some(k => this.isOperator(k));\n if (hasOperators) {\n // For objects with operators, normalize each operator value\n const normalizedValue: Record<string, any> = {};\n for (const [op, opValue] of Object.entries(value)) {\n normalizedValue[op] = this.isOperator(op) ? this.translateOperator(op, opValue) : opValue;\n }\n result[newPath] = normalizedValue;\n } else {\n // For objects without operators, flatten them\n Object.assign(result, this.translateNode(value, newPath));\n }\n }\n } else {\n result[newPath] = this.translateNode(value);\n }\n }\n\n return result;\n }\n\n private translateOperator(operator: QueryOperator, value: any, currentPath: string = ''): any {\n // Handle $all specially\n if (operator === '$all') {\n if (!Array.isArray(value) || value.length === 0) {\n throw new Error('A non-empty array is required for the $all operator');\n }\n\n return this.simulateAllOperator(currentPath, value);\n }\n\n // Handle logical operators\n if (this.isLogicalOperator(operator)) {\n return Array.isArray(value) ? value.map(item => this.translateNode(item)) : this.translateNode(value);\n }\n\n // Handle comparison and element operators\n return this.normalizeComparisonValue(value);\n }\n}\n","import { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\nimport { createVectorErrorId } from '@mastra/core/storage';\nimport { MastraVector } from '@mastra/core/vector';\nimport type {\n QueryResult,\n IndexStats,\n CreateIndexParams,\n UpsertVectorParams,\n QueryVectorParams,\n DescribeIndexParams,\n DeleteIndexParams,\n DeleteVectorParams,\n DeleteVectorsParams,\n} from '@mastra/core/vector';\nimport { Pinecone } from '@pinecone-database/pinecone';\nimport type {\n IndexStatsDescription,\n QueryOptions,\n RecordSparseValues,\n ServerlessSpecCloudEnum,\n UpdateOptions,\n} from '@pinecone-database/pinecone';\n\nimport { PineconeFilterTranslator } from './filter';\nimport type { PineconeVectorFilter } from './filter';\n\ninterface PineconeIndexStats extends IndexStats {\n namespaces?: IndexStatsDescription['namespaces'];\n}\n\ninterface PineconeQueryVectorParams extends QueryVectorParams<PineconeVectorFilter> {\n namespace?: string;\n sparseVector?: RecordSparseValues;\n}\n\ninterface PineconeUpsertVectorParams extends UpsertVectorParams {\n namespace?: string;\n sparseVectors?: RecordSparseValues[];\n}\n\n// Pinecone-specific update params that includes namespace in both union branches\ntype PineconeUpdateVectorParams =\n | {\n indexName: string;\n id: string;\n filter?: never;\n update: { vector?: number[]; metadata?: Record<string, any> };\n namespace?: string;\n }\n | {\n indexName: string;\n id?: never;\n filter: PineconeVectorFilter;\n update: { vector?: number[]; metadata?: Record<string, any> };\n namespace?: string;\n };\n\ninterface PineconeDeleteVectorParams extends DeleteVectorParams {\n namespace?: string;\n}\n\ninterface PineconeDeleteVectorsParams extends DeleteVectorsParams<PineconeVectorFilter> {\n namespace?: string;\n}\n\nexport class PineconeVector extends MastraVector<PineconeVectorFilter> {\n private client: Pinecone;\n private cloud: ServerlessSpecCloudEnum;\n private region: string;\n\n /**\n * Creates a new PineconeVector client.\n * @param id - The unique identifier for this vector store instance.\n * @param apiKey - The API key for Pinecone.\n * @param environment - The environment for Pinecone.\n * @param cloud - The cloud provider for Pinecone.\n * @param region - The region for Pinecone.\n */\n constructor({\n id,\n apiKey,\n environment,\n cloud,\n region,\n }: {\n id: string;\n apiKey: string;\n environment?: string;\n region?: string;\n cloud?: ServerlessSpecCloudEnum;\n }) {\n super({ id });\n const opts: { apiKey: string; controllerHostUrl?: string } = { apiKey };\n if (environment) {\n opts['controllerHostUrl'] = environment;\n }\n this.client = new Pinecone(opts);\n this.cloud = cloud || 'aws';\n this.region = region || 'us-east-1';\n }\n\n get indexSeparator(): string {\n return '-';\n }\n\n async createIndex({ indexName, dimension, metric = 'cosine' }: CreateIndexParams): Promise<void> {\n try {\n if (!Number.isInteger(dimension) || dimension <= 0) {\n throw new Error('Dimension must be a positive integer');\n }\n if (metric && !['cosine', 'euclidean', 'dotproduct'].includes(metric)) {\n throw new Error('Metric must be one of: cosine, euclidean, dotproduct');\n }\n } catch (validationError) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'CREATE_INDEX', 'INVALID_ARGS'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName, dimension, metric },\n },\n validationError,\n );\n }\n\n try {\n await this.client.createIndex({\n name: indexName,\n dimension: dimension,\n metric: metric,\n spec: {\n serverless: {\n cloud: this.cloud,\n region: this.region,\n },\n },\n });\n } catch (error: any) {\n // Check for 'already exists' error\n const message = error?.errors?.[0]?.message || error?.message;\n if (\n error.status === 409 ||\n (typeof message === 'string' &&\n (message.toLowerCase().includes('already exists') || message.toLowerCase().includes('duplicate')))\n ) {\n // Fetch index info and check dimensions\n await this.validateExistingIndex(indexName, dimension, metric);\n return;\n }\n // For any other errors, wrap in MastraError\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'CREATE_INDEX', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, dimension, metric },\n },\n error,\n );\n }\n }\n\n async upsert({\n indexName,\n vectors,\n metadata,\n ids,\n namespace,\n sparseVectors,\n }: PineconeUpsertVectorParams): Promise<string[]> {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n // Generate IDs if not provided\n const vectorIds = ids || vectors.map(() => crypto.randomUUID());\n\n const records = vectors.map((vector, i) => ({\n id: vectorIds[i]!,\n values: vector,\n ...(sparseVectors?.[i] && { sparseValues: sparseVectors?.[i] }),\n metadata: metadata?.[i] || {},\n }));\n\n // Pinecone has a limit of 100 vectors per upsert request\n const batchSize = 100;\n try {\n for (let i = 0; i < records.length; i += batchSize) {\n const batch = records.slice(i, i + batchSize);\n await index.upsert(batch);\n }\n\n return vectorIds;\n } catch (error) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'UPSERT', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, vectorCount: vectors.length },\n },\n error,\n );\n }\n }\n\n transformFilter(filter?: PineconeVectorFilter) {\n const translator = new PineconeFilterTranslator();\n return translator.translate(filter);\n }\n\n async query({\n indexName,\n queryVector,\n topK = 10,\n filter,\n includeVector = false,\n namespace,\n sparseVector,\n }: PineconeQueryVectorParams): Promise<QueryResult[]> {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n const translatedFilter = this.transformFilter(filter) ?? undefined;\n\n const queryParams: QueryOptions = {\n vector: queryVector,\n topK,\n includeMetadata: true,\n includeValues: includeVector,\n filter: translatedFilter,\n };\n\n // If sparse vector is provided, use hybrid search\n if (sparseVector) {\n queryParams.sparseVector = sparseVector;\n }\n\n try {\n const results = await index.query(queryParams);\n\n return results.matches.map(match => ({\n id: match.id,\n score: match.score || 0,\n metadata: match.metadata as Record<string, any>,\n ...(includeVector && { vector: match.values || [] }),\n }));\n } catch (error) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'QUERY', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, topK },\n },\n error,\n );\n }\n }\n\n async listIndexes(): Promise<string[]> {\n try {\n const indexesResult = await this.client.listIndexes();\n return indexesResult?.indexes?.map(index => index.name) || [];\n } catch (error) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'LIST_INDEXES', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n },\n error,\n );\n }\n }\n\n /**\n * Retrieves statistics about a vector index.\n *\n * @param {string} indexName - The name of the index to describe\n * @returns A promise that resolves to the index statistics including dimension, count and metric\n */\n async describeIndex({ indexName }: DescribeIndexParams): Promise<PineconeIndexStats> {\n try {\n const index = this.client.Index(indexName);\n const stats = await index.describeIndexStats();\n const description = await this.client.describeIndex(indexName);\n\n return {\n dimension: description.dimension,\n count: stats.totalRecordCount || 0,\n metric: description.metric as 'cosine' | 'euclidean' | 'dotproduct',\n namespaces: stats.namespaces,\n };\n } catch (error) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'DESCRIBE_INDEX', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName },\n },\n error,\n );\n }\n }\n\n async deleteIndex({ indexName }: DeleteIndexParams): Promise<void> {\n try {\n await this.client.deleteIndex(indexName);\n } catch (error) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'DELETE_INDEX', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName },\n },\n error,\n );\n }\n }\n\n /**\n * Updates a vector by its ID with the provided vector and/or metadata.\n * Note: Pinecone only supports update by ID, not by filter.\n * @param params - Parameters containing the id for targeting the vector to update\n * @param params.indexName - The name of the index containing the vector.\n * @param params.id - The ID of the vector to update.\n * @param params.update - An object containing the vector and/or metadata to update.\n * @param namespace - The namespace of the index (optional, Pinecone-specific).\n * @returns A promise that resolves when the update is complete.\n * @throws Will throw an error if no updates are provided or if the update operation fails.\n */\n async updateVector(params: PineconeUpdateVectorParams): Promise<void> {\n const { indexName, update } = params;\n\n // Validate mutually exclusive parameters\n if ('id' in params && params.id && 'filter' in params && params.filter) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'UPDATE_VECTOR', 'MUTUALLY_EXCLUSIVE'),\n text: 'Cannot specify both id and filter - they are mutually exclusive',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n if (!('id' in params && params.id) && !('filter' in params && params.filter)) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'UPDATE_VECTOR', 'NO_TARGET'),\n text: 'Either id or filter must be provided',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n if (!update.vector && !update.metadata) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'UPDATE_VECTOR', 'NO_PAYLOAD'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n text: 'No updates provided',\n details: { indexName },\n });\n }\n\n // Extract Pinecone-specific namespace field\n const namespace = params.namespace;\n\n try {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n // Handle update by ID\n if ('id' in params && params.id) {\n const updateObj: UpdateOptions = { id: params.id };\n\n if (update.vector) {\n updateObj.values = update.vector;\n }\n\n if (update.metadata) {\n updateObj.metadata = update.metadata;\n }\n\n await index.update(updateObj);\n }\n // Handle update by filter (query first, then update each)\n else if ('filter' in params && params.filter) {\n // Validate filter is not empty\n if (Object.keys(params.filter).length === 0) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'UPDATE_VECTOR', 'EMPTY_FILTER'),\n text: 'Filter cannot be an empty filter object',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n const translatedFilter = this.transformFilter(params.filter);\n if (translatedFilter) {\n // Get index stats to know dimensions for dummy vector\n const stats = await this.describeIndex({ indexName });\n\n // Create a normalized dummy vector for querying (avoid zero vector for cosine similarity)\n const dummyVector = new Array(stats.dimension).fill(1 / Math.sqrt(stats.dimension));\n\n // Query with large topK to get all matching vectors\n // Pinecone's max topK is 10000\n const results = await index.query({\n vector: dummyVector,\n topK: 10000,\n filter: translatedFilter,\n includeMetadata: false,\n includeValues: false,\n });\n\n // Update each matching vector\n const idsToUpdate = results.matches.map(m => m.id as string);\n for (const id of idsToUpdate) {\n const updateObj: UpdateOptions = { id };\n\n if (update.vector) {\n updateObj.values = update.vector;\n }\n\n if (update.metadata) {\n updateObj.metadata = update.metadata;\n }\n\n await index.update(updateObj);\n }\n }\n }\n } catch (error) {\n if (error instanceof MastraError) throw error;\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'UPDATE_VECTOR', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n ...('id' in params && params.id && { id: params.id }),\n ...('filter' in params && params.filter && { filter: JSON.stringify(params.filter) }),\n },\n },\n error,\n );\n }\n }\n\n /**\n * Deletes a vector by its ID.\n * @param indexName - The name of the index containing the vector.\n * @param id - The ID of the vector to delete.\n * @param namespace - The namespace of the index (optional).\n * @returns A promise that resolves when the deletion is complete.\n * @throws Will throw an error if the deletion operation fails.\n */\n async deleteVector({ indexName, id, namespace }: PineconeDeleteVectorParams): Promise<void> {\n try {\n const index = this.client.Index(indexName).namespace(namespace || '');\n await index.deleteOne(id);\n } catch (error) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'DELETE_VECTOR', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n ...(id && { id }),\n },\n },\n error,\n );\n }\n }\n\n /**\n * Deletes multiple vectors by IDs or filter.\n * @param indexName - The name of the index containing the vectors.\n * @param ids - Array of vector IDs to delete (mutually exclusive with filter).\n * @param filter - Filter to match vectors to delete (mutually exclusive with ids).\n * @param namespace - The namespace of the index (optional, Pinecone-specific).\n * @returns A promise that resolves when the deletion is complete.\n * @throws Will throw an error if both ids and filter are provided, or if neither is provided.\n */\n async deleteVectors(params: PineconeDeleteVectorsParams): Promise<void> {\n const { indexName, filter, ids } = params;\n const namespace = params.namespace;\n\n // Validate mutually exclusive parameters\n if (ids && filter) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'DELETE_VECTORS', 'MUTUALLY_EXCLUSIVE'),\n text: 'Cannot specify both ids and filter - they are mutually exclusive',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n if (!ids && !filter) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'DELETE_VECTORS', 'NO_TARGET'),\n text: 'Either filter or ids must be provided',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n // Validate ids array is not empty\n if (ids && ids.length === 0) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'DELETE_VECTORS', 'EMPTY_IDS'),\n text: 'Cannot delete with empty ids array',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n // Validate filter is not empty\n if (filter && Object.keys(filter).length === 0) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'DELETE_VECTORS', 'EMPTY_FILTER'),\n text: 'Cannot delete with empty filter object',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n try {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n if (ids) {\n // Delete by IDs - Pinecone's deleteMany accepts an array of IDs\n await index.deleteMany(ids);\n } else if (filter) {\n // Delete by filter - Pinecone's deleteMany doesn't properly support metadata filters\n // We need to query for matching IDs first, then delete them\n const translatedFilter = this.transformFilter(filter);\n if (translatedFilter) {\n // Get index stats to know dimensions for dummy vector\n const stats = await this.describeIndex({ indexName });\n\n // Create a normalized dummy vector for querying (avoid zero vector for cosine similarity)\n const dummyVector = new Array(stats.dimension).fill(1 / Math.sqrt(stats.dimension));\n\n // Query with large topK to get all matching vectors\n // Pinecone's max topK is 10000\n const results = await index.query({\n vector: dummyVector,\n topK: 10000,\n filter: translatedFilter,\n includeMetadata: false,\n includeValues: false,\n });\n\n // Extract IDs and delete them\n const idsToDelete = results.matches.map(m => m.id as string);\n if (idsToDelete.length > 0) {\n await index.deleteMany(idsToDelete);\n }\n }\n }\n } catch (error) {\n if (error instanceof MastraError) throw error;\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'DELETE_VECTORS', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n ...(filter && { filter: JSON.stringify(filter) }),\n ...(ids && { idsCount: ids.length }),\n },\n },\n error,\n );\n }\n }\n}\n","/**\n * Vector store specific prompt that details supported operators and examples.\n * This prompt helps users construct valid filters for Pinecone Vector.\n */\nexport const PINECONE_PROMPT = `When querying Pinecone, you can ONLY use the operators listed below. Any other operators will be rejected.\nImportant: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.\nIf a user tries to give an explicit operator that is not supported, reject the filter entirely and let them know that the operator is not supported.\n\nBasic Comparison Operators:\n- $eq: Exact match (default when using field: value)\n Example: { \"category\": \"electronics\" }\n- $ne: Not equal\n Example: { \"category\": { \"$ne\": \"electronics\" } }\n- $gt: Greater than\n Example: { \"price\": { \"$gt\": 100 } }\n- $gte: Greater than or equal\n Example: { \"price\": { \"$gte\": 100 } }\n- $lt: Less than\n Example: { \"price\": { \"$lt\": 100 } }\n- $lte: Less than or equal\n Example: { \"price\": { \"$lte\": 100 } }\n\nArray Operators:\n- $in: Match any value in array\n Example: { \"category\": { \"$in\": [\"electronics\", \"books\"] } }\n- $nin: Does not match any value in array\n Example: { \"category\": { \"$nin\": [\"electronics\", \"books\"] } }\n- $all: Match all values in array\n Example: { \"tags\": { \"$all\": [\"premium\", \"sale\"] } }\n\nLogical Operators:\n- $and: Logical AND (can be implicit or explicit)\n Implicit Example: { \"price\": { \"$gt\": 100 }, \"category\": \"electronics\" }\n Explicit Example: { \"$and\": [{ \"price\": { \"$gt\": 100 } }, { \"category\": \"electronics\" }] }\n- $or: Logical OR\n Example: { \"$or\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n\nElement Operators:\n- $exists: Check if field exists\n Example: { \"rating\": { \"$exists\": true } }\n\nRestrictions:\n- Regex patterns are not supported\n- Only $and and $or logical operators are supported at the top level\n- Empty arrays in $in/$nin will return no results\n- A non-empty array is required for $all operator\n- Nested fields are supported using dot notation\n- Multiple conditions on the same field are supported with both implicit and explicit $and\n- At least one key-value pair is required in filter object\n- Empty objects and undefined values are treated as no filter\n- Invalid types in comparison operators will throw errors\n- All non-logical operators must be used within a field condition\n Valid: { \"field\": { \"$gt\": 100 } }\n Valid: { \"$and\": [...] }\n Invalid: { \"$gt\": 100 }\n- Logical operators must contain field conditions, not direct operators\n Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n Invalid: { \"$and\": [{ \"$gt\": 100 }] }\n- Logical operators ($and, $or):\n - Can only be used at top level or nested within other logical operators\n - Can not be used on a field level, or be nested inside a field\n - Can not be used inside an operator\n - Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n - Valid: { \"$or\": [{ \"$and\": [{ \"field\": { \"$gt\": 100 } }] }] }\n - Invalid: { \"field\": { \"$and\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$or\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$gt\": { \"$and\": [{...}] } } }\n\nExample Complex Query:\n{\n \"$and\": [\n { \"category\": { \"$in\": [\"electronics\", \"computers\"] } },\n { \"price\": { \"$gte\": 100, \"$lte\": 1000 } },\n { \"tags\": { \"$all\": [\"premium\", \"sale\"] } },\n { \"rating\": { \"$exists\": true, \"$gt\": 4 } },\n { \"$or\": [\n { \"stock\": { \"$gt\": 0 } },\n { \"preorder\": true }\n ]}\n ]\n}`;\n"]}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
2
+ import { createVectorErrorId } from '@mastra/core/storage';
2
3
  import { MastraVector } from '@mastra/core/vector';
3
4
  import { Pinecone } from '@pinecone-database/pinecone';
4
5
  import { BaseFilterTranslator } from '@mastra/core/vector/filter';
@@ -124,7 +125,7 @@ var PineconeVector = class extends MastraVector {
124
125
  } catch (validationError) {
125
126
  throw new MastraError(
126
127
  {
127
- id: "STORAGE_PINECONE_VECTOR_CREATE_INDEX_INVALID_ARGS",
128
+ id: createVectorErrorId("PINECONE", "CREATE_INDEX", "INVALID_ARGS"),
128
129
  domain: ErrorDomain.STORAGE,
129
130
  category: ErrorCategory.USER,
130
131
  details: { indexName, dimension, metric }
@@ -152,7 +153,7 @@ var PineconeVector = class extends MastraVector {
152
153
  }
153
154
  throw new MastraError(
154
155
  {
155
- id: "STORAGE_PINECONE_VECTOR_CREATE_INDEX_FAILED",
156
+ id: createVectorErrorId("PINECONE", "CREATE_INDEX", "FAILED"),
156
157
  domain: ErrorDomain.STORAGE,
157
158
  category: ErrorCategory.THIRD_PARTY,
158
159
  details: { indexName, dimension, metric }
@@ -187,7 +188,7 @@ var PineconeVector = class extends MastraVector {
187
188
  } catch (error) {
188
189
  throw new MastraError(
189
190
  {
190
- id: "STORAGE_PINECONE_VECTOR_UPSERT_FAILED",
191
+ id: createVectorErrorId("PINECONE", "UPSERT", "FAILED"),
191
192
  domain: ErrorDomain.STORAGE,
192
193
  category: ErrorCategory.THIRD_PARTY,
193
194
  details: { indexName, vectorCount: vectors.length }
@@ -232,7 +233,7 @@ var PineconeVector = class extends MastraVector {
232
233
  } catch (error) {
233
234
  throw new MastraError(
234
235
  {
235
- id: "STORAGE_PINECONE_VECTOR_QUERY_FAILED",
236
+ id: createVectorErrorId("PINECONE", "QUERY", "FAILED"),
236
237
  domain: ErrorDomain.STORAGE,
237
238
  category: ErrorCategory.THIRD_PARTY,
238
239
  details: { indexName, topK }
@@ -248,7 +249,7 @@ var PineconeVector = class extends MastraVector {
248
249
  } catch (error) {
249
250
  throw new MastraError(
250
251
  {
251
- id: "STORAGE_PINECONE_VECTOR_LIST_INDEXES_FAILED",
252
+ id: createVectorErrorId("PINECONE", "LIST_INDEXES", "FAILED"),
252
253
  domain: ErrorDomain.STORAGE,
253
254
  category: ErrorCategory.THIRD_PARTY
254
255
  },
@@ -276,7 +277,7 @@ var PineconeVector = class extends MastraVector {
276
277
  } catch (error) {
277
278
  throw new MastraError(
278
279
  {
279
- id: "STORAGE_PINECONE_VECTOR_DESCRIBE_INDEX_FAILED",
280
+ id: createVectorErrorId("PINECONE", "DESCRIBE_INDEX", "FAILED"),
280
281
  domain: ErrorDomain.STORAGE,
281
282
  category: ErrorCategory.THIRD_PARTY,
282
283
  details: { indexName }
@@ -291,7 +292,7 @@ var PineconeVector = class extends MastraVector {
291
292
  } catch (error) {
292
293
  throw new MastraError(
293
294
  {
294
- id: "STORAGE_PINECONE_VECTOR_DELETE_INDEX_FAILED",
295
+ id: createVectorErrorId("PINECONE", "DELETE_INDEX", "FAILED"),
295
296
  domain: ErrorDomain.STORAGE,
296
297
  category: ErrorCategory.THIRD_PARTY,
297
298
  details: { indexName }
@@ -302,42 +303,102 @@ var PineconeVector = class extends MastraVector {
302
303
  }
303
304
  /**
304
305
  * Updates a vector by its ID with the provided vector and/or metadata.
305
- * @param indexName - The name of the index containing the vector.
306
- * @param id - The ID of the vector to update.
307
- * @param update - An object containing the vector and/or metadata to update.
308
- * @param update.vector - An optional array of numbers representing the new vector.
309
- * @param update.metadata - An optional record containing the new metadata.
310
- * @param namespace - The namespace of the index (optional).
306
+ * Note: Pinecone only supports update by ID, not by filter.
307
+ * @param params - Parameters containing the id for targeting the vector to update
308
+ * @param params.indexName - The name of the index containing the vector.
309
+ * @param params.id - The ID of the vector to update.
310
+ * @param params.update - An object containing the vector and/or metadata to update.
311
+ * @param namespace - The namespace of the index (optional, Pinecone-specific).
311
312
  * @returns A promise that resolves when the update is complete.
312
313
  * @throws Will throw an error if no updates are provided or if the update operation fails.
313
314
  */
314
- async updateVector({ indexName, id, update, namespace }) {
315
+ async updateVector(params) {
316
+ const { indexName, update } = params;
317
+ if ("id" in params && params.id && "filter" in params && params.filter) {
318
+ throw new MastraError({
319
+ id: createVectorErrorId("PINECONE", "UPDATE_VECTOR", "MUTUALLY_EXCLUSIVE"),
320
+ text: "Cannot specify both id and filter - they are mutually exclusive",
321
+ domain: ErrorDomain.STORAGE,
322
+ category: ErrorCategory.USER,
323
+ details: { indexName }
324
+ });
325
+ }
326
+ if (!("id" in params && params.id) && !("filter" in params && params.filter)) {
327
+ throw new MastraError({
328
+ id: createVectorErrorId("PINECONE", "UPDATE_VECTOR", "NO_TARGET"),
329
+ text: "Either id or filter must be provided",
330
+ domain: ErrorDomain.STORAGE,
331
+ category: ErrorCategory.USER,
332
+ details: { indexName }
333
+ });
334
+ }
315
335
  if (!update.vector && !update.metadata) {
316
336
  throw new MastraError({
317
- id: "STORAGE_PINECONE_VECTOR_UPDATE_VECTOR_INVALID_ARGS",
337
+ id: createVectorErrorId("PINECONE", "UPDATE_VECTOR", "NO_PAYLOAD"),
318
338
  domain: ErrorDomain.STORAGE,
319
339
  category: ErrorCategory.USER,
320
340
  text: "No updates provided",
321
- details: { indexName, id }
341
+ details: { indexName }
322
342
  });
323
343
  }
344
+ const namespace = params.namespace;
324
345
  try {
325
346
  const index = this.client.Index(indexName).namespace(namespace || "");
326
- const updateObj = { id };
327
- if (update.vector) {
328
- updateObj.values = update.vector;
329
- }
330
- if (update.metadata) {
331
- updateObj.metadata = update.metadata;
347
+ if ("id" in params && params.id) {
348
+ const updateObj = { id: params.id };
349
+ if (update.vector) {
350
+ updateObj.values = update.vector;
351
+ }
352
+ if (update.metadata) {
353
+ updateObj.metadata = update.metadata;
354
+ }
355
+ await index.update(updateObj);
356
+ } else if ("filter" in params && params.filter) {
357
+ if (Object.keys(params.filter).length === 0) {
358
+ throw new MastraError({
359
+ id: createVectorErrorId("PINECONE", "UPDATE_VECTOR", "EMPTY_FILTER"),
360
+ text: "Filter cannot be an empty filter object",
361
+ domain: ErrorDomain.STORAGE,
362
+ category: ErrorCategory.USER,
363
+ details: { indexName }
364
+ });
365
+ }
366
+ const translatedFilter = this.transformFilter(params.filter);
367
+ if (translatedFilter) {
368
+ const stats = await this.describeIndex({ indexName });
369
+ const dummyVector = new Array(stats.dimension).fill(1 / Math.sqrt(stats.dimension));
370
+ const results = await index.query({
371
+ vector: dummyVector,
372
+ topK: 1e4,
373
+ filter: translatedFilter,
374
+ includeMetadata: false,
375
+ includeValues: false
376
+ });
377
+ const idsToUpdate = results.matches.map((m) => m.id);
378
+ for (const id of idsToUpdate) {
379
+ const updateObj = { id };
380
+ if (update.vector) {
381
+ updateObj.values = update.vector;
382
+ }
383
+ if (update.metadata) {
384
+ updateObj.metadata = update.metadata;
385
+ }
386
+ await index.update(updateObj);
387
+ }
388
+ }
332
389
  }
333
- await index.update(updateObj);
334
390
  } catch (error) {
391
+ if (error instanceof MastraError) throw error;
335
392
  throw new MastraError(
336
393
  {
337
- id: "STORAGE_PINECONE_VECTOR_UPDATE_VECTOR_FAILED",
394
+ id: createVectorErrorId("PINECONE", "UPDATE_VECTOR", "FAILED"),
338
395
  domain: ErrorDomain.STORAGE,
339
396
  category: ErrorCategory.THIRD_PARTY,
340
- details: { indexName, id }
397
+ details: {
398
+ indexName,
399
+ ..."id" in params && params.id && { id: params.id },
400
+ ..."filter" in params && params.filter && { filter: JSON.stringify(params.filter) }
401
+ }
341
402
  },
342
403
  error
343
404
  );
@@ -358,10 +419,100 @@ var PineconeVector = class extends MastraVector {
358
419
  } catch (error) {
359
420
  throw new MastraError(
360
421
  {
361
- id: "STORAGE_PINECONE_VECTOR_DELETE_VECTOR_FAILED",
422
+ id: createVectorErrorId("PINECONE", "DELETE_VECTOR", "FAILED"),
362
423
  domain: ErrorDomain.STORAGE,
363
424
  category: ErrorCategory.THIRD_PARTY,
364
- details: { indexName, id }
425
+ details: {
426
+ indexName,
427
+ ...id && { id }
428
+ }
429
+ },
430
+ error
431
+ );
432
+ }
433
+ }
434
+ /**
435
+ * Deletes multiple vectors by IDs or filter.
436
+ * @param indexName - The name of the index containing the vectors.
437
+ * @param ids - Array of vector IDs to delete (mutually exclusive with filter).
438
+ * @param filter - Filter to match vectors to delete (mutually exclusive with ids).
439
+ * @param namespace - The namespace of the index (optional, Pinecone-specific).
440
+ * @returns A promise that resolves when the deletion is complete.
441
+ * @throws Will throw an error if both ids and filter are provided, or if neither is provided.
442
+ */
443
+ async deleteVectors(params) {
444
+ const { indexName, filter, ids } = params;
445
+ const namespace = params.namespace;
446
+ if (ids && filter) {
447
+ throw new MastraError({
448
+ id: createVectorErrorId("PINECONE", "DELETE_VECTORS", "MUTUALLY_EXCLUSIVE"),
449
+ text: "Cannot specify both ids and filter - they are mutually exclusive",
450
+ domain: ErrorDomain.STORAGE,
451
+ category: ErrorCategory.USER,
452
+ details: { indexName }
453
+ });
454
+ }
455
+ if (!ids && !filter) {
456
+ throw new MastraError({
457
+ id: createVectorErrorId("PINECONE", "DELETE_VECTORS", "NO_TARGET"),
458
+ text: "Either filter or ids must be provided",
459
+ domain: ErrorDomain.STORAGE,
460
+ category: ErrorCategory.USER,
461
+ details: { indexName }
462
+ });
463
+ }
464
+ if (ids && ids.length === 0) {
465
+ throw new MastraError({
466
+ id: createVectorErrorId("PINECONE", "DELETE_VECTORS", "EMPTY_IDS"),
467
+ text: "Cannot delete with empty ids array",
468
+ domain: ErrorDomain.STORAGE,
469
+ category: ErrorCategory.USER,
470
+ details: { indexName }
471
+ });
472
+ }
473
+ if (filter && Object.keys(filter).length === 0) {
474
+ throw new MastraError({
475
+ id: createVectorErrorId("PINECONE", "DELETE_VECTORS", "EMPTY_FILTER"),
476
+ text: "Cannot delete with empty filter object",
477
+ domain: ErrorDomain.STORAGE,
478
+ category: ErrorCategory.USER,
479
+ details: { indexName }
480
+ });
481
+ }
482
+ try {
483
+ const index = this.client.Index(indexName).namespace(namespace || "");
484
+ if (ids) {
485
+ await index.deleteMany(ids);
486
+ } else if (filter) {
487
+ const translatedFilter = this.transformFilter(filter);
488
+ if (translatedFilter) {
489
+ const stats = await this.describeIndex({ indexName });
490
+ const dummyVector = new Array(stats.dimension).fill(1 / Math.sqrt(stats.dimension));
491
+ const results = await index.query({
492
+ vector: dummyVector,
493
+ topK: 1e4,
494
+ filter: translatedFilter,
495
+ includeMetadata: false,
496
+ includeValues: false
497
+ });
498
+ const idsToDelete = results.matches.map((m) => m.id);
499
+ if (idsToDelete.length > 0) {
500
+ await index.deleteMany(idsToDelete);
501
+ }
502
+ }
503
+ }
504
+ } catch (error) {
505
+ if (error instanceof MastraError) throw error;
506
+ throw new MastraError(
507
+ {
508
+ id: createVectorErrorId("PINECONE", "DELETE_VECTORS", "FAILED"),
509
+ domain: ErrorDomain.STORAGE,
510
+ category: ErrorCategory.THIRD_PARTY,
511
+ details: {
512
+ indexName,
513
+ ...filter && { filter: JSON.stringify(filter) },
514
+ ...ids && { idsCount: ids.length }
515
+ }
365
516
  },
366
517
  error
367
518
  );
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/vector/filter.ts","../src/vector/index.ts","../src/vector/prompt.ts"],"names":[],"mappings":";;;;;;AAkCO,IAAM,wBAAA,GAAN,cAAuC,oBAAA,CAA2C;AAAA,EACpE,qBAAA,GAAyC;AAC1D,IAAA,OAAO;AAAA,MACL,GAAG,oBAAA,CAAqB,iBAAA;AAAA,MACxB,OAAA,EAAS,CAAC,MAAA,EAAQ,KAAK,CAAA;AAAA,MACvB,KAAA,EAAO,CAAC,KAAA,EAAO,MAAA,EAAQ,MAAM,CAAA;AAAA,MAC7B,OAAA,EAAS,CAAC,SAAS,CAAA;AAAA,MACnB,OAAO,EAAC;AAAA,MACR,QAAQ;AAAC,KACX;AAAA,EACF;AAAA,EAEA,UAAU,MAAA,EAAqD;AAC7D,IAAA,IAAI,IAAA,CAAK,OAAA,CAAQ,MAAM,CAAA,EAAG,OAAO,MAAA;AACjC,IAAA,IAAA,CAAK,eAAe,MAAM,CAAA;AAC1B,IAAA,OAAO,IAAA,CAAK,cAAc,MAAM,CAAA;AAAA,EAClC;AAAA,EAEQ,aAAA,CAAc,IAAA,EAA4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,QACA;AAAA,OACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,YAAA,CAAa,EAAE,SAAA,EAAW,EAAA,EAAI,WAAU,EAA8C;AAC1F,IAAA,IAAI;AACF,MAAA,MAAM,KAAA,GAAQ,KAAK,MAAA,CAAO,KAAA,CAAM,SAAS,CAAA,CAAE,SAAA,CAAU,aAAa,EAAE,CAAA;AACpE,MAAA,MAAM,KAAA,CAAM,UAAU,EAAE,CAAA;AAAA,IAC1B,SAAS,KAAA,EAAO;AACd,MAAA,MAAM,IAAI,WAAA;AAAA,QACR;AAAA,UACE,EAAA,EAAI,8CAAA;AAAA,UACJ,QAAQ,WAAA,CAAY,OAAA;AAAA,UACpB,UAAU,aAAA,CAAc,WAAA;AAAA,UACxB,OAAA,EAAS,EAAE,SAAA,EAAW,EAAA;AAAG,SAC3B;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAAA,EACF;AACF;;;ACnXO,IAAM,eAAA,GAAkB,CAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA","file":"index.js","sourcesContent":["import { BaseFilterTranslator } from '@mastra/core/vector/filter';\nimport type {\n VectorFilter,\n OperatorSupport,\n OperatorValueMap,\n LogicalOperatorValueMap,\n BlacklistedRootOperators,\n QueryOperator,\n FilterValue,\n OperatorCondition,\n} from '@mastra/core/vector/filter';\n\ntype InitialOperatorValueMap = Omit<OperatorValueMap, '$regex' | '$options' | '$elemMatch' | '$all'> & {\n $contains: string;\n $gt: number | Date;\n $gte: number | Date;\n $lt: number | Date;\n $lte: number | Date;\n};\n\ntype PineconeOperatorValueMap = InitialOperatorValueMap & {\n $all: OperatorCondition<keyof InitialOperatorValueMap, InitialOperatorValueMap>[] | FilterValue[];\n};\ntype PineconeLogicalOperatorValueMap = Omit<LogicalOperatorValueMap, '$not' | '$nor'>;\n\ntype PineconeBlacklisted = BlacklistedRootOperators | '$not' | '$nor';\n\nexport type PineconeVectorFilter = VectorFilter<\n keyof PineconeOperatorValueMap,\n PineconeOperatorValueMap,\n PineconeLogicalOperatorValueMap,\n PineconeBlacklisted\n>;\n\nexport class PineconeFilterTranslator extends BaseFilterTranslator<PineconeVectorFilter> {\n protected override getSupportedOperators(): OperatorSupport {\n return {\n ...BaseFilterTranslator.DEFAULT_OPERATORS,\n logical: ['$and', '$or'],\n array: ['$in', '$all', '$nin'],\n element: ['$exists'],\n regex: [],\n custom: [],\n };\n }\n\n translate(filter?: PineconeVectorFilter): PineconeVectorFilter {\n if (this.isEmpty(filter)) return filter;\n this.validateFilter(filter);\n return this.translateNode(filter);\n }\n\n private translateNode(node: PineconeVectorFilter, currentPath: string = ''): any {\n if (this.isRegex(node)) {\n throw new Error('Regex is not supported in Pinecone');\n }\n if (this.isPrimitive(node)) return this.normalizeComparisonValue(node);\n if (Array.isArray(node)) return { $in: this.normalizeArrayValues(node) };\n\n const entries = Object.entries(node as Record<string, any>);\n const firstEntry = entries[0];\n\n // Handle single operator case\n if (entries.length === 1 && firstEntry && this.isOperator(firstEntry[0])) {\n const [operator, value] = firstEntry;\n const translated = this.translateOperator(operator, value, currentPath);\n return this.isLogicalOperator(operator) ? { [operator]: translated } : translated;\n }\n\n // Process each entry\n const result: Record<string, any> = {};\n\n for (const [key, value] of entries) {\n const newPath = currentPath ? `${currentPath}.${key}` : key;\n\n if (this.isOperator(key)) {\n result[key] = this.translateOperator(key, value, currentPath);\n continue;\n }\n\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n // Handle nested $all\n if (Object.keys(value).length === 1 && '$all' in value) {\n const translated = this.translateNode(value, key);\n if (translated.$and) {\n return translated;\n }\n }\n\n // Check if the nested object contains operators\n if (Object.keys(value).length === 0) {\n result[newPath] = this.translateNode(value);\n } else {\n const hasOperators = Object.keys(value).some(k => this.isOperator(k));\n if (hasOperators) {\n // For objects with operators, normalize each operator value\n const normalizedValue: Record<string, any> = {};\n for (const [op, opValue] of Object.entries(value)) {\n normalizedValue[op] = this.isOperator(op) ? this.translateOperator(op, opValue) : opValue;\n }\n result[newPath] = normalizedValue;\n } else {\n // For objects without operators, flatten them\n Object.assign(result, this.translateNode(value, newPath));\n }\n }\n } else {\n result[newPath] = this.translateNode(value);\n }\n }\n\n return result;\n }\n\n private translateOperator(operator: QueryOperator, value: any, currentPath: string = ''): any {\n // Handle $all specially\n if (operator === '$all') {\n if (!Array.isArray(value) || value.length === 0) {\n throw new Error('A non-empty array is required for the $all operator');\n }\n\n return this.simulateAllOperator(currentPath, value);\n }\n\n // Handle logical operators\n if (this.isLogicalOperator(operator)) {\n return Array.isArray(value) ? value.map(item => this.translateNode(item)) : this.translateNode(value);\n }\n\n // Handle comparison and element operators\n return this.normalizeComparisonValue(value);\n }\n}\n","import { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\nimport { MastraVector } from '@mastra/core/vector';\nimport type {\n QueryResult,\n IndexStats,\n CreateIndexParams,\n UpsertVectorParams,\n QueryVectorParams,\n DescribeIndexParams,\n DeleteIndexParams,\n DeleteVectorParams,\n UpdateVectorParams,\n} from '@mastra/core/vector';\nimport { Pinecone } from '@pinecone-database/pinecone';\nimport type {\n IndexStatsDescription,\n QueryOptions,\n RecordSparseValues,\n ServerlessSpecCloudEnum,\n UpdateOptions,\n} from '@pinecone-database/pinecone';\n\nimport { PineconeFilterTranslator } from './filter';\nimport type { PineconeVectorFilter } from './filter';\n\ninterface PineconeIndexStats extends IndexStats {\n namespaces?: IndexStatsDescription['namespaces'];\n}\n\ninterface PineconeQueryVectorParams extends QueryVectorParams<PineconeVectorFilter> {\n namespace?: string;\n sparseVector?: RecordSparseValues;\n}\n\ninterface PineconeUpsertVectorParams extends UpsertVectorParams {\n namespace?: string;\n sparseVectors?: RecordSparseValues[];\n}\n\ninterface PineconeUpdateVectorParams extends UpdateVectorParams {\n namespace?: string;\n}\n\ninterface PineconeDeleteVectorParams extends DeleteVectorParams {\n namespace?: string;\n}\n\nexport class PineconeVector extends MastraVector<PineconeVectorFilter> {\n private client: Pinecone;\n private cloud: ServerlessSpecCloudEnum;\n private region: string;\n\n /**\n * Creates a new PineconeVector client.\n * @param id - The unique identifier for this vector store instance.\n * @param apiKey - The API key for Pinecone.\n * @param environment - The environment for Pinecone.\n * @param cloud - The cloud provider for Pinecone.\n * @param region - The region for Pinecone.\n */\n constructor({\n id,\n apiKey,\n environment,\n cloud,\n region,\n }: {\n id: string;\n apiKey: string;\n environment?: string;\n region?: string;\n cloud?: ServerlessSpecCloudEnum;\n }) {\n super({ id });\n const opts: { apiKey: string; controllerHostUrl?: string } = { apiKey };\n if (environment) {\n opts['controllerHostUrl'] = environment;\n }\n this.client = new Pinecone(opts);\n this.cloud = cloud || 'aws';\n this.region = region || 'us-east-1';\n }\n\n get indexSeparator(): string {\n return '-';\n }\n\n async createIndex({ indexName, dimension, metric = 'cosine' }: CreateIndexParams): Promise<void> {\n try {\n if (!Number.isInteger(dimension) || dimension <= 0) {\n throw new Error('Dimension must be a positive integer');\n }\n if (metric && !['cosine', 'euclidean', 'dotproduct'].includes(metric)) {\n throw new Error('Metric must be one of: cosine, euclidean, dotproduct');\n }\n } catch (validationError) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_CREATE_INDEX_INVALID_ARGS',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName, dimension, metric },\n },\n validationError,\n );\n }\n\n try {\n await this.client.createIndex({\n name: indexName,\n dimension: dimension,\n metric: metric,\n spec: {\n serverless: {\n cloud: this.cloud,\n region: this.region,\n },\n },\n });\n } catch (error: any) {\n // Check for 'already exists' error\n const message = error?.errors?.[0]?.message || error?.message;\n if (\n error.status === 409 ||\n (typeof message === 'string' &&\n (message.toLowerCase().includes('already exists') || message.toLowerCase().includes('duplicate')))\n ) {\n // Fetch index info and check dimensions\n await this.validateExistingIndex(indexName, dimension, metric);\n return;\n }\n // For any other errors, wrap in MastraError\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_CREATE_INDEX_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, dimension, metric },\n },\n error,\n );\n }\n }\n\n async upsert({\n indexName,\n vectors,\n metadata,\n ids,\n namespace,\n sparseVectors,\n }: PineconeUpsertVectorParams): Promise<string[]> {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n // Generate IDs if not provided\n const vectorIds = ids || vectors.map(() => crypto.randomUUID());\n\n const records = vectors.map((vector, i) => ({\n id: vectorIds[i]!,\n values: vector,\n ...(sparseVectors?.[i] && { sparseValues: sparseVectors?.[i] }),\n metadata: metadata?.[i] || {},\n }));\n\n // Pinecone has a limit of 100 vectors per upsert request\n const batchSize = 100;\n try {\n for (let i = 0; i < records.length; i += batchSize) {\n const batch = records.slice(i, i + batchSize);\n await index.upsert(batch);\n }\n\n return vectorIds;\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_UPSERT_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, vectorCount: vectors.length },\n },\n error,\n );\n }\n }\n\n transformFilter(filter?: PineconeVectorFilter) {\n const translator = new PineconeFilterTranslator();\n return translator.translate(filter);\n }\n\n async query({\n indexName,\n queryVector,\n topK = 10,\n filter,\n includeVector = false,\n namespace,\n sparseVector,\n }: PineconeQueryVectorParams): Promise<QueryResult[]> {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n const translatedFilter = this.transformFilter(filter) ?? undefined;\n\n const queryParams: QueryOptions = {\n vector: queryVector,\n topK,\n includeMetadata: true,\n includeValues: includeVector,\n filter: translatedFilter,\n };\n\n // If sparse vector is provided, use hybrid search\n if (sparseVector) {\n queryParams.sparseVector = sparseVector;\n }\n\n try {\n const results = await index.query(queryParams);\n\n return results.matches.map(match => ({\n id: match.id,\n score: match.score || 0,\n metadata: match.metadata as Record<string, any>,\n ...(includeVector && { vector: match.values || [] }),\n }));\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_QUERY_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, topK },\n },\n error,\n );\n }\n }\n\n async listIndexes(): Promise<string[]> {\n try {\n const indexesResult = await this.client.listIndexes();\n return indexesResult?.indexes?.map(index => index.name) || [];\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_LIST_INDEXES_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n },\n error,\n );\n }\n }\n\n /**\n * Retrieves statistics about a vector index.\n *\n * @param {string} indexName - The name of the index to describe\n * @returns A promise that resolves to the index statistics including dimension, count and metric\n */\n async describeIndex({ indexName }: DescribeIndexParams): Promise<PineconeIndexStats> {\n try {\n const index = this.client.Index(indexName);\n const stats = await index.describeIndexStats();\n const description = await this.client.describeIndex(indexName);\n\n return {\n dimension: description.dimension,\n count: stats.totalRecordCount || 0,\n metric: description.metric as 'cosine' | 'euclidean' | 'dotproduct',\n namespaces: stats.namespaces,\n };\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_DESCRIBE_INDEX_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName },\n },\n error,\n );\n }\n }\n\n async deleteIndex({ indexName }: DeleteIndexParams): Promise<void> {\n try {\n await this.client.deleteIndex(indexName);\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_DELETE_INDEX_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName },\n },\n error,\n );\n }\n }\n\n /**\n * Updates a vector by its ID with the provided vector and/or metadata.\n * @param indexName - The name of the index containing the vector.\n * @param id - The ID of the vector to update.\n * @param update - An object containing the vector and/or metadata to update.\n * @param update.vector - An optional array of numbers representing the new vector.\n * @param update.metadata - An optional record containing the new metadata.\n * @param namespace - The namespace of the index (optional).\n * @returns A promise that resolves when the update is complete.\n * @throws Will throw an error if no updates are provided or if the update operation fails.\n */\n async updateVector({ indexName, id, update, namespace }: PineconeUpdateVectorParams): Promise<void> {\n if (!update.vector && !update.metadata) {\n throw new MastraError({\n id: 'STORAGE_PINECONE_VECTOR_UPDATE_VECTOR_INVALID_ARGS',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n text: 'No updates provided',\n details: { indexName, id },\n });\n }\n\n try {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n const updateObj: UpdateOptions = { id };\n\n if (update.vector) {\n updateObj.values = update.vector;\n }\n\n if (update.metadata) {\n updateObj.metadata = update.metadata;\n }\n\n await index.update(updateObj);\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_UPDATE_VECTOR_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, id },\n },\n error,\n );\n }\n }\n\n /**\n * Deletes a vector by its ID.\n * @param indexName - The name of the index containing the vector.\n * @param id - The ID of the vector to delete.\n * @param namespace - The namespace of the index (optional).\n * @returns A promise that resolves when the deletion is complete.\n * @throws Will throw an error if the deletion operation fails.\n */\n async deleteVector({ indexName, id, namespace }: PineconeDeleteVectorParams): Promise<void> {\n try {\n const index = this.client.Index(indexName).namespace(namespace || '');\n await index.deleteOne(id);\n } catch (error) {\n throw new MastraError(\n {\n id: 'STORAGE_PINECONE_VECTOR_DELETE_VECTOR_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, id },\n },\n error,\n );\n }\n }\n}\n","/**\n * Vector store specific prompt that details supported operators and examples.\n * This prompt helps users construct valid filters for Pinecone Vector.\n */\nexport const PINECONE_PROMPT = `When querying Pinecone, you can ONLY use the operators listed below. Any other operators will be rejected.\nImportant: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.\nIf a user tries to give an explicit operator that is not supported, reject the filter entirely and let them know that the operator is not supported.\n\nBasic Comparison Operators:\n- $eq: Exact match (default when using field: value)\n Example: { \"category\": \"electronics\" }\n- $ne: Not equal\n Example: { \"category\": { \"$ne\": \"electronics\" } }\n- $gt: Greater than\n Example: { \"price\": { \"$gt\": 100 } }\n- $gte: Greater than or equal\n Example: { \"price\": { \"$gte\": 100 } }\n- $lt: Less than\n Example: { \"price\": { \"$lt\": 100 } }\n- $lte: Less than or equal\n Example: { \"price\": { \"$lte\": 100 } }\n\nArray Operators:\n- $in: Match any value in array\n Example: { \"category\": { \"$in\": [\"electronics\", \"books\"] } }\n- $nin: Does not match any value in array\n Example: { \"category\": { \"$nin\": [\"electronics\", \"books\"] } }\n- $all: Match all values in array\n Example: { \"tags\": { \"$all\": [\"premium\", \"sale\"] } }\n\nLogical Operators:\n- $and: Logical AND (can be implicit or explicit)\n Implicit Example: { \"price\": { \"$gt\": 100 }, \"category\": \"electronics\" }\n Explicit Example: { \"$and\": [{ \"price\": { \"$gt\": 100 } }, { \"category\": \"electronics\" }] }\n- $or: Logical OR\n Example: { \"$or\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n\nElement Operators:\n- $exists: Check if field exists\n Example: { \"rating\": { \"$exists\": true } }\n\nRestrictions:\n- Regex patterns are not supported\n- Only $and and $or logical operators are supported at the top level\n- Empty arrays in $in/$nin will return no results\n- A non-empty array is required for $all operator\n- Nested fields are supported using dot notation\n- Multiple conditions on the same field are supported with both implicit and explicit $and\n- At least one key-value pair is required in filter object\n- Empty objects and undefined values are treated as no filter\n- Invalid types in comparison operators will throw errors\n- All non-logical operators must be used within a field condition\n Valid: { \"field\": { \"$gt\": 100 } }\n Valid: { \"$and\": [...] }\n Invalid: { \"$gt\": 100 }\n- Logical operators must contain field conditions, not direct operators\n Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n Invalid: { \"$and\": [{ \"$gt\": 100 }] }\n- Logical operators ($and, $or):\n - Can only be used at top level or nested within other logical operators\n - Can not be used on a field level, or be nested inside a field\n - Can not be used inside an operator\n - Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n - Valid: { \"$or\": [{ \"$and\": [{ \"field\": { \"$gt\": 100 } }] }] }\n - Invalid: { \"field\": { \"$and\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$or\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$gt\": { \"$and\": [{...}] } } }\n\nExample Complex Query:\n{\n \"$and\": [\n { \"category\": { \"$in\": [\"electronics\", \"computers\"] } },\n { \"price\": { \"$gte\": 100, \"$lte\": 1000 } },\n { \"tags\": { \"$all\": [\"premium\", \"sale\"] } },\n { \"rating\": { \"$exists\": true, \"$gt\": 4 } },\n { \"$or\": [\n { \"stock\": { \"$gt\": 0 } },\n { \"preorder\": true }\n ]}\n ]\n}`;\n"]}
1
+ {"version":3,"sources":["../src/vector/filter.ts","../src/vector/index.ts","../src/vector/prompt.ts"],"names":[],"mappings":";;;;;;;AAkCO,IAAM,wBAAA,GAAN,cAAuC,oBAAA,CAA2C;AAAA,EACpE,qBAAA,GAAyC;AAC1D,IAAA,OAAO;AAAA,MACL,GAAG,oBAAA,CAAqB,iBAAA;AAAA,MACxB,OAAA,EAAS,CAAC,MAAA,EAAQ,KAAK,CAAA;AAAA,MACvB,KAAA,EAAO,CAAC,KAAA,EAAO,M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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA","file":"index.js","sourcesContent":["import { BaseFilterTranslator } from '@mastra/core/vector/filter';\nimport type {\n VectorFilter,\n OperatorSupport,\n OperatorValueMap,\n LogicalOperatorValueMap,\n BlacklistedRootOperators,\n QueryOperator,\n FilterValue,\n OperatorCondition,\n} from '@mastra/core/vector/filter';\n\ntype InitialOperatorValueMap = Omit<OperatorValueMap, '$regex' | '$options' | '$elemMatch' | '$all'> & {\n $contains: string;\n $gt: number | Date;\n $gte: number | Date;\n $lt: number | Date;\n $lte: number | Date;\n};\n\ntype PineconeOperatorValueMap = InitialOperatorValueMap & {\n $all: OperatorCondition<keyof InitialOperatorValueMap, InitialOperatorValueMap>[] | FilterValue[];\n};\ntype PineconeLogicalOperatorValueMap = Omit<LogicalOperatorValueMap, '$not' | '$nor'>;\n\ntype PineconeBlacklisted = BlacklistedRootOperators | '$not' | '$nor';\n\nexport type PineconeVectorFilter = VectorFilter<\n keyof PineconeOperatorValueMap,\n PineconeOperatorValueMap,\n PineconeLogicalOperatorValueMap,\n PineconeBlacklisted\n>;\n\nexport class PineconeFilterTranslator extends BaseFilterTranslator<PineconeVectorFilter> {\n protected override getSupportedOperators(): OperatorSupport {\n return {\n ...BaseFilterTranslator.DEFAULT_OPERATORS,\n logical: ['$and', '$or'],\n array: ['$in', '$all', '$nin'],\n element: ['$exists'],\n regex: [],\n custom: [],\n };\n }\n\n translate(filter?: PineconeVectorFilter): PineconeVectorFilter {\n if (this.isEmpty(filter)) return filter;\n this.validateFilter(filter);\n return this.translateNode(filter);\n }\n\n private translateNode(node: PineconeVectorFilter, currentPath: string = ''): any {\n if (this.isRegex(node)) {\n throw new Error('Regex is not supported in Pinecone');\n }\n if (this.isPrimitive(node)) return this.normalizeComparisonValue(node);\n if (Array.isArray(node)) return { $in: this.normalizeArrayValues(node) };\n\n const entries = Object.entries(node as Record<string, any>);\n const firstEntry = entries[0];\n\n // Handle single operator case\n if (entries.length === 1 && firstEntry && this.isOperator(firstEntry[0])) {\n const [operator, value] = firstEntry;\n const translated = this.translateOperator(operator, value, currentPath);\n return this.isLogicalOperator(operator) ? { [operator]: translated } : translated;\n }\n\n // Process each entry\n const result: Record<string, any> = {};\n\n for (const [key, value] of entries) {\n const newPath = currentPath ? `${currentPath}.${key}` : key;\n\n if (this.isOperator(key)) {\n result[key] = this.translateOperator(key, value, currentPath);\n continue;\n }\n\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n // Handle nested $all\n if (Object.keys(value).length === 1 && '$all' in value) {\n const translated = this.translateNode(value, key);\n if (translated.$and) {\n return translated;\n }\n }\n\n // Check if the nested object contains operators\n if (Object.keys(value).length === 0) {\n result[newPath] = this.translateNode(value);\n } else {\n const hasOperators = Object.keys(value).some(k => this.isOperator(k));\n if (hasOperators) {\n // For objects with operators, normalize each operator value\n const normalizedValue: Record<string, any> = {};\n for (const [op, opValue] of Object.entries(value)) {\n normalizedValue[op] = this.isOperator(op) ? this.translateOperator(op, opValue) : opValue;\n }\n result[newPath] = normalizedValue;\n } else {\n // For objects without operators, flatten them\n Object.assign(result, this.translateNode(value, newPath));\n }\n }\n } else {\n result[newPath] = this.translateNode(value);\n }\n }\n\n return result;\n }\n\n private translateOperator(operator: QueryOperator, value: any, currentPath: string = ''): any {\n // Handle $all specially\n if (operator === '$all') {\n if (!Array.isArray(value) || value.length === 0) {\n throw new Error('A non-empty array is required for the $all operator');\n }\n\n return this.simulateAllOperator(currentPath, value);\n }\n\n // Handle logical operators\n if (this.isLogicalOperator(operator)) {\n return Array.isArray(value) ? value.map(item => this.translateNode(item)) : this.translateNode(value);\n }\n\n // Handle comparison and element operators\n return this.normalizeComparisonValue(value);\n }\n}\n","import { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\nimport { createVectorErrorId } from '@mastra/core/storage';\nimport { MastraVector } from '@mastra/core/vector';\nimport type {\n QueryResult,\n IndexStats,\n CreateIndexParams,\n UpsertVectorParams,\n QueryVectorParams,\n DescribeIndexParams,\n DeleteIndexParams,\n DeleteVectorParams,\n DeleteVectorsParams,\n} from '@mastra/core/vector';\nimport { Pinecone } from '@pinecone-database/pinecone';\nimport type {\n IndexStatsDescription,\n QueryOptions,\n RecordSparseValues,\n ServerlessSpecCloudEnum,\n UpdateOptions,\n} from '@pinecone-database/pinecone';\n\nimport { PineconeFilterTranslator } from './filter';\nimport type { PineconeVectorFilter } from './filter';\n\ninterface PineconeIndexStats extends IndexStats {\n namespaces?: IndexStatsDescription['namespaces'];\n}\n\ninterface PineconeQueryVectorParams extends QueryVectorParams<PineconeVectorFilter> {\n namespace?: string;\n sparseVector?: RecordSparseValues;\n}\n\ninterface PineconeUpsertVectorParams extends UpsertVectorParams {\n namespace?: string;\n sparseVectors?: RecordSparseValues[];\n}\n\n// Pinecone-specific update params that includes namespace in both union branches\ntype PineconeUpdateVectorParams =\n | {\n indexName: string;\n id: string;\n filter?: never;\n update: { vector?: number[]; metadata?: Record<string, any> };\n namespace?: string;\n }\n | {\n indexName: string;\n id?: never;\n filter: PineconeVectorFilter;\n update: { vector?: number[]; metadata?: Record<string, any> };\n namespace?: string;\n };\n\ninterface PineconeDeleteVectorParams extends DeleteVectorParams {\n namespace?: string;\n}\n\ninterface PineconeDeleteVectorsParams extends DeleteVectorsParams<PineconeVectorFilter> {\n namespace?: string;\n}\n\nexport class PineconeVector extends MastraVector<PineconeVectorFilter> {\n private client: Pinecone;\n private cloud: ServerlessSpecCloudEnum;\n private region: string;\n\n /**\n * Creates a new PineconeVector client.\n * @param id - The unique identifier for this vector store instance.\n * @param apiKey - The API key for Pinecone.\n * @param environment - The environment for Pinecone.\n * @param cloud - The cloud provider for Pinecone.\n * @param region - The region for Pinecone.\n */\n constructor({\n id,\n apiKey,\n environment,\n cloud,\n region,\n }: {\n id: string;\n apiKey: string;\n environment?: string;\n region?: string;\n cloud?: ServerlessSpecCloudEnum;\n }) {\n super({ id });\n const opts: { apiKey: string; controllerHostUrl?: string } = { apiKey };\n if (environment) {\n opts['controllerHostUrl'] = environment;\n }\n this.client = new Pinecone(opts);\n this.cloud = cloud || 'aws';\n this.region = region || 'us-east-1';\n }\n\n get indexSeparator(): string {\n return '-';\n }\n\n async createIndex({ indexName, dimension, metric = 'cosine' }: CreateIndexParams): Promise<void> {\n try {\n if (!Number.isInteger(dimension) || dimension <= 0) {\n throw new Error('Dimension must be a positive integer');\n }\n if (metric && !['cosine', 'euclidean', 'dotproduct'].includes(metric)) {\n throw new Error('Metric must be one of: cosine, euclidean, dotproduct');\n }\n } catch (validationError) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'CREATE_INDEX', 'INVALID_ARGS'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName, dimension, metric },\n },\n validationError,\n );\n }\n\n try {\n await this.client.createIndex({\n name: indexName,\n dimension: dimension,\n metric: metric,\n spec: {\n serverless: {\n cloud: this.cloud,\n region: this.region,\n },\n },\n });\n } catch (error: any) {\n // Check for 'already exists' error\n const message = error?.errors?.[0]?.message || error?.message;\n if (\n error.status === 409 ||\n (typeof message === 'string' &&\n (message.toLowerCase().includes('already exists') || message.toLowerCase().includes('duplicate')))\n ) {\n // Fetch index info and check dimensions\n await this.validateExistingIndex(indexName, dimension, metric);\n return;\n }\n // For any other errors, wrap in MastraError\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'CREATE_INDEX', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, dimension, metric },\n },\n error,\n );\n }\n }\n\n async upsert({\n indexName,\n vectors,\n metadata,\n ids,\n namespace,\n sparseVectors,\n }: PineconeUpsertVectorParams): Promise<string[]> {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n // Generate IDs if not provided\n const vectorIds = ids || vectors.map(() => crypto.randomUUID());\n\n const records = vectors.map((vector, i) => ({\n id: vectorIds[i]!,\n values: vector,\n ...(sparseVectors?.[i] && { sparseValues: sparseVectors?.[i] }),\n metadata: metadata?.[i] || {},\n }));\n\n // Pinecone has a limit of 100 vectors per upsert request\n const batchSize = 100;\n try {\n for (let i = 0; i < records.length; i += batchSize) {\n const batch = records.slice(i, i + batchSize);\n await index.upsert(batch);\n }\n\n return vectorIds;\n } catch (error) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'UPSERT', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, vectorCount: vectors.length },\n },\n error,\n );\n }\n }\n\n transformFilter(filter?: PineconeVectorFilter) {\n const translator = new PineconeFilterTranslator();\n return translator.translate(filter);\n }\n\n async query({\n indexName,\n queryVector,\n topK = 10,\n filter,\n includeVector = false,\n namespace,\n sparseVector,\n }: PineconeQueryVectorParams): Promise<QueryResult[]> {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n const translatedFilter = this.transformFilter(filter) ?? undefined;\n\n const queryParams: QueryOptions = {\n vector: queryVector,\n topK,\n includeMetadata: true,\n includeValues: includeVector,\n filter: translatedFilter,\n };\n\n // If sparse vector is provided, use hybrid search\n if (sparseVector) {\n queryParams.sparseVector = sparseVector;\n }\n\n try {\n const results = await index.query(queryParams);\n\n return results.matches.map(match => ({\n id: match.id,\n score: match.score || 0,\n metadata: match.metadata as Record<string, any>,\n ...(includeVector && { vector: match.values || [] }),\n }));\n } catch (error) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'QUERY', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, topK },\n },\n error,\n );\n }\n }\n\n async listIndexes(): Promise<string[]> {\n try {\n const indexesResult = await this.client.listIndexes();\n return indexesResult?.indexes?.map(index => index.name) || [];\n } catch (error) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'LIST_INDEXES', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n },\n error,\n );\n }\n }\n\n /**\n * Retrieves statistics about a vector index.\n *\n * @param {string} indexName - The name of the index to describe\n * @returns A promise that resolves to the index statistics including dimension, count and metric\n */\n async describeIndex({ indexName }: DescribeIndexParams): Promise<PineconeIndexStats> {\n try {\n const index = this.client.Index(indexName);\n const stats = await index.describeIndexStats();\n const description = await this.client.describeIndex(indexName);\n\n return {\n dimension: description.dimension,\n count: stats.totalRecordCount || 0,\n metric: description.metric as 'cosine' | 'euclidean' | 'dotproduct',\n namespaces: stats.namespaces,\n };\n } catch (error) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'DESCRIBE_INDEX', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName },\n },\n error,\n );\n }\n }\n\n async deleteIndex({ indexName }: DeleteIndexParams): Promise<void> {\n try {\n await this.client.deleteIndex(indexName);\n } catch (error) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'DELETE_INDEX', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName },\n },\n error,\n );\n }\n }\n\n /**\n * Updates a vector by its ID with the provided vector and/or metadata.\n * Note: Pinecone only supports update by ID, not by filter.\n * @param params - Parameters containing the id for targeting the vector to update\n * @param params.indexName - The name of the index containing the vector.\n * @param params.id - The ID of the vector to update.\n * @param params.update - An object containing the vector and/or metadata to update.\n * @param namespace - The namespace of the index (optional, Pinecone-specific).\n * @returns A promise that resolves when the update is complete.\n * @throws Will throw an error if no updates are provided or if the update operation fails.\n */\n async updateVector(params: PineconeUpdateVectorParams): Promise<void> {\n const { indexName, update } = params;\n\n // Validate mutually exclusive parameters\n if ('id' in params && params.id && 'filter' in params && params.filter) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'UPDATE_VECTOR', 'MUTUALLY_EXCLUSIVE'),\n text: 'Cannot specify both id and filter - they are mutually exclusive',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n if (!('id' in params && params.id) && !('filter' in params && params.filter)) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'UPDATE_VECTOR', 'NO_TARGET'),\n text: 'Either id or filter must be provided',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n if (!update.vector && !update.metadata) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'UPDATE_VECTOR', 'NO_PAYLOAD'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n text: 'No updates provided',\n details: { indexName },\n });\n }\n\n // Extract Pinecone-specific namespace field\n const namespace = params.namespace;\n\n try {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n // Handle update by ID\n if ('id' in params && params.id) {\n const updateObj: UpdateOptions = { id: params.id };\n\n if (update.vector) {\n updateObj.values = update.vector;\n }\n\n if (update.metadata) {\n updateObj.metadata = update.metadata;\n }\n\n await index.update(updateObj);\n }\n // Handle update by filter (query first, then update each)\n else if ('filter' in params && params.filter) {\n // Validate filter is not empty\n if (Object.keys(params.filter).length === 0) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'UPDATE_VECTOR', 'EMPTY_FILTER'),\n text: 'Filter cannot be an empty filter object',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n const translatedFilter = this.transformFilter(params.filter);\n if (translatedFilter) {\n // Get index stats to know dimensions for dummy vector\n const stats = await this.describeIndex({ indexName });\n\n // Create a normalized dummy vector for querying (avoid zero vector for cosine similarity)\n const dummyVector = new Array(stats.dimension).fill(1 / Math.sqrt(stats.dimension));\n\n // Query with large topK to get all matching vectors\n // Pinecone's max topK is 10000\n const results = await index.query({\n vector: dummyVector,\n topK: 10000,\n filter: translatedFilter,\n includeMetadata: false,\n includeValues: false,\n });\n\n // Update each matching vector\n const idsToUpdate = results.matches.map(m => m.id as string);\n for (const id of idsToUpdate) {\n const updateObj: UpdateOptions = { id };\n\n if (update.vector) {\n updateObj.values = update.vector;\n }\n\n if (update.metadata) {\n updateObj.metadata = update.metadata;\n }\n\n await index.update(updateObj);\n }\n }\n }\n } catch (error) {\n if (error instanceof MastraError) throw error;\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'UPDATE_VECTOR', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n ...('id' in params && params.id && { id: params.id }),\n ...('filter' in params && params.filter && { filter: JSON.stringify(params.filter) }),\n },\n },\n error,\n );\n }\n }\n\n /**\n * Deletes a vector by its ID.\n * @param indexName - The name of the index containing the vector.\n * @param id - The ID of the vector to delete.\n * @param namespace - The namespace of the index (optional).\n * @returns A promise that resolves when the deletion is complete.\n * @throws Will throw an error if the deletion operation fails.\n */\n async deleteVector({ indexName, id, namespace }: PineconeDeleteVectorParams): Promise<void> {\n try {\n const index = this.client.Index(indexName).namespace(namespace || '');\n await index.deleteOne(id);\n } catch (error) {\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'DELETE_VECTOR', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n ...(id && { id }),\n },\n },\n error,\n );\n }\n }\n\n /**\n * Deletes multiple vectors by IDs or filter.\n * @param indexName - The name of the index containing the vectors.\n * @param ids - Array of vector IDs to delete (mutually exclusive with filter).\n * @param filter - Filter to match vectors to delete (mutually exclusive with ids).\n * @param namespace - The namespace of the index (optional, Pinecone-specific).\n * @returns A promise that resolves when the deletion is complete.\n * @throws Will throw an error if both ids and filter are provided, or if neither is provided.\n */\n async deleteVectors(params: PineconeDeleteVectorsParams): Promise<void> {\n const { indexName, filter, ids } = params;\n const namespace = params.namespace;\n\n // Validate mutually exclusive parameters\n if (ids && filter) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'DELETE_VECTORS', 'MUTUALLY_EXCLUSIVE'),\n text: 'Cannot specify both ids and filter - they are mutually exclusive',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n if (!ids && !filter) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'DELETE_VECTORS', 'NO_TARGET'),\n text: 'Either filter or ids must be provided',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n // Validate ids array is not empty\n if (ids && ids.length === 0) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'DELETE_VECTORS', 'EMPTY_IDS'),\n text: 'Cannot delete with empty ids array',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n // Validate filter is not empty\n if (filter && Object.keys(filter).length === 0) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'DELETE_VECTORS', 'EMPTY_FILTER'),\n text: 'Cannot delete with empty filter object',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\n try {\n const index = this.client.Index(indexName).namespace(namespace || '');\n\n if (ids) {\n // Delete by IDs - Pinecone's deleteMany accepts an array of IDs\n await index.deleteMany(ids);\n } else if (filter) {\n // Delete by filter - Pinecone's deleteMany doesn't properly support metadata filters\n // We need to query for matching IDs first, then delete them\n const translatedFilter = this.transformFilter(filter);\n if (translatedFilter) {\n // Get index stats to know dimensions for dummy vector\n const stats = await this.describeIndex({ indexName });\n\n // Create a normalized dummy vector for querying (avoid zero vector for cosine similarity)\n const dummyVector = new Array(stats.dimension).fill(1 / Math.sqrt(stats.dimension));\n\n // Query with large topK to get all matching vectors\n // Pinecone's max topK is 10000\n const results = await index.query({\n vector: dummyVector,\n topK: 10000,\n filter: translatedFilter,\n includeMetadata: false,\n includeValues: false,\n });\n\n // Extract IDs and delete them\n const idsToDelete = results.matches.map(m => m.id as string);\n if (idsToDelete.length > 0) {\n await index.deleteMany(idsToDelete);\n }\n }\n }\n } catch (error) {\n if (error instanceof MastraError) throw error;\n throw new MastraError(\n {\n id: createVectorErrorId('PINECONE', 'DELETE_VECTORS', 'FAILED'),\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n ...(filter && { filter: JSON.stringify(filter) }),\n ...(ids && { idsCount: ids.length }),\n },\n },\n error,\n );\n }\n }\n}\n","/**\n * Vector store specific prompt that details supported operators and examples.\n * This prompt helps users construct valid filters for Pinecone Vector.\n */\nexport const PINECONE_PROMPT = `When querying Pinecone, you can ONLY use the operators listed below. Any other operators will be rejected.\nImportant: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.\nIf a user tries to give an explicit operator that is not supported, reject the filter entirely and let them know that the operator is not supported.\n\nBasic Comparison Operators:\n- $eq: Exact match (default when using field: value)\n Example: { \"category\": \"electronics\" }\n- $ne: Not equal\n Example: { \"category\": { \"$ne\": \"electronics\" } }\n- $gt: Greater than\n Example: { \"price\": { \"$gt\": 100 } }\n- $gte: Greater than or equal\n Example: { \"price\": { \"$gte\": 100 } }\n- $lt: Less than\n Example: { \"price\": { \"$lt\": 100 } }\n- $lte: Less than or equal\n Example: { \"price\": { \"$lte\": 100 } }\n\nArray Operators:\n- $in: Match any value in array\n Example: { \"category\": { \"$in\": [\"electronics\", \"books\"] } }\n- $nin: Does not match any value in array\n Example: { \"category\": { \"$nin\": [\"electronics\", \"books\"] } }\n- $all: Match all values in array\n Example: { \"tags\": { \"$all\": [\"premium\", \"sale\"] } }\n\nLogical Operators:\n- $and: Logical AND (can be implicit or explicit)\n Implicit Example: { \"price\": { \"$gt\": 100 }, \"category\": \"electronics\" }\n Explicit Example: { \"$and\": [{ \"price\": { \"$gt\": 100 } }, { \"category\": \"electronics\" }] }\n- $or: Logical OR\n Example: { \"$or\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n\nElement Operators:\n- $exists: Check if field exists\n Example: { \"rating\": { \"$exists\": true } }\n\nRestrictions:\n- Regex patterns are not supported\n- Only $and and $or logical operators are supported at the top level\n- Empty arrays in $in/$nin will return no results\n- A non-empty array is required for $all operator\n- Nested fields are supported using dot notation\n- Multiple conditions on the same field are supported with both implicit and explicit $and\n- At least one key-value pair is required in filter object\n- Empty objects and undefined values are treated as no filter\n- Invalid types in comparison operators will throw errors\n- All non-logical operators must be used within a field condition\n Valid: { \"field\": { \"$gt\": 100 } }\n Valid: { \"$and\": [...] }\n Invalid: { \"$gt\": 100 }\n- Logical operators must contain field conditions, not direct operators\n Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n Invalid: { \"$and\": [{ \"$gt\": 100 }] }\n- Logical operators ($and, $or):\n - Can only be used at top level or nested within other logical operators\n - Can not be used on a field level, or be nested inside a field\n - Can not be used inside an operator\n - Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n - Valid: { \"$or\": [{ \"$and\": [{ \"field\": { \"$gt\": 100 } }] }] }\n - Invalid: { \"field\": { \"$and\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$or\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$gt\": { \"$and\": [{...}] } } }\n\nExample Complex Query:\n{\n \"$and\": [\n { \"category\": { \"$in\": [\"electronics\", \"computers\"] } },\n { \"price\": { \"$gte\": 100, \"$lte\": 1000 } },\n { \"tags\": { \"$all\": [\"premium\", \"sale\"] } },\n { \"rating\": { \"$exists\": true, \"$gt\": 4 } },\n { \"$or\": [\n { \"stock\": { \"$gt\": 0 } },\n { \"preorder\": true }\n ]}\n ]\n}`;\n"]}
@@ -1,5 +1,5 @@
1
1
  import { MastraVector } from '@mastra/core/vector';
2
- import type { QueryResult, IndexStats, CreateIndexParams, UpsertVectorParams, QueryVectorParams, DescribeIndexParams, DeleteIndexParams, DeleteVectorParams, UpdateVectorParams } from '@mastra/core/vector';
2
+ import type { QueryResult, IndexStats, CreateIndexParams, UpsertVectorParams, QueryVectorParams, DescribeIndexParams, DeleteIndexParams, DeleteVectorParams, DeleteVectorsParams } from '@mastra/core/vector';
3
3
  import type { IndexStatsDescription, RecordSparseValues, ServerlessSpecCloudEnum } from '@pinecone-database/pinecone';
4
4
  import type { PineconeVectorFilter } from './filter.js';
5
5
  interface PineconeIndexStats extends IndexStats {
@@ -13,12 +13,31 @@ interface PineconeUpsertVectorParams extends UpsertVectorParams {
13
13
  namespace?: string;
14
14
  sparseVectors?: RecordSparseValues[];
15
15
  }
16
- interface PineconeUpdateVectorParams extends UpdateVectorParams {
16
+ type PineconeUpdateVectorParams = {
17
+ indexName: string;
18
+ id: string;
19
+ filter?: never;
20
+ update: {
21
+ vector?: number[];
22
+ metadata?: Record<string, any>;
23
+ };
17
24
  namespace?: string;
18
- }
25
+ } | {
26
+ indexName: string;
27
+ id?: never;
28
+ filter: PineconeVectorFilter;
29
+ update: {
30
+ vector?: number[];
31
+ metadata?: Record<string, any>;
32
+ };
33
+ namespace?: string;
34
+ };
19
35
  interface PineconeDeleteVectorParams extends DeleteVectorParams {
20
36
  namespace?: string;
21
37
  }
38
+ interface PineconeDeleteVectorsParams extends DeleteVectorsParams<PineconeVectorFilter> {
39
+ namespace?: string;
40
+ }
22
41
  export declare class PineconeVector extends MastraVector<PineconeVectorFilter> {
23
42
  private client;
24
43
  private cloud;
@@ -54,16 +73,16 @@ export declare class PineconeVector extends MastraVector<PineconeVectorFilter> {
54
73
  deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
55
74
  /**
56
75
  * Updates a vector by its ID with the provided vector and/or metadata.
57
- * @param indexName - The name of the index containing the vector.
58
- * @param id - The ID of the vector to update.
59
- * @param update - An object containing the vector and/or metadata to update.
60
- * @param update.vector - An optional array of numbers representing the new vector.
61
- * @param update.metadata - An optional record containing the new metadata.
62
- * @param namespace - The namespace of the index (optional).
76
+ * Note: Pinecone only supports update by ID, not by filter.
77
+ * @param params - Parameters containing the id for targeting the vector to update
78
+ * @param params.indexName - The name of the index containing the vector.
79
+ * @param params.id - The ID of the vector to update.
80
+ * @param params.update - An object containing the vector and/or metadata to update.
81
+ * @param namespace - The namespace of the index (optional, Pinecone-specific).
63
82
  * @returns A promise that resolves when the update is complete.
64
83
  * @throws Will throw an error if no updates are provided or if the update operation fails.
65
84
  */
66
- updateVector({ indexName, id, update, namespace }: PineconeUpdateVectorParams): Promise<void>;
85
+ updateVector(params: PineconeUpdateVectorParams): Promise<void>;
67
86
  /**
68
87
  * Deletes a vector by its ID.
69
88
  * @param indexName - The name of the index containing the vector.
@@ -73,6 +92,16 @@ export declare class PineconeVector extends MastraVector<PineconeVectorFilter> {
73
92
  * @throws Will throw an error if the deletion operation fails.
74
93
  */
75
94
  deleteVector({ indexName, id, namespace }: PineconeDeleteVectorParams): Promise<void>;
95
+ /**
96
+ * Deletes multiple vectors by IDs or filter.
97
+ * @param indexName - The name of the index containing the vectors.
98
+ * @param ids - Array of vector IDs to delete (mutually exclusive with filter).
99
+ * @param filter - Filter to match vectors to delete (mutually exclusive with ids).
100
+ * @param namespace - The namespace of the index (optional, Pinecone-specific).
101
+ * @returns A promise that resolves when the deletion is complete.
102
+ * @throws Will throw an error if both ids and filter are provided, or if neither is provided.
103
+ */
104
+ deleteVectors(params: PineconeDeleteVectorsParams): Promise<void>;
76
105
  }
77
106
  export {};
78
107
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vector/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EACV,WAAW,EACX,UA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AAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAwHrE;;;;;;;OAOG;IACG,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB3F;;;;;;;;OAQG;IACG,aAAa,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;CAkGxE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/pinecone",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "Pinecone vector store provider for Mastra",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -25,16 +25,17 @@
25
25
  "devDependencies": {
26
26
  "@microsoft/api-extractor": "^7.52.8",
27
27
  "@types/node": "22.13.17",
28
- "@vitest/coverage-v8": "4.0.8",
29
- "@vitest/ui": "4.0.8",
28
+ "@vitest/coverage-v8": "4.0.12",
29
+ "@vitest/ui": "4.0.12",
30
30
  "dotenv": "^17.0.0",
31
31
  "eslint": "^9.37.0",
32
32
  "tsup": "^8.5.0",
33
33
  "typescript": "^5.8.3",
34
- "vitest": "^4.0.8",
35
- "@mastra/core": "1.0.0-beta.3",
34
+ "vitest": "4.0.12",
35
+ "@internal/storage-test-utils": "0.0.49",
36
36
  "@internal/types-builder": "0.0.28",
37
- "@internal/lint": "0.0.53"
37
+ "@internal/lint": "0.0.53",
38
+ "@mastra/core": "1.0.0-beta.7"
38
39
  },
39
40
  "peerDependencies": {
40
41
  "@mastra/core": ">=1.0.0-0 <2.0.0-0"