|
1 | 1 | import { describeAccuracyTests } from "./sdk/describeAccuracyTests.js"; |
2 | 2 | import { Matcher } from "./sdk/matcher.js"; |
3 | 3 |
|
4 | | -// TODO: supply this with a proper config API once we refactor describeAccuracyTests to support it |
5 | | -process.env.MDB_VOYAGE_API_KEY = "valid-key"; |
6 | | - |
7 | | -describeAccuracyTests([ |
8 | | - { |
9 | | - prompt: "Create an index that covers the following query on 'mflix.movies' namespace - { \"release_year\": 1992 }", |
10 | | - expectedToolCalls: [ |
11 | | - { |
12 | | - toolName: "create-index", |
13 | | - parameters: { |
14 | | - database: "mflix", |
15 | | - collection: "movies", |
16 | | - name: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
17 | | - definition: [ |
18 | | - { |
19 | | - type: "classic", |
20 | | - keys: { |
21 | | - release_year: 1, |
| 4 | +describeAccuracyTests( |
| 5 | + [ |
| 6 | + { |
| 7 | + prompt: "Create an index that covers the following query on 'mflix.movies' namespace - { \"release_year\": 1992 }", |
| 8 | + expectedToolCalls: [ |
| 9 | + { |
| 10 | + toolName: "create-index", |
| 11 | + parameters: { |
| 12 | + database: "mflix", |
| 13 | + collection: "movies", |
| 14 | + name: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
| 15 | + definition: [ |
| 16 | + { |
| 17 | + type: "classic", |
| 18 | + keys: { |
| 19 | + release_year: 1, |
| 20 | + }, |
22 | 21 | }, |
23 | | - }, |
24 | | - ], |
| 22 | + ], |
| 23 | + }, |
25 | 24 | }, |
26 | | - }, |
27 | | - ], |
28 | | - }, |
29 | | - { |
30 | | - prompt: "Create a text index on title field in 'mflix.movies' namespace", |
31 | | - expectedToolCalls: [ |
32 | | - { |
33 | | - toolName: "create-index", |
34 | | - parameters: { |
35 | | - database: "mflix", |
36 | | - collection: "movies", |
37 | | - name: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
38 | | - definition: [ |
39 | | - { |
40 | | - type: "classic", |
41 | | - keys: { |
42 | | - title: "text", |
| 25 | + ], |
| 26 | + }, |
| 27 | + { |
| 28 | + prompt: "Create a text index on title field in 'mflix.movies' namespace", |
| 29 | + expectedToolCalls: [ |
| 30 | + { |
| 31 | + toolName: "create-index", |
| 32 | + parameters: { |
| 33 | + database: "mflix", |
| 34 | + collection: "movies", |
| 35 | + name: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
| 36 | + definition: [ |
| 37 | + { |
| 38 | + type: "classic", |
| 39 | + keys: { |
| 40 | + title: "text", |
| 41 | + }, |
43 | 42 | }, |
44 | | - }, |
45 | | - ], |
| 43 | + ], |
| 44 | + }, |
46 | 45 | }, |
47 | | - }, |
48 | | - ], |
49 | | - }, |
50 | | - { |
51 | | - prompt: "Create a vector search index on 'mydb.movies' namespace on the 'plotSummary' field. The index should use 1024 dimensions.", |
52 | | - expectedToolCalls: [ |
53 | | - { |
54 | | - toolName: "create-index", |
55 | | - parameters: { |
56 | | - database: "mydb", |
57 | | - collection: "movies", |
58 | | - name: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
59 | | - definition: [ |
60 | | - { |
61 | | - type: "vectorSearch", |
62 | | - fields: [ |
63 | | - { |
64 | | - type: "vector", |
65 | | - path: "plotSummary", |
66 | | - numDimensions: 1024, |
67 | | - }, |
68 | | - ], |
69 | | - }, |
70 | | - ], |
| 46 | + ], |
| 47 | + }, |
| 48 | + { |
| 49 | + prompt: "Create a vector search index on 'mflix.movies' namespace on the 'plotSummary' field. The index should use 1024 dimensions.", |
| 50 | + expectedToolCalls: [ |
| 51 | + { |
| 52 | + toolName: "create-index", |
| 53 | + parameters: { |
| 54 | + database: "mflix", |
| 55 | + collection: "movies", |
| 56 | + name: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
| 57 | + definition: [ |
| 58 | + { |
| 59 | + type: "vectorSearch", |
| 60 | + fields: [ |
| 61 | + { |
| 62 | + type: "vector", |
| 63 | + path: "plotSummary", |
| 64 | + numDimensions: 1024, |
| 65 | + }, |
| 66 | + ], |
| 67 | + }, |
| 68 | + ], |
| 69 | + }, |
71 | 70 | }, |
72 | | - }, |
73 | | - ], |
74 | | - }, |
75 | | - { |
76 | | - prompt: "Create a vector search index on 'mydb.movies' namespace with on the 'plotSummary' field and 'genre' field, both of which contain vector embeddings. Pick a sensible number of dimensions for a voyage 3.5 model.", |
77 | | - expectedToolCalls: [ |
78 | | - { |
79 | | - toolName: "create-index", |
80 | | - parameters: { |
81 | | - database: "mydb", |
82 | | - collection: "movies", |
83 | | - name: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
84 | | - definition: [ |
85 | | - { |
86 | | - type: "vectorSearch", |
87 | | - fields: [ |
88 | | - { |
89 | | - type: "vector", |
90 | | - path: "plotSummary", |
91 | | - numDimensions: Matcher.number( |
92 | | - (value) => value % 2 === 0 && value >= 256 && value <= 8192 |
93 | | - ), |
94 | | - similarity: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
95 | | - }, |
96 | | - { |
97 | | - type: "vector", |
98 | | - path: "genre", |
99 | | - numDimensions: Matcher.number( |
100 | | - (value) => value % 2 === 0 && value >= 256 && value <= 8192 |
101 | | - ), |
102 | | - similarity: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
103 | | - }, |
104 | | - ], |
105 | | - }, |
106 | | - ], |
| 71 | + ], |
| 72 | + }, |
| 73 | + { |
| 74 | + prompt: "Create a vector search index on 'mflix.movies' namespace with on the 'plotSummary' field and 'genre' field, both of which contain vector embeddings. Pick a sensible number of dimensions for a voyage 3.5 model.", |
| 75 | + expectedToolCalls: [ |
| 76 | + { |
| 77 | + toolName: "create-index", |
| 78 | + parameters: { |
| 79 | + database: "mflix", |
| 80 | + collection: "movies", |
| 81 | + name: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
| 82 | + definition: [ |
| 83 | + { |
| 84 | + type: "vectorSearch", |
| 85 | + fields: [ |
| 86 | + { |
| 87 | + type: "vector", |
| 88 | + path: "plotSummary", |
| 89 | + numDimensions: Matcher.number( |
| 90 | + (value) => value % 2 === 0 && value >= 256 && value <= 8192 |
| 91 | + ), |
| 92 | + similarity: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
| 93 | + }, |
| 94 | + { |
| 95 | + type: "vector", |
| 96 | + path: "genre", |
| 97 | + numDimensions: Matcher.number( |
| 98 | + (value) => value % 2 === 0 && value >= 256 && value <= 8192 |
| 99 | + ), |
| 100 | + similarity: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
| 101 | + }, |
| 102 | + ], |
| 103 | + }, |
| 104 | + ], |
| 105 | + }, |
107 | 106 | }, |
108 | | - }, |
109 | | - ], |
110 | | - }, |
111 | | - { |
112 | | - prompt: "Create a vector search index on 'mydb.movies' namespace where the 'plotSummary' field is indexed as a 1024-dimensional vector and the 'releaseDate' field is indexed as a regular field.", |
113 | | - expectedToolCalls: [ |
114 | | - { |
115 | | - toolName: "create-index", |
116 | | - parameters: { |
117 | | - database: "mydb", |
118 | | - collection: "movies", |
119 | | - name: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
120 | | - definition: [ |
121 | | - { |
122 | | - type: "vectorSearch", |
123 | | - fields: [ |
124 | | - { |
125 | | - type: "vector", |
126 | | - path: "plotSummary", |
127 | | - numDimensions: 1024, |
128 | | - }, |
129 | | - { |
130 | | - type: "filter", |
131 | | - path: "releaseDate", |
132 | | - }, |
133 | | - ], |
134 | | - }, |
135 | | - ], |
| 107 | + ], |
| 108 | + }, |
| 109 | + { |
| 110 | + prompt: "Create a vector search index on 'mflix.movies' namespace where the 'plotSummary' field is indexed as a 1024-dimensional vector and the 'releaseDate' field is indexed as a regular field.", |
| 111 | + expectedToolCalls: [ |
| 112 | + { |
| 113 | + toolName: "create-index", |
| 114 | + parameters: { |
| 115 | + database: "mflix", |
| 116 | + collection: "movies", |
| 117 | + name: Matcher.anyOf(Matcher.undefined, Matcher.string()), |
| 118 | + definition: [ |
| 119 | + { |
| 120 | + type: "vectorSearch", |
| 121 | + fields: [ |
| 122 | + { |
| 123 | + type: "vector", |
| 124 | + path: "plotSummary", |
| 125 | + numDimensions: 1024, |
| 126 | + }, |
| 127 | + { |
| 128 | + type: "filter", |
| 129 | + path: "releaseDate", |
| 130 | + }, |
| 131 | + ], |
| 132 | + }, |
| 133 | + ], |
| 134 | + }, |
136 | 135 | }, |
137 | | - }, |
138 | | - ], |
139 | | - }, |
140 | | -]); |
| 136 | + ], |
| 137 | + }, |
| 138 | + ], |
| 139 | + { |
| 140 | + userConfig: { voyageApiKey: "valid-key" }, |
| 141 | + clusterConfig: { |
| 142 | + search: true, |
| 143 | + }, |
| 144 | + } |
| 145 | +); |
0 commit comments