@mastra/pinecone 0.11.16 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -15
- package/dist/index.cjs +4 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -10
- package/dist/index.js.map +1 -1
- package/dist/vector/index.d.ts +3 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +7 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
# @mastra/pinecone
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 1.0.0-beta.0
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Major Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Every Mastra primitive (agent, MCPServer, workflow, tool, processor, scorer, and vector) now has a get, list, and add method associated with it. Each primitive also now requires an id to be set. ([#9675](https://github.com/mastra-ai/mastra/pull/9675))
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- @mastra/core@0.24.0
|
|
9
|
+
Primitives that are added to other primitives are also automatically added to the Mastra instance
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
- Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
- Removed old tracing code based on OpenTelemetry ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
|
|
15
14
|
|
|
16
|
-
-
|
|
15
|
+
- Mark as stable ([`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc))
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
- @mastra/core@0.24.0-alpha.0
|
|
17
|
+
### Minor Changes
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
- Update peer dependencies to match core package version bump (1.0.0) ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
|
|
22
20
|
|
|
23
21
|
### Patch Changes
|
|
24
22
|
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
- Updated dependencies []:
|
|
28
|
-
- @mastra/core@0.23.1
|
|
23
|
+
- Updated dependencies [[`39c9743`](https://github.com/mastra-ai/mastra/commit/39c97432d084294f8ba85fbf3ef28098ff21459e), [`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`fec5129`](https://github.com/mastra-ai/mastra/commit/fec5129de7fc64423ea03661a56cef31dc747a0d), [`0491e7c`](https://github.com/mastra-ai/mastra/commit/0491e7c9b714cb0ba22187ee062147ec2dd7c712), [`f6f4903`](https://github.com/mastra-ai/mastra/commit/f6f4903397314f73362061dc5a3e8e7c61ea34aa), [`0e8ed46`](https://github.com/mastra-ai/mastra/commit/0e8ed467c54d6901a6a365f270ec15d6faadb36c), [`6c049d9`](https://github.com/mastra-ai/mastra/commit/6c049d94063fdcbd5b81c4912a2bf82a92c9cc0b), [`2f897df`](https://github.com/mastra-ai/mastra/commit/2f897df208508f46f51b7625e5dd20c37f93e0e3), [`3443770`](https://github.com/mastra-ai/mastra/commit/3443770662df8eb24c9df3589b2792d78cfcb811), [`f0a07e0`](https://github.com/mastra-ai/mastra/commit/f0a07e0111b3307c5fabfa4094c5c2cfb734fbe6), [`aaa40e7`](https://github.com/mastra-ai/mastra/commit/aaa40e788628b319baa8e889407d11ad626547fa), [`1521d71`](https://github.com/mastra-ai/mastra/commit/1521d716e5daedc74690c983fbd961123c56756b), [`9e1911d`](https://github.com/mastra-ai/mastra/commit/9e1911db2b4db85e0e768c3f15e0d61e319869f6), [`ebac155`](https://github.com/mastra-ai/mastra/commit/ebac15564a590117db7078233f927a7e28a85106), [`dd1c38d`](https://github.com/mastra-ai/mastra/commit/dd1c38d1b75f1b695c27b40d8d9d6ed00d5e0f6f), [`5948e6a`](https://github.com/mastra-ai/mastra/commit/5948e6a5146c83666ba3f294b2be576c82a513fb), [`8940859`](https://github.com/mastra-ai/mastra/commit/89408593658199b4ad67f7b65e888f344e64a442), [`e629310`](https://github.com/mastra-ai/mastra/commit/e629310f1a73fa236d49ec7a1d1cceb6229dc7cc), [`4c6b492`](https://github.com/mastra-ai/mastra/commit/4c6b492c4dd591c6a592520c1f6855d6e936d71f), [`dff01d8`](https://github.com/mastra-ai/mastra/commit/dff01d81ce1f4e4087cfac20fa868e6db138dd14), [`9d819d5`](https://github.com/mastra-ai/mastra/commit/9d819d54b61481639f4008e4694791bddf187edd), [`71c8d6c`](https://github.com/mastra-ai/mastra/commit/71c8d6c161253207b2b9588bdadb7eed604f7253), [`6179a9b`](https://github.com/mastra-ai/mastra/commit/6179a9ba36ffac326de3cc3c43cdc8028d37c251), [`00f4921`](https://github.com/mastra-ai/mastra/commit/00f4921dd2c91a1e5446799599ef7116a8214a1a), [`ca8041c`](https://github.com/mastra-ai/mastra/commit/ca8041cce0379fda22ed293a565bcb5b6ddca68a), [`7051bf3`](https://github.com/mastra-ai/mastra/commit/7051bf38b3b122a069008f861f7bfc004a6d9f6e), [`a8f1494`](https://github.com/mastra-ai/mastra/commit/a8f1494f4bbdc2770bcf327d4c7d869e332183f1), [`0793497`](https://github.com/mastra-ai/mastra/commit/079349753620c40246ffd673e3f9d7d9820beff3), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`a854ede`](https://github.com/mastra-ai/mastra/commit/a854ede62bf5ac0945a624ac48913dd69c73aabf), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`3defc80`](https://github.com/mastra-ai/mastra/commit/3defc80cf2b88a1b7fc1cc4ddcb91e982a614609), [`16153fe`](https://github.com/mastra-ai/mastra/commit/16153fe7eb13c99401f48e6ca32707c965ee28b9), [`9f4a683`](https://github.com/mastra-ai/mastra/commit/9f4a6833e88b52574665c028fd5508ad5c2f6004), [`bc94344`](https://github.com/mastra-ai/mastra/commit/bc943444a1342d8a662151b7bce1df7dae32f59c), [`57d157f`](https://github.com/mastra-ai/mastra/commit/57d157f0b163a95c3e6c9eae31bdb11d1bfc64f9), [`903f67d`](https://github.com/mastra-ai/mastra/commit/903f67d184504a273893818c02b961f5423a79ad), [`2a90c55`](https://github.com/mastra-ai/mastra/commit/2a90c55a86a9210697d5adaab5ee94584b079adc), [`eb09742`](https://github.com/mastra-ai/mastra/commit/eb09742197f66c4c38154c3beec78313e69760b2), [`96d35f6`](https://github.com/mastra-ai/mastra/commit/96d35f61376bc2b1bf148648a2c1985bd51bef55), [`5cbe88a`](https://github.com/mastra-ai/mastra/commit/5cbe88aefbd9f933bca669fd371ea36bf939ac6d), [`a1bd7b8`](https://github.com/mastra-ai/mastra/commit/a1bd7b8571db16b94eb01588f451a74758c96d65), [`d78b38d`](https://github.com/mastra-ai/mastra/commit/d78b38d898fce285260d3bbb4befade54331617f), [`0633100`](https://github.com/mastra-ai/mastra/commit/0633100a911ad22f5256471bdf753da21c104742), [`c710c16`](https://github.com/mastra-ai/mastra/commit/c710c1652dccfdc4111c8412bca7a6bb1d48b441), [`354ad0b`](https://github.com/mastra-ai/mastra/commit/354ad0b7b1b8183ac567f236a884fc7ede6d7138), [`cfae733`](https://github.com/mastra-ai/mastra/commit/cfae73394f4920635e6c919c8e95ff9a0788e2e5), [`e3dfda7`](https://github.com/mastra-ai/mastra/commit/e3dfda7b11bf3b8c4bb55637028befb5f387fc74), [`844ea5d`](https://github.com/mastra-ai/mastra/commit/844ea5dc0c248961e7bf73629ae7dcff503e853c), [`398fde3`](https://github.com/mastra-ai/mastra/commit/398fde3f39e707cda79372cdae8f9870e3b57c8d), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`0d7618b`](https://github.com/mastra-ai/mastra/commit/0d7618bc650bf2800934b243eca5648f4aeed9c2), [`7b763e5`](https://github.com/mastra-ai/mastra/commit/7b763e52fc3eaf699c2a99f2adf418dd46e4e9a5), [`d36cfbb`](https://github.com/mastra-ai/mastra/commit/d36cfbbb6565ba5f827883cc9bb648eb14befdc1), [`3697853`](https://github.com/mastra-ai/mastra/commit/3697853deeb72017d90e0f38a93c1e29221aeca0), [`b2e45ec`](https://github.com/mastra-ai/mastra/commit/b2e45eca727a8db01a81ba93f1a5219c7183c839), [`d6d49f7`](https://github.com/mastra-ai/mastra/commit/d6d49f7b8714fa19a52ff9c7cf7fb7e73751901e), [`a534e95`](https://github.com/mastra-ai/mastra/commit/a534e9591f83b3cc1ebff99c67edf4cda7bf81d3), [`9d0e7fe`](https://github.com/mastra-ai/mastra/commit/9d0e7feca8ed98de959f53476ee1456073673348), [`53d927c`](https://github.com/mastra-ai/mastra/commit/53d927cc6f03bff33655b7e2b788da445a08731d), [`3f2faf2`](https://github.com/mastra-ai/mastra/commit/3f2faf2e2d685d6c053cc5af1bf9fedf267b2ce5), [`22f64bc`](https://github.com/mastra-ai/mastra/commit/22f64bc1d37149480b58bf2fefe35b79a1e3e7d5), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc), [`b7959e6`](https://github.com/mastra-ai/mastra/commit/b7959e6e25a46b480f9ea2217c4c6c588c423791), [`bda6370`](https://github.com/mastra-ai/mastra/commit/bda637009360649aaf579919e7873e33553c273e), [`d7acd8e`](https://github.com/mastra-ai/mastra/commit/d7acd8e987b5d7eff4fd98b0906c17c06a2e83d5), [`c7f1f7d`](https://github.com/mastra-ai/mastra/commit/c7f1f7d24f61f247f018cc2d1f33bf63212959a7), [`0bddc6d`](https://github.com/mastra-ai/mastra/commit/0bddc6d8dbd6f6008c0cba2e4960a2da75a55af1), [`735d8c1`](https://github.com/mastra-ai/mastra/commit/735d8c1c0d19fbc09e6f8b66cf41bc7655993838), [`acf322e`](https://github.com/mastra-ai/mastra/commit/acf322e0f1fd0189684cf529d91c694bea918a45), [`c942802`](https://github.com/mastra-ai/mastra/commit/c942802a477a925b01859a7b8688d4355715caaa), [`a0c8c1b`](https://github.com/mastra-ai/mastra/commit/a0c8c1b87d4fee252aebda73e8637fbe01d761c9), [`cc34739`](https://github.com/mastra-ai/mastra/commit/cc34739c34b6266a91bea561119240a7acf47887), [`c218bd3`](https://github.com/mastra-ai/mastra/commit/c218bd3759e32423735b04843a09404572631014), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3), [`2b8893c`](https://github.com/mastra-ai/mastra/commit/2b8893cb108ef9acb72ee7835cd625610d2c1a4a), [`8e5c75b`](https://github.com/mastra-ai/mastra/commit/8e5c75bdb1d08a42d45309a4c72def4b6890230f), [`e59e0d3`](https://github.com/mastra-ai/mastra/commit/e59e0d32afb5fcf2c9f3c00c8f81f6c21d3a63fa), [`fa8409b`](https://github.com/mastra-ai/mastra/commit/fa8409bc39cfd8ba6643b9db5269b90b22e2a2f7), [`173c535`](https://github.com/mastra-ai/mastra/commit/173c535c0645b0da404fe09f003778f0b0d4e019)]:
|
|
24
|
+
- @mastra/core@1.0.0-beta.0
|
|
29
25
|
|
|
30
26
|
## 0.11.14
|
|
31
27
|
|
package/dist/index.cjs
CHANGED
|
@@ -88,23 +88,17 @@ var PineconeVector = class extends vector.MastraVector {
|
|
|
88
88
|
client;
|
|
89
89
|
/**
|
|
90
90
|
* Creates a new PineconeVector client.
|
|
91
|
+
* @param id - The unique identifier for this vector store instance.
|
|
91
92
|
* @param apiKey - The API key for Pinecone.
|
|
92
93
|
* @param environment - The environment for Pinecone.
|
|
93
94
|
*/
|
|
94
|
-
constructor({ apiKey, environment }) {
|
|
95
|
-
super();
|
|
95
|
+
constructor({ id, apiKey, environment }) {
|
|
96
|
+
super({ id });
|
|
96
97
|
const opts = { apiKey };
|
|
97
98
|
if (environment) {
|
|
98
99
|
opts["controllerHostUrl"] = environment;
|
|
99
100
|
}
|
|
100
|
-
|
|
101
|
-
const telemetry = this.__getTelemetry();
|
|
102
|
-
this.client = telemetry?.traceClass(baseClient, {
|
|
103
|
-
spanNamePrefix: "pinecone-vector",
|
|
104
|
-
attributes: {
|
|
105
|
-
"vector.type": "pinecone"
|
|
106
|
-
}
|
|
107
|
-
}) ?? baseClient;
|
|
101
|
+
this.client = new pinecone.Pinecone(opts);
|
|
108
102
|
}
|
|
109
103
|
get indexSeparator() {
|
|
110
104
|
return "-";
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/vector/filter.ts","../src/vector/index.ts","../src/vector/prompt.ts"],"names":["BaseFilterTranslator","MastraVector","Pinecone","MastraError","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,IAAA,EAA4B,WAAA,GAAsB,EAAA,EAAS;AAC/E,IAAA,IAAI,IAAA,CAAK,OAAA,CAAQ,IAAI,CAAA,EAAG;AACtB,MAAA,MAAM,IAAI,MAAM,oCAAoC,CAAA;AAAA,IACtD;AACA,IAAA,IAAI,KAAK,WAAA,CAAY,IAAI,GAAG,OAAO,IAAA,CAAK,yBAAyB,IAAI,CAAA;AACrE,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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,SAASA,OAAA,EAAO;AACd,MAAA,MAAM,IAAIH,iBAAA;AAAA,QACR;AAAA,UACE,EAAA,EAAI,8CAAA;AAAA,UACJ,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;;;ACvWO,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 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\n /**\n * Creates a new PineconeVector client.\n * @param apiKey - The API key for Pinecone.\n * @param environment - The environment for Pinecone.\n */\n constructor({ apiKey, environment }: { apiKey: string; environment?: string }) {\n super();\n const opts: { apiKey: string; controllerHostUrl?: string } = { apiKey };\n if (environment) {\n opts['controllerHostUrl'] = environment;\n }\n const baseClient = new Pinecone(opts);\n const telemetry = this.__getTelemetry();\n this.client =\n telemetry?.traceClass(baseClient, {\n spanNamePrefix: 'pinecone-vector',\n attributes: {\n 'vector.type': 'pinecone',\n },\n }) ?? baseClient;\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: 'aws',\n region: 'us-east-1',\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","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,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A;AAAG,SAC3B;AAAA,QACAC;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,SAASA,OAAA,EAAO;AACd,MAAA,MAAM,IAAIH,iBAAA;AAAA,QACR;AAAA,UACE,EAAA,EAAI,8CAAA;AAAA,UACJ,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;;;AChWO,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 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\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 */\n constructor({ id, apiKey, environment }: { id: string; apiKey: string; environment?: string }) {\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 }\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: 'aws',\n region: 'us-east-1',\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"]}
|
package/dist/index.js
CHANGED
|
@@ -86,23 +86,17 @@ var PineconeVector = class extends MastraVector {
|
|
|
86
86
|
client;
|
|
87
87
|
/**
|
|
88
88
|
* Creates a new PineconeVector client.
|
|
89
|
+
* @param id - The unique identifier for this vector store instance.
|
|
89
90
|
* @param apiKey - The API key for Pinecone.
|
|
90
91
|
* @param environment - The environment for Pinecone.
|
|
91
92
|
*/
|
|
92
|
-
constructor({ apiKey, environment }) {
|
|
93
|
-
super();
|
|
93
|
+
constructor({ id, apiKey, environment }) {
|
|
94
|
+
super({ id });
|
|
94
95
|
const opts = { apiKey };
|
|
95
96
|
if (environment) {
|
|
96
97
|
opts["controllerHostUrl"] = environment;
|
|
97
98
|
}
|
|
98
|
-
|
|
99
|
-
const telemetry = this.__getTelemetry();
|
|
100
|
-
this.client = telemetry?.traceClass(baseClient, {
|
|
101
|
-
spanNamePrefix: "pinecone-vector",
|
|
102
|
-
attributes: {
|
|
103
|
-
"vector.type": "pinecone"
|
|
104
|
-
}
|
|
105
|
-
}) ?? baseClient;
|
|
99
|
+
this.client = new Pinecone(opts);
|
|
106
100
|
}
|
|
107
101
|
get indexSeparator() {
|
|
108
102
|
return "-";
|
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,EAA4B,WAAA,GAAsB,EAAA,EAAS;AAC/E,IAAA,IAAI,IAAA,CAAK,OAAA,CAAQ,IAAI,CAAA,EAAG;AACtB,MAAA,MAAM,IAAI,MAAM,oCAAoC,CAAA;AAAA,IACtD;AACA,IAAA,IAAI,KAAK,WAAA,CAAY,IAAI,GAAG,OAAO,IAAA,CAAK,yBAAyB,IAAI,CAAA;AACrE,IAAA,IAAI,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,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;;;ACvWO,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 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\n /**\n * Creates a new PineconeVector client.\n * @param apiKey - The API key for Pinecone.\n * @param environment - The environment for Pinecone.\n */\n constructor({ apiKey, environment }: { apiKey: string; environment?: string }) {\n super();\n const opts: { apiKey: string; controllerHostUrl?: string } = { apiKey };\n if (environment) {\n opts['controllerHostUrl'] = environment;\n }\n const baseClient = new Pinecone(opts);\n const telemetry = this.__getTelemetry();\n this.client =\n telemetry?.traceClass(baseClient, {\n spanNamePrefix: 'pinecone-vector',\n attributes: {\n 'vector.type': 'pinecone',\n },\n }) ?? baseClient;\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: 'aws',\n region: 'us-east-1',\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,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,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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;;;AChWO,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 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\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 */\n constructor({ id, apiKey, environment }: { id: string; apiKey: string; environment?: string }) {\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 }\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: 'aws',\n region: 'us-east-1',\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"]}
|
package/dist/vector/index.d.ts
CHANGED
|
@@ -23,10 +23,12 @@ export declare class PineconeVector extends MastraVector<PineconeVectorFilter> {
|
|
|
23
23
|
private client;
|
|
24
24
|
/**
|
|
25
25
|
* Creates a new PineconeVector client.
|
|
26
|
+
* @param id - The unique identifier for this vector store instance.
|
|
26
27
|
* @param apiKey - The API key for Pinecone.
|
|
27
28
|
* @param environment - The environment for Pinecone.
|
|
28
29
|
*/
|
|
29
|
-
constructor({ apiKey, environment }: {
|
|
30
|
+
constructor({ id, apiKey, environment }: {
|
|
31
|
+
id: string;
|
|
30
32
|
apiKey: string;
|
|
31
33
|
environment?: string;
|
|
32
34
|
});
|
|
@@ -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,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,qBAAqB,CAA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C;IAgBtC;;;;;OAKG;IACG,aAAa,CAAC,EAAE,SAAS,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAyB9E,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBlE;;;;;;;;;;OAUG;IACG,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAsCnG;;;;;;;OAOG;IACG,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;CAgB5F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/pinecone",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
4
|
"description": "Pinecone vector store provider for Mastra",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"tsup": "^8.5.0",
|
|
31
31
|
"typescript": "^5.8.3",
|
|
32
32
|
"vitest": "^3.2.4",
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@internal/
|
|
33
|
+
"@mastra/core": "1.0.0-beta.0",
|
|
34
|
+
"@internal/types-builder": "0.0.28",
|
|
35
|
+
"@internal/lint": "0.0.53"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@mastra/core": ">=0.
|
|
38
|
+
"@mastra/core": ">=1.0.0-0 <2.0.0-0"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
41
|
"dist",
|
|
@@ -50,12 +50,8 @@
|
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
52
52
|
},
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"publish-branch": [
|
|
56
|
-
"main",
|
|
57
|
-
"0.x"
|
|
58
|
-
]
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=22.13.0"
|
|
59
55
|
},
|
|
60
56
|
"scripts": {
|
|
61
57
|
"build": "tsup --silent --config tsup.config.ts",
|