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
Copy file name to clipboardExpand all lines: src/tools/mongodb/create/insertMany.ts
+3-30Lines changed: 3 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -19,16 +19,9 @@ export class InsertManyTool extends MongoDBToolBase {
19
19
"The array of documents to insert, matching the syntax of the document argument of db.collection.insertMany(). For fields that have vector search indexes, you can provide raw text strings that will be automatically converted to embeddings if embeddingParameters is provided."
"An array of objects (one per document) that maps field paths to plain-text content for generating embeddings. Each object should have keys matching the vector search index field paths (in dot notation), with string values containing the text to embed. If provided, these texts will be used to generate embeddings instead of looking for raw text in the document fields themselves. Example: [{'content': 'Input text to create embeddings from for first doc'}, {'content': 'Input text to create embeddings from for second doc'}]"
27
-
),
28
-
})
29
22
.optional()
30
23
.describe(
31
-
"The embedding model and its parameters to use to generate embeddings for fields that have vector search indexes. Required when fields associated with vector search indexes contain raw text strings. Note to LLM: If unsure, ask the user before providing one."
24
+
"The embedding model and its parameters to use to generate embeddings for fields that have vector search indexes. When a field has a vector search index and contains a plain text string in the document, embeddings will be automatically generated from that string value. Note to LLM: If unsure which embedding model to use, ask the user before providing one."
32
25
),
33
26
};
34
27
publicoperationType: OperationType="create";
@@ -37,7 +30,6 @@ export class InsertManyTool extends MongoDBToolBase {
`Fields [${fieldPaths}] have vector search indexes but ${embeddingsInput ? "embeddingsInput contains text for these fields" : "contain raw text strings"}. The embeddingParameters parameter is required to generate embeddings for these fields.`
161
+
`Fields [${fieldPaths}] have vector search indexes and contain raw text strings. The embeddingParameters parameter is required to generate embeddings for these fields.`
Copy file name to clipboardExpand all lines: tests/accuracy/insertMany.embeddings.test.ts
+2-276Lines changed: 2 additions & 276 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ import { Matcher } from "./sdk/matcher.js";
8
8
describeAccuracyTests(
9
9
[
10
10
{
11
-
prompt: "Insert a document into 'mflix.movies' collection with title 'The Matrix' and a plotSummary field with the text 'A computer hacker learns about the true nature of his reality'. Generate embeddings automatically using the voyage-3 model.",
11
+
prompt: "Insert a document into 'mflix.movies' collection with title 'The Matrix' and a plotSummary field with the text 'A computer hacker learns about the true nature of his reality'. Use the plot summary to generate the 'embeddings' field using the voyage-3 model.",
12
12
expectedToolCalls: [
13
13
{
14
14
toolName: "insert-many",
@@ -19,283 +19,9 @@ describeAccuracyTests(
19
19
{
20
20
title: "The Matrix",
21
21
plotSummary: "A computer hacker learns about the true nature of his reality",
22
-
},
23
-
],
24
-
embeddingParameters: {
25
-
model: "voyage-3",
26
-
},
27
-
},
28
-
},
29
-
],
30
-
},
31
-
{
32
-
prompt: "Add a movie to 'mflix.movies' with title 'Inception', year 2010, and plotSummary 'A thief who steals corporate secrets through dream-sharing technology'. Use voyage-3-lite model for automatic embeddings.",
33
-
expectedToolCalls: [
34
-
{
35
-
toolName: "insert-many",
36
-
parameters: {
37
-
database: "mflix",
38
-
collection: "movies",
39
-
documents: [
40
-
{
41
-
title: "Inception",
42
-
year: 2010,
43
-
plotSummary: "A thief who steals corporate secrets through dream-sharing technology",
44
-
},
45
-
],
46
-
embeddingParameters: {
47
-
model: Matcher.string(),
48
-
},
49
-
},
50
-
},
51
-
],
52
-
},
53
-
{
54
-
prompt: "Insert multiple movies into 'mflix.movies' with automatic embeddings using voyage-3 model. Add: 1) 'Avatar' with plot 'A marine on an alien planet', 2) 'Titanic' with plot 'A romance on a doomed ship', 3) 'Jurassic Park' with plot 'Dinosaurs brought back to life'.",
55
-
expectedToolCalls: [
56
-
{
57
-
toolName: "insert-many",
58
-
parameters: {
59
-
database: "mflix",
60
-
collection: "movies",
61
-
documents: [
62
-
{
63
-
title: "Avatar",
64
-
plotSummary: Matcher.string(),
65
-
},
66
-
{
67
-
title: "Titanic",
68
-
plotSummary: Matcher.string(),
69
-
},
70
-
{
71
-
title: "Jurassic Park",
72
-
plotSummary: Matcher.string(),
73
-
},
74
-
],
75
-
embeddingParameters: {
76
-
model: "voyage-3",
77
-
},
78
-
},
79
-
},
80
-
],
81
-
},
82
-
{
83
-
prompt: "Insert a document into 'mflix.movies' with title 'Interstellar' and use embeddingParameters input to provide custom text for plotSummary field: 'Space exploration and time dilation'. Use voyage-3 model.",
84
-
expectedToolCalls: [
85
-
{
86
-
toolName: "insert-many",
87
-
parameters: {
88
-
database: "mflix",
89
-
collection: "movies",
90
-
documents: [
91
-
{
92
-
title: "Interstellar",
93
-
},
94
-
],
95
-
embeddingParameters: {
96
-
model: "voyage-3",
97
-
input: [
98
-
{
99
-
plotSummary: "Space exploration and time dilation",
100
-
},
101
-
],
102
-
},
103
-
},
104
-
},
105
-
],
106
-
},
107
-
{
108
-
prompt: "Add a movie 'The Dark Knight' to 'mflix.movies' with multiple embedding fields. Use raw text 'Batman fights the Joker' for plotSummary and 'Action, Crime, Drama' for genre. Generate embeddings with voyage-3 model.",
109
-
expectedToolCalls: [
110
-
{
111
-
toolName: "insert-many",
112
-
parameters: {
113
-
database: "mflix",
114
-
collection: "movies",
115
-
documents: [
116
-
{
117
-
title: "The Dark Knight",
118
-
plotSummary: Matcher.string(),
119
-
genre: Matcher.string(),
120
-
},
121
-
],
122
-
embeddingParameters: {
123
-
model: "voyage-3",
124
-
},
125
-
},
126
-
},
127
-
],
128
-
},
129
-
{
130
-
prompt: "Insert a document into 'mflix.movies' with title 'Pulp Fiction' and nested embedding field 'embeddings.plot' containing text 'Multiple interconnected crime stories'. Use voyage-3 for automatic embeddings.",
131
-
expectedToolCalls: [
132
-
{
133
-
toolName: "insert-many",
134
-
parameters: {
135
-
database: "mflix",
136
-
collection: "movies",
137
-
documents: [
138
-
{
139
-
title: "Pulp Fiction",
140
22
embeddings: {
141
-
plot: Matcher.string(),
142
-
},
143
-
},
144
-
],
145
-
embeddingParameters: {
146
-
model: "voyage-3",
147
-
},
148
-
},
149
-
},
150
-
],
151
-
},
152
-
{
153
-
prompt: "Insert two documents into 'mflix.movies' using embeddingParameters input for custom text. Add 'Forrest Gump' with input text 'Life is like a box of chocolates' and 'The Godfather' with input text 'An offer you cannot refuse'. Use voyage-3 model.",
154
-
expectedToolCalls: [
155
-
{
156
-
toolName: "insert-many",
157
-
parameters: {
158
-
database: "mflix",
159
-
collection: "movies",
160
-
documents: [
161
-
{
162
-
title: "Forrest Gump",
163
-
},
164
-
{
165
-
title: "The Godfather",
166
-
},
167
-
],
168
-
embeddingParameters: {
169
-
model: "voyage-3",
170
-
input: [
171
-
{
172
-
plotSummary: Matcher.string(),
23
+
plotSummary: "A computer hacker learns about the true nature of his reality",
173
24
},
174
-
{
175
-
plotSummary: Matcher.string(),
176
-
},
177
-
],
178
-
},
179
-
},
180
-
},
181
-
],
182
-
},
183
-
{
184
-
prompt: "Add a movie 'Star Wars' to 'mflix.movies' with mixed approach: provide raw text 'Space opera saga' in plotSummary field and use embeddingParameters input to provide 'Epic space battles' for genre field. Use voyage-3 model.",
185
-
expectedToolCalls: [
186
-
{
187
-
toolName: "insert-many",
188
-
parameters: {
189
-
database: "mflix",
190
-
collection: "movies",
191
-
documents: [
192
-
{
193
-
title: "Star Wars",
194
-
plotSummary: Matcher.string(),
195
-
},
196
-
],
197
-
embeddingParameters: {
198
-
model: "voyage-3",
199
-
input: [
200
-
{
201
-
genre: Matcher.string(),
202
-
},
203
-
],
204
-
},
205
-
},
206
-
},
207
-
],
208
-
},
209
-
{
210
-
prompt: "Insert a document into 'mflix.movies' with title 'Blade Runner' and specify voyage-3-lite model with document inputType for automatic embedding generation. Use text 'Dystopian future with replicants' for plotSummary.",
prompt: "Add multiple movies to 'mflix.movies' with different text lengths for automatic embeddings. Include 'Casablanca' with short text 'Love in wartime', 'Gone with the Wind' with medium text 'Epic tale of the American Civil War and its aftermath', and 'Citizen Kane' with long detailed plot description. Use voyage-3 model.",
233
-
expectedToolCalls: [
234
-
{
235
-
toolName: "insert-many",
236
-
parameters: {
237
-
database: "mflix",
238
-
collection: "movies",
239
-
documents: [
240
-
{
241
-
title: "Casablanca",
242
-
plotSummary: Matcher.string(),
243
-
},
244
-
{
245
-
title: "Gone with the Wind",
246
-
plotSummary: Matcher.string(),
247
-
},
248
-
{
249
-
title: "Citizen Kane",
250
-
plotSummary: Matcher.string(),
251
-
},
252
-
],
253
-
embeddingParameters: {
254
-
model: "voyage-3",
255
-
},
256
-
},
257
-
},
258
-
],
259
-
},
260
-
{
261
-
prompt: "Insert a document into 'mflix.movies' with title 'The Lord of the Rings' and use embeddingParameters input array to provide different texts for multiple embedding fields: plotSummary='Fantasy epic quest', genre='Fantasy Adventure', themes='Good vs Evil'.",
262
-
expectedToolCalls: [
263
-
{
264
-
toolName: "insert-many",
265
-
parameters: {
266
-
database: "mflix",
267
-
collection: "movies",
268
-
documents: [
269
-
{
270
-
title: "The Lord of the Rings",
271
-
},
272
-
],
273
-
embeddingParameters: {
274
-
model: Matcher.string(),
275
-
input: [
276
-
{
277
-
plotSummary: Matcher.string(),
278
-
genre: Matcher.string(),
279
-
themes: Matcher.string(),
280
-
},
281
-
],
282
-
},
283
-
},
284
-
},
285
-
],
286
-
},
287
-
{
288
-
prompt: "Add a movie 'Dune' to 'mflix.movies' with automatic embeddings. Provide raw text in the document for plotSummary field: 'Desert planet with spice mining'. Use voyage-3 model and ensure the text gets converted to embeddings automatically.",
0 commit comments