@mastra/pinecone 1.1.2-alpha.0 → 1.1.2

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.
@@ -3,7 +3,7 @@ name: mastra-pinecone
3
3
  description: Documentation for @mastra/pinecone. Use when working with @mastra/pinecone APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/pinecone"
6
- version: "1.1.2-alpha.0"
6
+ version: "1.1.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.2-alpha.0",
2
+ "version": "1.1.2",
3
3
  "package": "@mastra/pinecone",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -28,13 +28,15 @@ Retrieves message history and persists new messages.
28
28
 
29
29
  ```typescript
30
30
  memory: new Memory({
31
- lastMessages: 10,
31
+ options: {
32
+ lastMessages: 10,
33
+ },
32
34
  })
33
35
  ```
34
36
 
35
37
  **Mastra internally:**
36
38
 
37
- 1. Creates a `MessageHistory` processor with `limit: 10`
39
+ 1. Creates a `MessageHistory` processor with `lastMessages: 10`
38
40
  2. Adds it to the agent's input processors (runs before the LLM)
39
41
  3. Adds it to the agent's output processors (runs after the LLM)
40
42
 
@@ -61,7 +63,9 @@ const agent = new Agent({
61
63
  id: 'memory-store',
62
64
  url: 'file:memory.db',
63
65
  }),
64
- lastMessages: 10, // MessageHistory processor automatically added
66
+ options: {
67
+ lastMessages: 10, // MessageHistory processor automatically added
68
+ },
65
69
  }),
66
70
  })
