@mastra/chroma 0.0.0-working-memory-per-user-20250620163010 → 0.0.0-zod-v4-compat-part-2-20250822105954

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/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
1
2
  import { MastraVector } from '@mastra/core/vector';
2
3
  import { ChromaClient } from 'chromadb';
3
4
  import { BaseFilterTranslator } from '@mastra/core/vector/filter';
@@ -123,18 +124,31 @@ var ChromaVector = class extends MastraVector {
123
124
  }
124
125
  }
125
126
  async upsert({ indexName, vectors, metadata, ids, documents }) {
126
- const collection = await this.getCollection(indexName);
127
- const stats = await this.describeIndex({ indexName });
128
- this.validateVectorDimensions(vectors, stats.dimension);
129
- const generatedIds = ids || vectors.map(() => crypto.randomUUID());
130
- const normalizedMetadata = metadata || vectors.map(() => ({}));
131
- await collection.upsert({
132
- ids: generatedIds,
133
- embeddings: vectors,
134
- metadatas: normalizedMetadata,
135
- documents
136
- });
137
- return generatedIds;
127
+ try {
128
+ const collection = await this.getCollection(indexName);
129
+ const stats = await this.describeIndex({ indexName });
130
+ this.validateVectorDimensions(vectors, stats.dimension);
131
+ const generatedIds = ids || vectors.map(() => crypto.randomUUID());
132
+ const normalizedMetadata = metadata || vectors.map(() => ({}));
133
+ await collection.upsert({
134
+ ids: generatedIds,
135
+ embeddings: vectors,
136
+ metadatas: normalizedMetadata,
137
+ documents
138
+ });
139
+ return generatedIds;
140
+ } catch (error) {
141
+ if (error instanceof MastraError) throw error;
142
+ throw new MastraError(
143
+ {
144
+ id: "CHROMA_VECTOR_UPSERT_FAILED",
145
+ domain: ErrorDomain.MASTRA_VECTOR,
146
+ category: ErrorCategory.THIRD_PARTY,
147
+ details: { indexName }
148
+ },
149
+ error
150
+ );
151
+ }
138
152
  }
