You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"MQL filter that can only use pre-filter fields from the index definition. Note to LLM: If unsure, use the `collection-indexes` tool to learn which fields can be used for pre-filtering."
50
+
"MQL filter that can only use filter fields from the index definition. Note to LLM: If unsure, use the `collection-indexes` tool to learn which fields can be used for filtering."
"An array of aggregation stages to execute. $vectorSearch can only appear as the first stage of the aggregation pipeline or as the first stage of a $unionWith subpipeline. When using $vectorSearch, unless the user explicitly asks for the embeddings, $unset any embedding field to avoid reaching context limits."
\`$vectorSearch\` **MUST** be the first stage of the pipeline, or the first stage of a \`$unionWith\` subpipeline.
65
+
### Usage Rules for \`$vectorSearch\`
66
+
- **Unset embeddings:**
67
+
Unless the user explicitly requests the embeddings, add an \`$unset\` stage **at the end of the pipeline** to remove the embedding field and avoid context limits. **The $unset stage in this situation is mandatory**.
68
+
- **Pre-filtering:**
69
+
If the user requests additional filtering, include filters in \`$vectorSearch.filter\` only for pre-filter fields in the vector index.
70
+
NEVER include fields in $vectorSearch.filter that are not part of the vector index.
71
+
- **Post-filtering:**
72
+
For all remaining filters, add a $match stage after $vectorSearch.
73
+
### Note to LLM
74
+
- If unsure which fields are filterable, use the collection-indexes tool to determine valid prefilter fields.
75
+
- If no requested filters are valid prefilters, omit the filter key from $vectorSearch.`
0 commit comments