67
71
  ```
@@ -85,7 +89,7 @@ memory: new Memory({
85
89
  1. Creates a `SemanticRecall` processor
86
90
  2. Adds it to the agent's input processors (runs before the LLM)
87
91
  3. Adds it to the agent's output processors (runs after the LLM)
88
- 4. Requires both a vector store and embedder to be configured
92
+ 4. Requires a vector store, plus an embedder unless the vector store generates embeddings itself
89
93
 
90
94
  **What it does:**
91
95
 
@@ -190,7 +194,9 @@ const agent = new Agent({
190
194
  model: 'openai/gpt-5.6-sol',
191
195
  memory: new Memory({
192
196
  storage: new LibSQLStore({ id: 'memory-store', url: 'file:memory.db' }),
193
- lastMessages: 10, // This would normally add MessageHistory(10)
197
+ options: {
198
+ lastMessages: 10, // This would normally add MessageHistory(10)
199
+ },
194
200
  }),
195
201
  inputProcessors: [
196
202
  customMessageHistory, // Your custom one is used instead
@@ -259,7 +265,7 @@ const agent = new Agent({
259
265
  name: 'safe-agent',
260
266
  instructions: 'You are a helpful assistant',
261
267
  model: 'openai/gpt-5.6-sol',
262
- memory: new Memory({ lastMessages: 10 }),
268
+ memory: new Memory({ options: { lastMessages: 10 } }),
263
269
  // Your guardrail runs BEFORE memory saves
264
270
  outputProcessors: [contentBlocker],
265
271
  })
@@ -299,7 +305,7 @@ const agent = new Agent({
299
305
  name: 'validated-agent',
300
306
  instructions: 'You are a helpful assistant',
301
307
  model: 'openai/gpt-5.6-sol',
302
- memory: new Memory({ lastMessages: 10 }),
308
+ memory: new Memory({ options: { lastMessages: 10 } }),
303
309
  // Your guardrail runs AFTER memory loads history
304
310
  inputProcessors: [inputValidator],
305
311
  })
@@ -376,7 +382,7 @@ export const supportAgent = new Agent({
376
382
  name: 'Support agent',
377
383
  instructions: 'Answer customer support questions.',
378
384
  model: 'openai/gpt-5.6-sol',
379
- memory: new Memory({ lastMessages: 10 }),
385
+ memory: new Memory({ options: { lastMessages: 10 } }),
380
386
  inputProcessors: [new AttachmentUploader()],
381
387
  })
382
388
  ```
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["BaseFilterTranslator","MastraVector","Pinecone","MastraError","ErrorDomain","ErrorCategory"],"sources":["../src/vector/filter.ts","../src/vector/index.ts","../src/vector/prompt.ts"],"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 PineconeConfiguration,\n QueryOptions,\n RecordSparseValues,\n ServerlessSpecCloudEnum,\n UpdateOptions,\n} from '@pinecone-database/pinecone';\n\nimport { PineconeFilterTranslator } from './filter';\nimport type { PineconeVectorFilter } from './filter';\n\n/**\n * Configuration for PineconeVector.\n *\n * Extends the Pinecone client configuration with Mastra-specific fields.\n * All Pinecone configuration options are supported (apiKey, controllerHostUrl,\n * fetchApi, additionalHeaders, sourceTag).\n *\n * @example\n * ```typescript\n * // Simple API key config\n * const vector = new PineconeVector({\n * id: 'my-pinecone',\n * apiKey: 'your-api-key',\n * });\n *\n * // With custom controller host\n * const vector = new PineconeVector({\n * id: 'my-pinecone',\n * apiKey: 'your-api-key',\n * controllerHostUrl: 'https://api.pinecone.io',\n * });\n *\n * // With index creation defaults\n * const vector = new PineconeVector({\n * id: 'my-pinecone',\n * apiKey: 'your-api-key',\n * cloud: 'gcp',\n * region: 'us-central1',\n * });\n * ```\n */\nexport type PineconeVectorConfig = PineconeConfiguration & {\n /** The unique identifier for this vector store instance. */\n id: string;\n /** The cloud provider for new index creation. Defaults to 'aws'. */\n cloud?: ServerlessSpecCloudEnum;\n /** The region for new index creation. Defaults to 'us-east-1'. */\n region?: string;\n};\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 *\n * @param config - Configuration options for the Pinecone client.\n * @see {@link PineconeVectorConfig} for all available options.\n */\n constructor({ id, cloud, region, ...pineconeConfig }: PineconeVectorConfig) {\n super({ id });\n this.client = new Pinecone(pineconeConfig);\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 if (!queryVector) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'QUERY', 'MISSING_VECTOR'),\n text: 'queryVector is required for Pinecone queries. Metadata-only queries are not supported by this vector store.',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\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 { \"pre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pB,UAAUC,mBAAAA,cAAc;IACxB,SAAS;KACP;KACA,GAAI,UAAU,EAAE,QAAQ,KAAK,UAAU,MAAM,EAAE;KAC/C,GAAI,OAAO,EAAE,UAAU,IAAI,OAAO;IACpC;GACF,GACA,KACF;EACF;CACF;AACF;;;;;;;ACvmBA,MAAa,kBAAkB"}
1
+ {"version":3,"file":"index.cjs","names":["BaseFilterTranslator","MastraVector","Pinecone","MastraError","createVectorErrorId","ErrorDomain","ErrorCategory"],"sources":["../src/vector/filter.ts","../src/vector/index.ts","../src/vector/prompt.ts"],"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 PineconeConfiguration,\n QueryOptions,\n RecordSparseValues,\n ServerlessSpecCloudEnum,\n UpdateOptions,\n} from '@pinecone-database/pinecone';\n\nimport { PineconeFilterTranslator } from './filter';\nimport type { PineconeVectorFilter } from './filter';\n\n/**\n * Configuration for PineconeVector.\n *\n * Extends the Pinecone client configuration with Mastra-specific fields.\n * All Pinecone configuration options are supported (apiKey, controllerHostUrl,\n * fetchApi, additionalHeaders, sourceTag).\n *\n * @example\n * ```typescript\n * // Simple API key config\n * const vector = new PineconeVector({\n * id: 'my-pinecone',\n * apiKey: 'your-api-key',\n * });\n *\n * // With custom controller host\n * const vector = new PineconeVector({\n * id: 'my-pinecone',\n * apiKey: 'your-api-key',\n * controllerHostUrl: 'https://api.pinecone.io',\n * });\n *\n * // With index creation defaults\n * const vector = new PineconeVector({\n * id: 'my-pinecone',\n * apiKey: 'your-api-key',\n * cloud: 'gcp',\n * region: 'us-central1',\n * });\n * ```\n */\nexport type PineconeVectorConfig = PineconeConfiguration & {\n /** The unique identifier for this vector store instance. */\n id: string;\n /** The cloud provider for new index creation. Defaults to 'aws'. */\n cloud?: ServerlessSpecCloudEnum;\n /** The region for new index creation. Defaults to 'us-east-1'. */\n region?: string;\n};\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 *\n * @param config - Configuration options for the Pinecone client.\n * @see {@link PineconeVectorConfig} for all available options.\n */\n constructor({ id, cloud, region, ...pineconeConfig }: PineconeVectorConfig) {\n super({ id });\n this.client = new Pinecone(pineconeConfig);\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 if (!queryVector) {\n throw new MastraError({\n id: createVectorErrorId('PINECONE', 'QUERY', 'MISSING_VECTOR'),\n text: 'queryVector is required for Pinecone queries. Metadata-only queries are not supported by this vector store.',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.USER,\n details: { indexName },\n });\n }\n\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"],"mappings":";;;;;;;AAkCA,IAAa,2BAAb,cAA8CA,2BAAAA,qBAA2C;CACvF,wBAA4D;EAC1D,OAAO;GACL,GAAGA,2BAAAA,qBAAqB;GACxB,SAAS,CAAC,QAAQ,KAAK;GACvB,OAAO;IAAC;IAAO;IAAQ;GAAM;GAC7B,SAAS,CAAC,SAAS;GACnB,OAAO,CAAC;GACR,QAAQ,CAAC;EACX;CACF;CAEA,UAAU,QAAqD;EAC7D,IAAI,KAAK,QAAQ,MAAM,GAAG,OAAO;EACjC,KAAK,eAAe,MAAM;EAC1B,OAAO,KAAK,cAAc,MAAM;CAClC;CAEA,cAAsB,MAA4B,cAAsB,IAAS;EAC/E,IAAI,KAAK,QAAQ,IAAI,GACnB,MAAM,IAAI,MAAM,oCAAoC;EAEtD,IAAI,KAAK,YAAY,IAAI,GAAG,OAAO,KAAK,yBAAyB,IAAI;EACrE,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,EAAE,KAAK,KAAK,qBAAqB,IAAI,EAAE;EAEvE,MAAM,UAAU,OAAO,QAAQ,IAA2B;E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AmB,KAAK,gBAAgB,MAAM;IACpD,IAAI,kBAAkB;KAEpB,MAAM,QAAQ,MAAM,KAAK,cAAc,EAAE,UAAU,CAAC;KAGpD,MAAM,cAAc,IAAI,MAAM,MAAM,SAAS,CAAC,CAAC,KAAK,IAAI,KAAK,KAAK,MAAM,SAAS,CAAC;KAalF,MAAM,eAAc,MATE,MAAM,MAAM;MAChC,QAAQ;MACR,MAAM;MACN,QAAQ;MACR,iBAAiB;MACjB,eAAe;KACjB,CAAC,EAAA,CAG2B,QAAQ,KAAI,MAAK,EAAE,EAAY;KAC3D,IAAI,YAAY,SAAS,GACvB,MAAM,MAAM,WAAW,WAAW;IAEtC;GACF;EACF,SAAS,OAAO;GACd,IAAI,iBAAiBH,mBAAAA,aAAa,MAAM;GACxC,MAAM,IAAIA,mBAAAA,YACR;IACE,KAAA,GAAIC,qBAAAA,oBAAAA,CAAoB,YAAY,kBAAkB,QAAQ;IAC9D,QAAQC,mBAAAA,YAAY;IACpB,UAAUC,mBAAAA,cAAc;IACxB,SAAS;KACP;KACA,GAAI,UAAU,EAAE,QAAQ,KAAK,UAAU,MAAM,EAAE;KAC/C,GAAI,OAAO,EAAE,UAAU,IAAI,OAAO;IACpC;GACF,GACA,KACF;EACF;CACF;AACF;;;;;;;ACvmBA,MAAa,kBAAkB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/pinecone",
3
- "version": "1.1.2-alpha.0",
3
+ "version": "1.1.2",
4
4
  "description": "Pinecone vector store provider for Mastra",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -27,15 +27,14 @@
