Skip to content

Commit b918f62

Browse files
committed
chore: add an accuracy test where the index name is provided by the user
1 parent a975c17 commit b918f62

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

tests/accuracy/aggregate.test.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,62 @@ describeAccuracyTests([
2525
},
2626
],
2727
},
28+
{
29+
prompt: "Run a vectorSearch query on musicfy.songs on path 'title_embeddings' using the index 'titles' with the model voyage-3-large to find all 'hammer of justice' songs.",
30+
expectedToolCalls: [
31+
{
32+
toolName: "collection-indexes",
33+
parameters: {
34+
database: "musicfy",
35+
collection: "songs",
36+
},
37+
optional: true,
38+
},
39+
{
40+
toolName: "aggregate",
41+
parameters: {
42+
database: "musicfy",
43+
collection: "songs",
44+
pipeline: [
45+
{
46+
$vectorSearch: {
47+
exact: Matcher.anyOf(Matcher.undefined, Matcher.boolean(true)),
48+
index: "titles",
49+
path: "title_embeddings",
50+
queryVector: "hammer of justice",
51+
embeddingModel: "voyage-3-large",
52+
},
53+
},
54+
],
55+
responseBytesLimit: Matcher.anyOf(Matcher.number(), Matcher.undefined),
56+
},
57+
},
58+
],
59+
mockedTools: {
60+
"collection-indexes": (): CallToolResult => {
61+
return {
62+
content: [
63+
{
64+
type: "text",
65+
text: JSON.stringify({
66+
name: "titles",
67+
type: "vectorSearch",
68+
status: "READY",
69+
queryable: true,
70+
latestDefinition: {
71+
type: "vector",
72+
path: "title_embeddings",
73+
numDimensions: 1024,
74+
quantization: "none",
75+
similarity: "euclidean",
76+
},
77+
}),
78+
},
79+
],
80+
};
81+
},
82+
},
83+
},
2884
{
2985
prompt: "Run a vectorSearch query on mflix.movies on path 'plot_embeddings' with the model voyage-3-large to find all 'sci-fy' movies.",
3086
expectedToolCalls: [

0 commit comments

Comments
 (0)