@mastra/vectorize 0.2.7-alpha.4 → 0.2.7-alpha.6

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.
@@ -40,6 +40,14 @@ declare class CloudflareVector extends MastraVector {
40
40
  export { CloudflareVector }
41
41
  export { CloudflareVector as CloudflareVector_alias_1 }
42
42
 
43
+ /**
44
+ * Vector store specific prompt that details supported operators and examples.
45
+ * This prompt helps users construct valid filters for Vectorize.
46
+ */
47
+ declare const VECTORIZE_PROMPT = "When querying Vectorize, 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 (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- $match: Match text using full-text search\n Example: { \"description\": { \"$match\": \"gaming laptop\" } }\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- 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 { \"description\": { \"$match\": \"gaming laptop\" } },\n { \"rating\": { \"$exists\": true, \"$gt\": 4 } },\n { \"$or\": [\n { \"stock\": { \"$gt\": 0 } },\n { \"preorder\": true }\n ]}\n ]\n}";
48
+ export { VECTORIZE_PROMPT }
49
+ export { VECTORIZE_PROMPT as VECTORIZE_PROMPT_alias_1 }
50
+
43
51
  export declare class VectorizeFilterTranslator extends BaseFilterTranslator {
44
52
  protected getSupportedOperators(): OperatorSupport;
45
53
  translate(filter?: VectorFilter): VectorFilter;
@@ -40,6 +40,14 @@ declare class CloudflareVector extends MastraVector {
40
40
  export { CloudflareVector }
41
41
  export { CloudflareVector as CloudflareVector_alias_1 }
42
42
 
43
+ /**
44
+ * Vector store specific prompt that details supported operators and examples.
45
+ * This prompt helps users construct valid filters for Vectorize.
46
+ */
47
+ declare const VECTORIZE_PROMPT = "When querying Vectorize, 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 (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- $match: Match text using full-text search\n Example: { \"description\": { \"$match\": \"gaming laptop\" } }\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- 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 { \"description\": { \"$match\": \"gaming laptop\" } },\n { \"rating\": { \"$exists\": true, \"$gt\": 4 } },\n { \"$or\": [\n { \"stock\": { \"$gt\": 0 } },\n { \"preorder\": true }\n ]}\n ]\n}";
48
+ export { VECTORIZE_PROMPT }
49
+ export { VECTORIZE_PROMPT as VECTORIZE_PROMPT_alias_1 }
50
+
43
51
  export declare class VectorizeFilterTranslator extends BaseFilterTranslator {
44
52
  protected getSupportedOperators(): OperatorSupport;
45
53
  translate(filter?: VectorFilter): VectorFilter;
package/dist/index.cjs CHANGED
@@ -230,4 +230,83 @@ var CloudflareVector = class extends vector.MastraVector {
230
230
  }
231
231
  };
232
232
 
233
+ // src/vector/prompt.ts
234
+ var VECTORIZE_PROMPT = `When querying Vectorize, you can ONLY use the operators listed below. Any other operators will be rejected.
235
+ Important: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.
236
+ If 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.
237
+
238
+ Basic Comparison Operators:
239
+ - $eq: Exact match (default when using field: value)
240
+ Example: { "category": "electronics" }
241
+ - $ne: Not equal
242
+ Example: { "category": { "$ne": "electronics" } }
243
+ - $gt: Greater than
244
+ Example: { "price": { "$gt": 100 } }
245
+ - $gte: Greater than or equal
246
+ Example: { "price": { "$gte": 100 } }
247
+ - $lt: Less than
248
+ Example: { "price": { "$lt": 100 } }
249
+ - $lte: Less than or equal
250
+ Example: { "price": { "$lte": 100 } }
251
+
252
+ Array Operators:
253
+ - $in: Match any value in array
254
+ Example: { "category": { "$in": ["electronics", "books"] } }
255
+ - $nin: Does not match any value in array
256
+ Example: { "category": { "$nin": ["electronics", "books"] } }
257
+
258
+ Logical Operators:
259
+ - $and: Logical AND (can be implicit or explicit)
260
+ Implicit Example: { "price": { "$gt": 100 }, "category": "electronics" }
261
+ Explicit Example: { "$and": [{ "price": { "$gt": 100 } }, { "category": "electronics" }] }
262
+ - $or: Logical OR
263
+ Example: { "$or": [{ "price": { "$lt": 50 } }, { "category": "books" }] }
264
+
265
+ Element Operators:
266
+ - $exists: Check if field exists
267
+ Example: { "rating": { "$exists": true } }
268
+ - $match: Match text using full-text search
269
+ Example: { "description": { "$match": "gaming laptop" } }
270
+
271
+ Restrictions:
272
+ - Regex patterns are not supported
273
+ - Only $and and $or logical operators are supported at the top level
274
+ - Empty arrays in $in/$nin will return no results
275
+ - Nested fields are supported using dot notation
276
+ - Multiple conditions on the same field are supported with both implicit and explicit $and
277
+ - At least one key-value pair is required in filter object
278
+ - Empty objects and undefined values are treated as no filter
279
+ - Invalid types in comparison operators will throw errors
280
+ - All non-logical operators must be used within a field condition
281
+ Valid: { "field": { "$gt": 100 } }
282
+ Valid: { "$and": [...] }
283
+ Invalid: { "$gt": 100 }
284
+ - Logical operators must contain field conditions, not direct operators
285
+ Valid: { "$and": [{ "field": { "$gt": 100 } }] }
286
+ Invalid: { "$and": [{ "$gt": 100 }] }
287
+ - Logical operators ($and, $or):
288
+ - Can only be used at top level or nested within other logical operators
289
+ - Can not be used on a field level, or be nested inside a field
290
+ - Can not be used inside an operator
291
+ - Valid: { "$and": [{ "field": { "$gt": 100 } }] }
292
+ - Valid: { "$or": [{ "$and": [{ "field": { "$gt": 100 } }] }] }
293
+ - Invalid: { "field": { "$and": [{ "$gt": 100 }] } }
294
+ - Invalid: { "field": { "$or": [{ "$gt": 100 }] } }
295
+ - Invalid: { "field": { "$gt": { "$and": [{...}] } } }
296
+
297
+ Example Complex Query:
298
+ {
299
+ "$and": [
300
+ { "category": { "$in": ["electronics", "computers"] } },
301
+ { "price": { "$gte": 100, "$lte": 1000 } },
302
+ { "description": { "$match": "gaming laptop" } },
303
+ { "rating": { "$exists": true, "$gt": 4 } },
304
+ { "$or": [
305
+ { "stock": { "$gt": 0 } },
306
+ { "preorder": true }
307
+ ]}
308
+ ]
309
+ }`;
310
+
233
311
  exports.CloudflareVector = CloudflareVector;
312
+ exports.VECTORIZE_PROMPT = VECTORIZE_PROMPT;
package/dist/index.d.cts CHANGED
@@ -1 +1,2 @@
1
+ export { VECTORIZE_PROMPT } from './_tsup-dts-rollup.cjs';
1
2
  export { CloudflareVector } from './_tsup-dts-rollup.cjs';
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
+ export { VECTORIZE_PROMPT } from './_tsup-dts-rollup.js';
1
2
  export { CloudflareVector } from './_tsup-dts-rollup.js';
package/dist/index.js CHANGED
@@ -224,4 +224,82 @@ var CloudflareVector = class extends MastraVector {
224
224
  }
225
225
  };
226
226
 
227
- export { CloudflareVector };
227
+ // src/vector/prompt.ts
228
+ var VECTORIZE_PROMPT = `When querying Vectorize, you can ONLY use the operators listed below. Any other operators will be rejected.
229
+ Important: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.
230
+ If 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.
231
+
232
+ Basic Comparison Operators:
233
+ - $eq: Exact match (default when using field: value)
234
+ Example: { "category": "electronics" }
235
+ - $ne: Not equal
236
+ Example: { "category": { "$ne": "electronics" } }
237
+ - $gt: Greater than
238
+ Example: { "price": { "$gt": 100 } }
239
+ - $gte: Greater than or equal
240
+ Example: { "price": { "$gte": 100 } }
241
+ - $lt: Less than
242
+ Example: { "price": { "$lt": 100 } }
243
+ - $lte: Less than or equal
244
+ Example: { "price": { "$lte": 100 } }
245
+
246
+ Array Operators:
247
+ - $in: Match any value in array
248
+ Example: { "category": { "$in": ["electronics", "books"] } }
249
+ - $nin: Does not match any value in array
250
+ Example: { "category": { "$nin": ["electronics", "books"] } }
251
+
252
+ Logical Operators:
253
+ - $and: Logical AND (can be implicit or explicit)
254
+ Implicit Example: { "price": { "$gt": 100 }, "category": "electronics" }
255
+ Explicit Example: { "$and": [{ "price": { "$gt": 100 } }, { "category": "electronics" }] }
256
+ - $or: Logical OR
257
+ Example: { "$or": [{ "price": { "$lt": 50 } }, { "category": "books" }] }
258
+
259
+ Element Operators:
260
+ - $exists: Check if field exists
261
+ Example: { "rating": { "$exists": true } }
262
+ - $match: Match text using full-text search
263
+ Example: { "description": { "$match": "gaming laptop" } }
264
+
265
+ Restrictions:
266
+ - Regex patterns are not supported
267
+ - Only $and and $or logical operators are supported at the top level
268
+ - Empty arrays in $in/$nin will return no results
269
+ - Nested fields are supported using dot notation
270
+ - Multiple conditions on the same field are supported with both implicit and explicit $and
271
+ - At least one key-value pair is required in filter object
272
+ - Empty objects and undefined values are treated as no filter
273
+ - Invalid types in comparison operators will throw errors
274
+ - All non-logical operators must be used within a field condition
275
+ Valid: { "field": { "$gt": 100 } }
276
+ Valid: { "$and": [...] }
277
+ Invalid: { "$gt": 100 }
278
+ - Logical operators must contain field conditions, not direct operators
279
+ Valid: { "$and": [{ "field": { "$gt": 100 } }] }
280
+ Invalid: { "$and": [{ "$gt": 100 }] }
281
+ - Logical operators ($and, $or):
282
+ - Can only be used at top level or nested within other logical operators
283
+ - Can not be used on a field level, or be nested inside a field
284
+ - Can not be used inside an operator
285
+ - Valid: { "$and": [{ "field": { "$gt": 100 } }] }
286
+ - Valid: { "$or": [{ "$and": [{ "field": { "$gt": 100 } }] }] }
287
+ - Invalid: { "field": { "$and": [{ "$gt": 100 }] } }
288
+ - Invalid: { "field": { "$or": [{ "$gt": 100 }] } }
289
+ - Invalid: { "field": { "$gt": { "$and": [{...}] } } }
290
+
291
+ Example Complex Query:
292
+ {
293
+ "$and": [
294
+ { "category": { "$in": ["electronics", "computers"] } },
295
+ { "price": { "$gte": 100, "$lte": 1000 } },
296
+ { "description": { "$match": "gaming laptop" } },
297
+ { "rating": { "$exists": true, "$gt": 4 } },
298
+ { "$or": [
299
+ { "stock": { "$gt": 0 } },
300
+ { "preorder": true }
301
+ ]}
302
+ ]
303
+ }`;
304
+
305
+ export { CloudflareVector, VECTORIZE_PROMPT };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/vectorize",
3
- "version": "0.2.7-alpha.4",
3
+ "version": "0.2.7-alpha.6",
4
4
  "description": "Cloudflare Vectorize store provider for Mastra",
5
5
  "type": "module",
6
6
  "files": [
@@ -24,7 +24,7 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "cloudflare": "^4.1.0",
27
- "@mastra/core": "^0.9.1-alpha.4"
27
+ "@mastra/core": "^0.9.1-alpha.6"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@microsoft/api-extractor": "^7.52.5",