27
27
  "@vitest/coverage-v8": "4.1.11",
28
28
  "@vitest/ui": "4.1.11",
29
29
  "dotenv": "^17.4.2",
30
- "eslint": "^10.7.0",
31
30
  "tsdown": "0.22.9",
32
31
  "tsx": "^4.23.1",
33
32
  "typescript": "^7.0.2",
34
33
  "vitest": "4.1.11",
35
- "@internal/lint": "0.0.144",
36
- "@internal/types-builder": "0.0.119",
37
- "@internal/storage-test-utils": "0.0.140",
38
- "@mastra/core": "1.78.1-alpha.0"
34
+ "@internal/lint": "0.0.145",
35
+ "@internal/types-builder": "0.0.120",
36
+ "@mastra/core": "1.79.0",
37
+ "@internal/storage-test-utils": "0.0.141"
39
38
  },
40
39
  "peerDependencies": {
41
40
  "@mastra/core": ">=1.0.0-0 <2.0.0-0"
@@ -59,7 +58,7 @@
59
58
  "build:lib": "tsdown --silent --config tsdown.config.ts",
60
59
  "build:watch": "tsdown --watch --silent --config tsdown.config.ts",
61
60
  "test": "vitest run",
62
- "lint": "oxlint . && eslint .",
63
- "lint:fix": "oxlint --fix . && eslint --fix ."
61
+ "lint": "oxlint --type-aware .",
62
+ "lint:fix": "oxlint --type-aware --fix ."
64
63
  }
65
64
  }