File tree Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { describeAccuracyTests , describeSuite } from "./sdk/describe-accuracy-tests.js" ;
2
+ import { getAvailableModels } from "./sdk/models.js" ;
3
+ import { AccuracyTestConfig } from "./sdk/describe-accuracy-tests.js" ;
4
+
5
+ function callsAggregate ( prompt : string , pipeline : Record < string , unknown > [ ] ) : AccuracyTestConfig {
6
+ return {
7
+ injectConnectedAssumption : true ,
8
+ prompt : prompt ,
9
+ mockedTools : { } ,
10
+ expectedToolCalls : [
11
+ {
12
+ toolName : "aggregate" ,
13
+ parameters : {
14
+ pipeline : pipeline ,
15
+ } ,
16
+ } ,
17
+ ] ,
18
+ } ;
19
+ }
20
+
21
+ describeAccuracyTests ( getAvailableModels ( ) , {
22
+ ...describeSuite ( "should call 'aggregate' tool" , [
23
+ callsAggregate (
24
+ "Group all the movies in 'mflix.movies' namespace by 'release_year' and give me a count of them" ,
25
+ [ { $group : { _id : "$release_year" , count : { $sum : 1 } } } ]
26
+ ) ,
27
+ ] ) ,
28
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { describeAccuracyTests , describeSuite } from "./sdk/describe-accuracy-tests.js" ;
2
+ import { getAvailableModels } from "./sdk/models.js" ;
3
+ import { AccuracyTestConfig } from "./sdk/describe-accuracy-tests.js" ;
4
+
5
+ function callsCreateIndex ( prompt : string , indexKeys : Record < string , unknown > ) : AccuracyTestConfig {
6
+ return {
7
+ injectConnectedAssumption : true ,
8
+ prompt : prompt ,
9
+ mockedTools : { } ,
10
+ expectedToolCalls : [
11
+ {
12
+ toolName : "create-index" ,
13
+ parameters : {
14
+ database : "mflix" ,
15
+ collection : "movies" ,
16
+ keys : indexKeys ,
17
+ } ,
18
+ } ,
19
+ ] ,
20
+ } ;
21
+ }
22
+
23
+ describeAccuracyTests ( getAvailableModels ( ) , {
24
+ ...describeSuite ( "should call 'create-index' tool" , [
25
+ callsCreateIndex (
26
+ "Create an index that covers the following query on 'mflix.movies' namespace - { \"release_year\": 1992 }" ,
27
+ {
28
+ release_year : 1 ,
29
+ }
30
+ ) ,
31
+ callsCreateIndex ( "Create a text index on title field in 'mflix.movies' namespace" , {
32
+ title : "text" ,
33
+ } ) ,
34
+ ] ) ,
35
+ } ) ;
You can’t perform that action at this time.
0 commit comments