139
153
  HnswSpaceMap = {
140
154
  cosine: "cosine",
@@ -145,11 +159,23 @@ var ChromaVector = class extends MastraVector {
145
159
  };
146
160
  async createIndex({ indexName, dimension, metric = "cosine" }) {
147
161
  if (!Number.isInteger(dimension) || dimension <= 0) {
148
- throw new Error("Dimension must be a positive integer");
162
+ throw new MastraError({
163
+ id: "CHROMA_VECTOR_CREATE_INDEX_INVALID_DIMENSION",
164
+ text: "Dimension must be a positive integer",
165
+ domain: ErrorDomain.MASTRA_VECTOR,
166
+ category: ErrorCategory.USER,
167
+ details: { dimension }
168
+ });
149
169
  }
150
170
  const hnswSpace = this.HnswSpaceMap[metric];
151
- if (!["cosine", "l2", "ip"].includes(hnswSpace)) {
152
- throw new Error(`Invalid metric: "${metric}". Must be one of: cosine, euclidean, dotproduct`);
171
+ if (!hnswSpace || !["cosine", "l2", "ip"].includes(hnswSpace)) {
172
+ throw new MastraError({
173
+ id: "CHROMA_VECTOR_CREATE_INDEX_INVALID_METRIC",
174
+ text: `Invalid metric: "${metric}". Must be one of: cosine, euclidean, dotproduct`,
175
+ domain: ErrorDomain.MASTRA_VECTOR,
176
+ category: ErrorCategory.USER,
177
+ details: { metric }
178
+ });
153
179
  }
154
180
  try {
155
181
  await this.client.createCollection({
@@ -165,7 +191,15 @@ var ChromaVector = class extends MastraVector {
165
191
  await this.validateExistingIndex(indexName, dimension, metric);
166
192
  return;
167
193
  }
168
- throw error;
194
+ throw new MastraError(
195
+ {
196
+ id: "CHROMA_VECTOR_CREATE_INDEX_FAILED",
197
+ domain: ErrorDomain.MASTRA_VECTOR,
198
+ category: ErrorCategory.THIRD_PARTY,
199
+ details: { indexName }
200
+ },
201
+ error
202
+ );
169
203
  }
170
204
  }
171
205
  transformFilter(filter) {
@@ -180,27 +214,51 @@ var ChromaVector = class extends MastraVector {
180
214
  includeVector = false,
181
215
  documentFilter
182
216
  }) {
183
- const collection = await this.getCollection(indexName, true);
184
- const defaultInclude = ["documents", "metadatas", "distances"];
185
- const translatedFilter = this.transformFilter(filter);
186
- const results = await collection.query({
187
- queryEmbeddings: [queryVector],
188
- nResults: topK,
189
- where: translatedFilter,
190
- whereDocument: documentFilter,
191
- include: includeVector ? [...defaultInclude, "embeddings"] : defaultInclude
192
- });
193
- return (results.ids[0] || []).map((id, index) => ({
194
- id,
195
- score: results.distances?.[0]?.[index] || 0,
196
- metadata: results.metadatas?.[0]?.[index] || {},
197
- document: results.documents?.[0]?.[index],
198
- ...includeVector && { vector: results.embeddings?.[0]?.[index] || [] }
199
- }));
217
+ try {
218
+ const collection = await this.getCollection(indexName, true);
219
+ const defaultInclude = ["documents", "metadatas", "distances"];
220
+ const translatedFilter = this.transformFilter(filter);
221
+ const results = await collection.query({
222
+ queryEmbeddings: [queryVector],
223
+ nResults: topK,
224
+ where: translatedFilter,
225
+ whereDocument: documentFilter,
226
+ include: includeVector ? [...defaultInclude, "embeddings"] : defaultInclude
227
+ });
228
+ return (results.ids[0] || []).map((id, index) => ({
229
+ id,
230
+ score: results.distances?.[0]?.[index] || 0,
231
+ metadata: results.metadatas?.[0]?.[index] || {},
232
+ document: results.documents?.[0]?.[index],
233
+ ...includeVector && { vector: results.embeddings?.[0]?.[index] || [] }
234
+ }));
235
+ } catch (error) {
236
+ if (error instanceof MastraError) throw error;
237
+ throw new MastraError(
238
+ {
239
+ id: "CHROMA_VECTOR_QUERY_FAILED",
240
+ domain: ErrorDomain.MASTRA_VECTOR,
241
+ category: ErrorCategory.THIRD_PARTY,
242
+ details: { indexName }
243
+ },
244
+ error
245
+ );
246
+ }
200
247
  }
201
248
  async listIndexes() {
202
- const collections = await this.client.listCollections();
203
- return collections.map((collection) => collection);
249
+ try {
250
+ const collections = await this.client.listCollections();
251
+ return collections.map((collection) => collection);
252
+ } catch (error) {
253
+ throw new MastraError(
254
+ {
255
+ id: "CHROMA_VECTOR_LIST_INDEXES_FAILED",
256
+ domain: ErrorDomain.MASTRA_VECTOR,
257
+ category: ErrorCategory.THIRD_PARTY
258
+ },
259
+ error
260
+ );
261
+ }
204
262
  }
205
263
  /**
206
264
  * Retrieves statistics about a vector index.
@@ -209,19 +267,44 @@ var ChromaVector = class extends MastraVector {
209
267
  * @returns A promise that resolves to the index statistics including dimension, count and metric
210
268
  */
211
269
  async describeIndex({ indexName }) {
212
- const collection = await this.getCollection(indexName);
213
- const count = await collection.count();
214
- const metadata = collection.metadata;
215
- const hnswSpace = metadata?.["hnsw:space"];
216
- return {
217
- dimension: metadata?.dimension || 0,
218
- count,
219
- metric: this.HnswSpaceMap[hnswSpace]
220
- };
270
+ try {
271
+ const collection = await this.getCollection(indexName);
272
+ const count = await collection.count();
273
+ const metadata = collection.metadata;
274
+ const hnswSpace = metadata?.["hnsw:space"];
275
+ return {
276
+ dimension: metadata?.dimension || 0,
277
+ count,
278
+ metric: this.HnswSpaceMap[hnswSpace]
279
+ };
280
+ } catch (error) {
281
+ if (error instanceof MastraError) throw error;
282
+ throw new MastraError(
283
+ {
284
+ id: "CHROMA_VECTOR_DESCRIBE_INDEX_FAILED",
285
+ domain: ErrorDomain.MASTRA_VECTOR,
286
+ category: ErrorCategory.THIRD_PARTY,
287
+ details: { indexName }
288
+ },
289
+ error
290
+ );
291
+ }
221
292
  }
222
293
  async deleteIndex({ indexName }) {
223
- await this.client.deleteCollection({ name: indexName });
224
- this.collections.delete(indexName);
294
+ try {
295
+ await this.client.deleteCollection({ name: indexName });
296
+ this.collections.delete(indexName);
297
+ } catch (error) {
298
+ throw new MastraError(
299
+ {
300
+ id: "CHROMA_VECTOR_DELETE_INDEX_FAILED",
301
+ domain: ErrorDomain.MASTRA_VECTOR,
302
+ category: ErrorCategory.THIRD_PARTY,
303
+ details: { indexName }
304
+ },
305
+ error
306
+ );
307
+ }
225
308
  }
226
309
  /**
227
310
  * Updates a vector by its ID with the provided vector and/or metadata.
@@ -234,10 +317,16 @@ var ChromaVector = class extends MastraVector {
234
317
  * @throws Will throw an error if no updates are provided or if the update operation fails.
235
318
  */
236
319
  async updateVector({ indexName, id, update }) {
320
+ if (!update.vector && !update.metadata) {
321
+ throw new MastraError({
322
+ id: "CHROMA_VECTOR_UPDATE_NO_PAYLOAD",
323
+ text: "No updates provided for vector",
324
+ domain: ErrorDomain.MASTRA_VECTOR,
325
+ category: ErrorCategory.USER,
326
+ details: { indexName, id }
327
+ });
328
+ }
237
329
  try {
238
- if (!update.vector && !update.metadata) {
239
- throw new Error("No updates provided");
240
- }
241
330
  const collection = await this.getCollection(indexName, true);
242
331
  const updateOptions = { ids: [id] };
243
332
  if (update?.vector) {
@@ -250,22 +339,33 @@ var ChromaVector = class extends MastraVector {
250
339
  }
251
340
  return await collection.update(updateOptions);
252
341
  } catch (error) {
253
- throw new Error(`Failed to update vector by id: ${id} for index name: ${indexName}: ${error.message}`);
342
+ if (error instanceof MastraError) throw error;
343
+ throw new MastraError(
344
+ {
345
+ id: "CHROMA_VECTOR_UPDATE_FAILED",
346
+ domain: ErrorDomain.MASTRA_VECTOR,
347
+ category: ErrorCategory.THIRD_PARTY,
348
+ details: { indexName, id }
349
+ },
350
+ error
351
+ );
254
352
  }
255
353
  }
256
- /**
257
- * Deletes a vector by its ID.
258
- * @param indexName - The name of the index containing the vector.
259
- * @param id - The ID of the vector to delete.
260
- * @returns A promise that resolves when the deletion is complete.
261
- * @throws Will throw an error if the deletion operation fails.
262
- */
263
354
  async deleteVector({ indexName, id }) {
264
355
  try {
265
356
  const collection = await this.getCollection(indexName, true);
266
357
  await collection.delete({ ids: [id] });
267
358
  } catch (error) {
268
- throw new Error(`Failed to delete vector by id: ${id} for index name: ${indexName}: ${error.message}`);
359
+ if (error instanceof MastraError) throw error;
360
+ throw new MastraError(
361
+ {
362
+ id: "CHROMA_VECTOR_DELETE_FAILED",
363
+ domain: ErrorDomain.MASTRA_VECTOR,
364
+ category: ErrorCategory.THIRD_PARTY,
365
+ details: { indexName, id }
366
+ },
367
+ error
368
+ );
269
369
  }
270
370
  }
271
371
  };
@@ -341,3 +441,5 @@ Example Complex Query:
341
441
  }`;
342
442
 
343
443
  export { CHROMA_PROMPT, ChromaVector };
444
+ //# sourceMappingURL=index.js.map
445
+ //# s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UACpB,UAAU,aAAA,CAAc,WAAA;AAAA,UACxB,OAAA,EAAS,EAAE,SAAA,EAAW,EAAA;AAAG,SAC3B;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAAA,EACF;AACF;;;AC/UO,IAAM,aAAA,GAAgB,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,CAAA","file":"index.js","sourcesContent":["import { BaseFilterTranslator } from '@mastra/core/vector/filter';\nimport type {\n VectorFilter,\n OperatorSupport,\n QueryOperator,\n OperatorValueMap,\n LogicalOperatorValueMap,\n BlacklistedRootOperators,\n} from '@mastra/core/vector/filter';\n\ntype ChromaOperatorValueMap = Omit<OperatorValueMap, '$exists' | '$elemMatch' | '$regex' | '$options'>;\n\ntype ChromaLogicalOperatorValueMap = Omit<LogicalOperatorValueMap, '$nor' | '$not'>;\n\ntype ChromaBlacklisted = BlacklistedRootOperators | '$nor' | '$not';\n\nexport type ChromaVectorFilter = VectorFilter<\n keyof ChromaOperatorValueMap,\n ChromaOperatorValueMap,\n ChromaLogicalOperatorValueMap,\n ChromaBlacklisted\n>;\n\ntype ChromaDocumentOperatorValueMap = ChromaOperatorValueMap;\n\ntype ChromaDocumentBlacklisted = Exclude<ChromaBlacklisted, '$contains'>;\n\nexport type ChromaVectorDocumentFilter = VectorFilter<\n keyof ChromaDocumentOperatorValueMap,\n ChromaDocumentOperatorValueMap,\n ChromaLogicalOperatorValueMap,\n ChromaDocumentBlacklisted\n>;\n\n/**\n * Translator for Chroma filter queries.\n * Maintains MongoDB-compatible syntax while ensuring proper validation\n * and normalization of values.\n */\nexport class ChromaFilterTranslator extends BaseFilterTranslator<ChromaVectorFilter> {\n protected override getSupportedOperators(): OperatorSupport {\n return {\n ...BaseFilterTranslator.DEFAULT_OPERATORS,\n logical: ['$and', '$or'],\n array: ['$in', '$nin'],\n element: [],\n regex: [],\n custom: [],\n };\n }\n\n translate(filter?: ChromaVectorFilter): ChromaVectorFilter {\n if (this.isEmpty(filter)) return filter;\n this.validateFilter(filter);\n\n return this.translateNode(filter);\n }\n\n private translateNode(node: ChromaVectorFilter, currentPath: string = ''): any {\n // Handle primitive values and arrays\n if (this.isRegex(node)) {\n throw new Error('Regex is not supported in Chroma');\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 // 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);\n return this.isLogicalOperator(operator) ? { [operator]: translated } : translated;\n }\n\n // Process each entry\n const result: Record<string, any> = {};\n const multiOperatorConditions: 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);\n continue;\n }\n\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n // Check for multiple operators on same field\n const valueEntries = Object.entries(value);\n if (valueEntries.every(([op]) => this.isOperator(op)) && valueEntries.length > 1) {\n valueEntries.forEach(([op, opValue]) => {\n multiOperatorConditions.push({\n [newPath]: { [op]: this.normalizeComparisonValue(opValue) },\n });\n });\n continue;\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 // If we have multiple operators, return them combined with $and\n if (multiOperatorConditions.length > 0) {\n return { $and: multiOperatorConditions };\n }\n\n // Wrap in $and if there are multiple top-level fields\n if (Object.keys(result).length > 1 && !currentPath) {\n return {\n $and: Object.entries(result).map(([key, value]) => ({ [key]: value })),\n };\n }\n\n return result;\n }\n\n private translateOperator(operator: QueryOperator, value: any): any {\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 { ChromaClient } from 'chromadb';\nimport type { UpdateRecordsParams, Collection } from 'chromadb';\nimport type { ChromaVectorDocumentFilter, ChromaVectorFilter } from './filter';\nimport { ChromaFilterTranslator } from './filter';\n\ninterface ChromaUpsertVectorParams extends UpsertVectorParams {\n documents?: string[];\n}\n\ninterface ChromaQueryVectorParams extends QueryVectorParams<ChromaVectorFilter> {\n documentFilter?: ChromaVectorDocumentFilter;\n}\n\nexport class ChromaVector extends MastraVector<ChromaVectorFilter> {\n private client: ChromaClient;\n private collections: Map<string, any>;\n\n constructor({\n path,\n auth,\n }: {\n path: string;\n auth?: {\n provider: string;\n credentials: string;\n };\n }) {\n super();\n this.client = new ChromaClient({\n path,\n auth,\n });\n this.collections = new Map();\n }\n\n async getCollection(indexName: string, throwIfNotExists: boolean = true) {\n try {\n const collection = await this.client.getCollection({ name: indexName, embeddingFunction: undefined as any });\n this.collections.set(indexName, collection);\n } catch {\n if (throwIfNotExists) {\n throw new Error(`Index ${indexName} does not exist`);\n }\n return null;\n }\n return this.collections.get(indexName);\n }\n\n private validateVectorDimensions(vectors: number[][], dimension: number): void {\n for (let i = 0; i < vectors.length; i++) {\n if (vectors?.[i]?.length !== dimension) {\n throw new Error(\n `Vector at index ${i} has invalid dimension ${vectors?.[i]?.length}. Expected ${dimension} dimensions.`,\n );\n }\n }\n }\n\n async upsert({ indexName, vectors, metadata, ids, documents }: ChromaUpsertVectorParams): Promise<string[]> {\n try {\n const collection = await this.getCollection(indexName);\n\n const stats = await this.describeIndex({ indexName });\n this.validateVectorDimensions(vectors, stats.dimension);\n const generatedIds = ids || vectors.map(() => crypto.randomUUID());\n const normalizedMetadata = metadata || vectors.map(() => ({}));\n\n await collection.upsert({\n ids: generatedIds,\n embeddings: vectors,\n metadatas: normalizedMetadata,\n documents: documents,\n });\n\n return generatedIds;\n } catch (error: any) {\n if (error instanceof MastraError) throw error;\n throw new MastraError(\n {\n id: 'CHROMA_VECTOR_UPSERT_FAILED',\n domain: ErrorDomain.MASTRA_VECTOR,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName },\n },\n error,\n );\n }\n }\n\n private HnswSpaceMap = {\n cosine: 'cosine',\n euclidean: 'l2',\n dotproduct: 'ip',\n l2: 'euclidean',\n ip: 'dotproduct',\n };\n\n async createIndex({ indexName, dimension, metric = 'cosine' }: CreateIndexParams): Promise<void> {\n if (!Number.isInteger(dimension) || dimension <= 0) {\n throw new MastraError({\n id: 'CHROMA_VECTOR_CREATE_INDEX_INVALID_DIMENSION',\n text: 'Dimension must be a positive integer',\n domain: ErrorDomain.MASTRA_VECTOR,\n category: ErrorCategory.USER,\n details: { dimension },\n });\n }\n const hnswSpace = this.HnswSpaceMap[metric];\n if (!hnswSpace || !['cosine', 'l2', 'ip'].includes(hnswSpace)) {\n throw new MastraError({\n id: 'CHROMA_VECTOR_CREATE_INDEX_INVALID_METRIC',\n text: `Invalid metric: \"${metric}\". Must be one of: cosine, euclidean, dotproduct`,\n domain: ErrorDomain.MASTRA_VECTOR,\n category: ErrorCategory.USER,\n details: { metric },\n });\n }\n try {\n await this.client.createCollection({\n name: indexName,\n metadata: {\n dimension,\n 'hnsw:space': hnswSpace,\n },\n });\n } catch (error: any) {\n // Check for 'already exists' error\n const message = error?.message || error?.toString();\n if (message && message.toLowerCase().includes('already exists')) {\n // Fetch collection info and check dimension\n await this.validateExistingIndex(indexName, dimension, metric);\n return;\n }\n throw new MastraError(\n {\n id: 'CHROMA_VECTOR_CREATE_INDEX_FAILED',\n domain: ErrorDomain.MASTRA_VECTOR,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName },\n },\n error,\n );\n }\n }\n\n transformFilter(filter?: ChromaVectorFilter) {\n const translator = new ChromaFilterTranslator();\n return translator.translate(filter);\n }\n async query({\n indexName,\n queryVector,\n topK = 10,\n filter,\n includeVector = false,\n documentFilter,\n }: ChromaQueryVectorParams): Promise<QueryResult[]> {\n try {\n const collection = await this.getCollection(indexName, true);\n\n const defaultInclude = ['documents', 'metadatas', 'distances'];\n\n const translatedFilter = this.transformFilter(filter);\n const results = await collection.query({\n queryEmbeddings: [queryVector],\n nResults: topK,\n where: translatedFilter,\n whereDocument: documentFilter,\n include: includeVector ? [...defaultInclude, 'embeddings'] : defaultInclude,\n });\n\n return (results.ids[0] || []).map((id: string, index: number) => ({\n id,\n score: results.distances?.[0]?.[index] || 0,\n metadata: results.metadatas?.[0]?.[index] || {},\n document: results.documents?.[0]?.[index],\n ...(includeVector && { vector: results.embeddings?.[0]?.[index] || [] }),\n }));\n } catch (error: any) {\n if (error instanceof MastraError) throw error;\n throw new MastraError(\n {\n id: 'CHROMA_VECTOR_QUERY_FAILED',\n domain: ErrorDomain.MASTRA_VECTOR,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName },\n },\n error,\n );\n }\n }\n\n async listIndexes(): Promise<string[]> {\n try {\n const collections = await this.client.listCollections();\n return collections.map(collection => collection);\n } catch (error: any) {\n throw new MastraError(\n {\n id: 'CHROMA_VECTOR_LIST_INDEXES_FAILED',\n domain: ErrorDomain.MASTRA_VECTOR,\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<IndexStats> {\n try {\n const collection = await this.getCollection(indexName);\n const count = await collection.count();\n const metadata = collection.metadata;\n\n const hnswSpace = metadata?.['hnsw:space'] as 'cosine' | 'l2' | 'ip';\n\n return {\n dimension: metadata?.dimension || 0,\n count,\n metric: this.HnswSpaceMap[hnswSpace] as 'cosine' | 'euclidean' | 'dotproduct',\n };\n } catch (error: any) {\n if (error instanceof MastraError) throw error;\n throw new MastraError(\n {\n id: 'CHROMA_VECTOR_DESCRIBE_INDEX_FAILED',\n domain: ErrorDomain.MASTRA_VECTOR,\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.deleteCollection({ name: indexName });\n this.collections.delete(indexName);\n } catch (error: any) {\n throw new MastraError(\n {\n id: 'CHROMA_VECTOR_DELETE_INDEX_FAILED',\n domain: ErrorDomain.MASTRA_VECTOR,\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 * @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 }: UpdateVectorParams): Promise<void> {\n if (!update.vector && !update.metadata) {\n throw new MastraError({\n id: 'CHROMA_VECTOR_UPDATE_NO_PAYLOAD',\n text: 'No updates provided for vector',\n domain: ErrorDomain.MASTRA_VECTOR,\n category: ErrorCategory.USER,\n details: { indexName, id },\n });\n }\n\n try {\n const collection: Collection = await this.getCollection(indexName, true);\n\n const updateOptions: UpdateRecordsParams = { ids: [id] };\n\n if (update?.vector) {\n const stats = await this.describeIndex({ indexName });\n this.validateVectorDimensions([update.vector], stats.dimension);\n updateOptions.embeddings = [update.vector];\n }\n\n if (update?.metadata) {\n updateOptions.metadatas = [update.metadata];\n }\n\n return await collection.update(updateOptions);\n } catch (error: any) {\n if (error instanceof MastraError) throw error;\n throw new MastraError(\n {\n id: 'CHROMA_VECTOR_UPDATE_FAILED',\n domain: ErrorDomain.MASTRA_VECTOR,\n category: ErrorCategory.THIRD_PARTY,\n details: { indexName, id },\n },\n error,\n );\n }\n }\n\n async deleteVector({ indexName, id }: DeleteVectorParams): Promise<void> {\n try {\n const collection: Collection = await this.getCollection(indexName, true);\n await collection.delete({ ids: [id] });\n } catch (error: any) {\n if (error instanceof MastraError) throw error;\n throw new MastraError(\n {\n id: 'CHROMA_VECTOR_DELETE_FAILED',\n domain: ErrorDomain.MASTRA_VECTOR,\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 Chroma Vector.\n */\nexport const CHROMA_PROMPT = `When querying Chroma, 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\nLogical Operators:\n- $and: Logical AND\n Example: { \"$and\": [{ \"price\": { \"$gt\": 100 } }, { \"category\": \"electronics\" }] }\n- $or: Logical OR\n Example: { \"$or\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n\nRestrictions:\n- Regex patterns are not supported\n- Element operators are not supported\n- Only $and and $or logical operators are supported\n- Nested fields are supported using dot notation\n- Multiple conditions on the same field are supported with both implicit and explicit $and\n- Empty arrays in $in/$nin will return no results\n- If multiple top-level fields exist, they're wrapped in $and\n- Only logical operators ($and, $or) can be used at the top level\n- All other operators must be used within a field condition\n Valid: { \"field\": { \"$gt\": 100 } }\n Valid: { \"$and\": [...] }\n Invalid: { \"$gt\": 100 }\n Invalid: { \"$in\": [...] }\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 { \"$or\": [\n { \"inStock\": true },\n { \"preorder\": true }\n ]}\n ]\n}`;\n"]}
@@ -0,0 +1,22 @@
1
+ import { BaseFilterTranslator } from '@mastra/core/vector/filter';
2
+ import type { VectorFilter, OperatorSupport, OperatorValueMap, LogicalOperatorValueMap, BlacklistedRootOperators } from '@mastra/core/vector/filter';
3
+ type ChromaOperatorValueMap = Omit<OperatorValueMap, '$exists' | '$elemMatch' | '$regex' | '$options'>;
4
+ type ChromaLogicalOperatorValueMap = Omit<LogicalOperatorValueMap, '$nor' | '$not'>;
5
+ type ChromaBlacklisted = BlacklistedRootOperators | '$nor' | '$not';
6
+ export type ChromaVectorFilter = VectorFilter<keyof ChromaOperatorValueMap, ChromaOperatorValueMap, ChromaLogicalOperatorValueMap, ChromaBlacklisted>;
7
+ type ChromaDocumentOperatorValueMap = ChromaOperatorValueMap;
8
+ type ChromaDocumentBlacklisted = Exclude<ChromaBlacklisted, '$contains'>;
9
+ export type ChromaVectorDocumentFilter = VectorFilter<keyof ChromaDocumentOperatorValueMap, ChromaDocumentOperatorValueMap, ChromaLogicalOperatorValueMap, ChromaDocumentBlacklisted>;
10
+ /**
11
+ * Translator for Chroma filter queries.
12
+ * Maintains MongoDB-compatible syntax while ensuring proper validation
13
+ * and normalization of values.
14
+ */
15
+ export declare class ChromaFilterTranslator extends BaseFilterTranslator<ChromaVectorFilter> {
16
+ protected getSupportedOperators(): OperatorSupport;
17
+ translate(filter?: ChromaVectorFilter): ChromaVectorFilter;
18
+ private translateNode;
19
+ private translateOperator;
20
+ }
21
+ export {};
22
+ //# sourceMappingURL=filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/vector/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EAEf,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAEpC,KAAK,sBAAsB,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,YAAY,GAAG,QAAQ,GAAG,UAAU,CAAC,CAAC;AAEvG,KAAK,6BAA6B,GAAG,IAAI,CAAC,uBAAuB,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAEpF,KAAK,iBAAiB,GAAG,wBAAwB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpE,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAC3C,MAAM,sBAAsB,EAC5B,sBAAsB,EACtB,6BAA6B,EAC7B,iBAAiB,CAClB,CAAC;AAEF,KAAK,8BAA8B,GAAG,sBAAsB,CAAC;AAE7D,KAAK,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;AAEzE,MAAM,MAAM,0BAA0B,GAAG,YAAY,CACnD,MAAM,8BAA8B,EACpC,8BAA8B,EAC9B,6BAA6B,EAC7B,yBAAyB,CAC1B,CAAC;AAEF;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,oBAAoB,CAAC,kBAAkB,CAAC;cAC/D,qBAAqB,IAAI,eAAe;IAW3D,SAAS,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,kBAAkB;IAO1D,OAAO,CAAC,aAAa;IA8ErB,OAAO,CAAC,iBAAiB;CAS1B"}
@@ -0,0 +1,50 @@
1
+ import { MastraVector } from '@mastra/core/vector';
2
+ import type { QueryResult, IndexStats, CreateIndexParams, UpsertVectorParams, QueryVectorParams, DescribeIndexParams, DeleteIndexParams, DeleteVectorParams, UpdateVectorParams } from '@mastra/core/vector';
3
+ import type { ChromaVectorDocumentFilter, ChromaVectorFilter } from './filter';
4
+ interface ChromaUpsertVectorParams extends UpsertVectorParams {
5
+ documents?: string[];
6
+ }
7
+ interface ChromaQueryVectorParams extends QueryVectorParams<ChromaVectorFilter> {
8
+ documentFilter?: ChromaVectorDocumentFilter;
9
+ }
10
+ export declare class ChromaVector extends MastraVector<ChromaVectorFilter> {
11
+ private client;
12
+ private collections;
13
+ constructor({ path, auth, }: {
14
+ path: string;
15
+ auth?: {
16
+ provider: string;
17
+ credentials: string;
18
+ };
19
+ });
20
+ getCollection(indexName: string, throwIfNotExists?: boolean): Promise<any>;
21
+ private validateVectorDimensions;
22
+ upsert({ indexName, vectors, metadata, ids, documents }: ChromaUpsertVectorParams): Promise<string[]>;
23
+ private HnswSpaceMap;
24
+ createIndex({ indexName, dimension, metric }: CreateIndexParams): Promise<void>;
25
+ transformFilter(filter?: ChromaVectorFilter): ChromaVectorFilter;
26
+ query({ indexName, queryVector, topK, filter, includeVector, documentFilter, }: ChromaQueryVectorParams): Promise<QueryResult[]>;
27
+ listIndexes(): Promise<string[]>;
28
+ /**
29
+ * Retrieves statistics about a vector index.
30
+ *
31
+ * @param {string} indexName - The name of the index to describe
32
+ * @returns A promise that resolves to the index statistics including dimension, count and metric
33
+ */
34
+ describeIndex({ indexName }: DescribeIndexParams): Promise<IndexStats>;
35
+ deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
36
+ /**
37
+ * Updates a vector by its ID with the provided vector and/or metadata.
38
+ * @param indexName - The name of the index containing the vector.
39
+ * @param id - The ID of the vector to update.
40
+ * @param update - An object containing the vector and/or metadata to update.
41
+ * @param update.vector - An optional array of numbers representing the new vector.
42
+ * @param update.metadata - An optional record containing the new metadata.
43
+ * @returns A promise that resolves when the update is complete.
44
+ * @throws Will throw an error if no updates are provided or if the update operation fails.
45
+ */
46
+ updateVector({ indexName, id, update }: UpdateVectorParams): Promise<void>;
47
+ deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
48
+ }
49
+ export {};
50
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"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SAAS,EACT,WAAW,EACX,IAAS,EACT,MAAM,EACN,aAAqB,EACrB,cAAc,GACf,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAoC7C,WAAW,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAgBtC;;;;;OAKG;IACG,aAAa,CAAC,EAAE,SAAS,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IA2BtE,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBlE;;;;;;;;;OASG;IACG,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAyC1E,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBzE"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Vector store specific prompt that details supported operators and examples.
3
+ * This prompt helps users construct valid filters for Chroma Vector.
4
+ */
5
+ export declare const CHROMA_PROMPT = "When querying Chroma, 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\nLogical Operators:\n- $and: Logical AND\n Example: { \"$and\": [{ \"price\": { \"$gt\": 100 } }, { \"category\": \"electronics\" }] }\n- $or: Logical OR\n Example: { \"$or\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n\nRestrictions:\n- Regex patterns are not supported\n- Element operators are not supported\n- Only $and and $or logical operators are supported\n- Nested fields are supported using dot notation\n- Multiple conditions on the same field are supported with both implicit and explicit $and\n- Empty arrays in $in/$nin will return no results\n- If multiple top-level fields exist, they're wrapped in $and\n- Only logical operators ($and, $or) can be used at the top level\n- All other operators must be used within a field condition\n Valid: { \"field\": { \"$gt\": 100 } }\n Valid: { \"$and\": [...] }\n Invalid: { \"$gt\": 100 }\n Invalid: { \"$in\": [...] }\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 { \"$or\": [\n { \"inStock\": true },\n { \"preorder\": true }\n ]}\n ]\n}";
6
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/vector/prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,aAAa,q8FAmExB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/chroma",
3
- "version": "0.0.0-working-memory-per-user-20250620163010",
3
+ "version": "0.0.0-zod-v4-compat-part-2-20250822105954",
4
4
  "description": "Chroma vector store provider for Mastra",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -25,19 +25,19 @@
25
25
  "devDependencies": {
26
26
  "@microsoft/api-extractor": "^7.52.8",
27
27
  "@types/node": "^20.19.0",
28
- "eslint": "^9.28.0",
28
+ "eslint": "^9.30.1",
29
29
  "tsup": "^8.5.0",
30
30
  "typescript": "^5.8.3",
31
- "vitest": "^3.2.3",
32
- "@mastra/core": "0.0.0-working-memory-per-user-20250620163010",
33
- "@internal/lint": "0.0.0-working-memory-per-user-20250620163010"
31
+ "vitest": "^3.2.4",
32
+ "@internal/lint": "0.0.0-zod-v4-compat-part-2-20250822105954",
33
+ "@mastra/core": "0.0.0-zod-v4-compat-part-2-20250822105954"
34
34
  },
35
35
  "peerDependencies": {
36
- "@mastra/core": "0.0.0-working-memory-per-user-20250620163010"
36
+ "@mastra/core": "0.0.0-zod-v4-compat-part-2-20250822105954"
37
37
  },
38
38
  "scripts": {
39
- "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
40
- "build:watch": "pnpm build --watch",
39
+ "build": "tsup --silent --config tsup.config.ts",
40
+ "build:watch": "tsup --watch --silent --config tsup.config.ts",
41
41
  "test": "vitest run",
42
42
  "lint": "eslint ."
43
43
  }