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
result+=`The user is connected to the MongoDB cluster${searchIndexesSupported ? " with support for search indexes" : " without any support for search indexes"}.`;
message: "At least one vector field must be defined",
60
-
})
61
-
.describe(
62
-
"Definitions for the vector and filter fields to index, one definition per document. You must specify `vector` for fields that contain vector embeddings and `filter` for additional fields to filter on. At least one vector-type field definition is required."
63
-
),
64
-
});
65
-
66
8
exportclassCreateIndexToolextendsMongoDBToolBase{
9
+
privatevectorSearchIndexDefinition=z.object({
10
+
type: z.literal("vectorSearch"),
11
+
fields: z
12
+
.array(
13
+
z.discriminatedUnion("type",[
14
+
z
15
+
.object({
16
+
type: z.literal("filter"),
17
+
path: z
18
+
.string()
19
+
.describe(
20
+
"Name of the field to index. For nested fields, use dot notation to specify path to embedded fields"
21
+
),
22
+
})
23
+
.strict()
24
+
.describe("Definition for a field that will be used for pre-filtering results."),
25
+
z
26
+
.object({
27
+
type: z.literal("vector"),
28
+
path: z
29
+
.string()
30
+
.describe(
31
+
"Name of the field to index. For nested fields, use dot notation to specify path to embedded fields"
32
+
),
33
+
numDimensions: z
34
+
.number()
35
+
.min(1)
36
+
.max(8192)
37
+
.default(this.config.vectorSearchDimensions)
38
+
.describe(
39
+
"Number of vector dimensions that MongoDB Vector Search enforces at index-time and query-time"
message: "At least one vector field must be defined",
62
+
})
63
+
.describe(
64
+
"Definitions for the vector and filter fields to index, one definition per document. You must specify `vector` for fields that contain vector embeddings and `filter` for additional fields to filter on. At least one vector-type field definition is required."
65
+
),
66
+
});
67
+
67
68
publicname="create-index";
68
69
protecteddescription="Create an index for a collection";
69
70
protectedargsShape={
@@ -76,7 +77,7 @@ export class CreateIndexTool extends MongoDBToolBase {
76
77
type: z.literal("classic"),
77
78
keys: z.object({}).catchall(z.custom<IndexDirection>()).describe("The index definition"),
0 commit comments