Skip to content

Commit 428d373

Browse files
committed
fix test
1 parent 88acf38 commit 428d373

File tree

1 file changed

+40
-36
lines changed

1 file changed

+40
-36
lines changed

src/tools/mongodb/create/createIndex.ts

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,46 @@ const vectorSearchIndexDefinition = z.object({
1515
fields: z
1616
.array(
1717
z.discriminatedUnion("type", [
18-
z.object({
19-
type: z.literal("filter"),
20-
path: z
21-
.string()
22-
.describe(
23-
"Name of the field to index. For nested fields, use dot notation to specify path to embedded fields"
24-
),
25-
}),
26-
z.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-
.describe(
38-
"Number of vector dimensions that MongoDB Vector Search enforces at index-time and query-time"
39-
),
40-
similarity: z
41-
.enum(["cosine", "euclidean", "dotProduct"])
42-
.default("cosine")
43-
.describe(
44-
"Vector similarity function to use to search for top K-nearest neighbors. You can set this field only for vector-type fields."
45-
),
46-
quantization: z
47-
.enum(["none", "scalar", "binary"])
48-
.optional()
49-
.default("none")
50-
.describe(
51-
"Type of automatic vector quantization for your vectors. Use this setting only if your embeddings are float or double vectors."
52-
),
53-
}),
18+
z
19+
.object({
20+
type: z.literal("filter"),
21+
path: z
22+
.string()
23+
.describe(
24+
"Name of the field to index. For nested fields, use dot notation to specify path to embedded fields"
25+
),
26+
})
27+
.strict(),
28+
z
29+
.object({
30+
type: z.literal("vector"),
31+
path: z
32+
.string()
33+
.describe(
34+
"Name of the field to index. For nested fields, use dot notation to specify path to embedded fields"
35+
),
36+
numDimensions: z
37+
.number()
38+
.min(1)
39+
.max(8192)
40+
.describe(
41+
"Number of vector dimensions that MongoDB Vector Search enforces at index-time and query-time"
42+
),
43+
similarity: z
44+
.enum(["cosine", "euclidean", "dotProduct"])
45+
.default("cosine")
46+
.describe(
47+
"Vector similarity function to use to search for top K-nearest neighbors. You can set this field only for vector-type fields."
48+
),
49+
quantization: z
50+
.enum(["none", "scalar", "binary"])
51+
.optional()
52+
.default("none")
53+
.describe(
54+
"Type of automatic vector quantization for your vectors. Use this setting only if your embeddings are float or double vectors."
55+
),
56+
})
57+
.strict(),
5458
])
5559
)
5660
.nonempty()

0 commit comments

Comments
 (0)