@@ -81,7 +81,7 @@ func TestListModels(t *testing.T) {
81
81
}
82
82
83
83
func TestAbortRun (t * testing.T ) {
84
- tool := & ToolDef {Instructions : "What is the capital of the united states?" }
84
+ tool := ToolDef {Instructions : "What is the capital of the united states?" }
85
85
86
86
run , err := g .Evaluate (context .Background (), Options {DisableCache : true , IncludeEvents : true }, tool )
87
87
if err != nil {
@@ -105,7 +105,7 @@ func TestAbortRun(t *testing.T) {
105
105
}
106
106
107
107
func TestSimpleEvaluate (t * testing.T ) {
108
- tool := & ToolDef {Instructions : "What is the capital of the united states?" }
108
+ tool := ToolDef {Instructions : "What is the capital of the united states?" }
109
109
110
110
run , err := g .Evaluate (context .Background (), Options {}, tool )
111
111
if err != nil {
@@ -142,7 +142,7 @@ func TestEvaluateWithContext(t *testing.T) {
142
142
t .Fatalf ("Error getting current working directory: %v" , err )
143
143
}
144
144
145
- tool := & ToolDef {
145
+ tool := ToolDef {
146
146
Instructions : "What is the capital of the united states?" ,
147
147
Context : []string {
148
148
wd + "/test/acorn-labs-context.gpt" ,
@@ -165,7 +165,7 @@ func TestEvaluateWithContext(t *testing.T) {
165
165
}
166
166
167
167
func TestEvaluateComplexTool (t * testing.T ) {
168
- tool := & ToolDef {
168
+ tool := ToolDef {
169
169
JSONResponse : true ,
170
170
Instructions : `
171
171
Create three short graphic artist descriptions and their muses.
@@ -202,18 +202,16 @@ func TestEvaluateWithToolList(t *testing.T) {
202
202
if runtime .GOOS == "windows" {
203
203
shebang = "#!/usr/bin/env powershell.exe"
204
204
}
205
- tools := []fmt. Stringer {
206
- & ToolDef {
205
+ tools := []ToolDef {
206
+ {
207
207
Tools : []string {"echo" },
208
208
Instructions : "echo hello there" ,
209
209
},
210
- & ToolDef {
211
- Name : "echo" ,
212
- Tools : []string {"sys.exec" },
213
- Description : "Echoes the input" ,
214
- Args : map [string ]string {
215
- "input" : "The string input to echo" ,
216
- },
210
+ {
211
+ Name : "echo" ,
212
+ Tools : []string {"sys.exec" },
213
+ Description : "Echoes the input" ,
214
+ Arguments : ObjectSchema ("input" , "The string input to echo" ),
217
215
Instructions : shebang + "\n echo ${input}" ,
218
216
},
219
217
}
@@ -238,23 +236,21 @@ func TestEvaluateWithToolListAndSubTool(t *testing.T) {
238
236
if runtime .GOOS == "windows" {
239
237
shebang = "#!/usr/bin/env powershell.exe"
240
238
}
241
- tools := []fmt. Stringer {
242
- & ToolDef {
239
+ tools := []ToolDef {
240
+ {
243
241
Tools : []string {"echo" },
244
242
Instructions : "echo 'hello there'" ,
245
243
},
246
- & ToolDef {
244
+ {
247
245
Name : "other" ,
248
246
Tools : []string {"echo" },
249
247
Instructions : "echo 'hello somewhere else'" ,
250
248
},
251
- & ToolDef {
252
- Name : "echo" ,
253
- Tools : []string {"sys.exec" },
254
- Description : "Echoes the input" ,
255
- Args : map [string ]string {
256
- "input" : "The string input to echo" ,
257
- },
249
+ {
250
+ Name : "echo" ,
251
+ Tools : []string {"sys.exec" },
252
+ Description : "Echoes the input" ,
253
+ Arguments : ObjectSchema ("input" , "The string input to echo" ),
258
254
Instructions : shebang + "\n echo ${input}" ,
259
255
},
260
256
}
@@ -276,7 +272,7 @@ func TestEvaluateWithToolListAndSubTool(t *testing.T) {
276
272
277
273
func TestStreamEvaluate (t * testing.T ) {
278
274
var eventContent string
279
- tool := & ToolDef {Instructions : "What is the capital of the united states?" }
275
+ tool := ToolDef {Instructions : "What is the capital of the united states?" }
280
276
281
277
run , err := g .Evaluate (context .Background (), Options {IncludeEvents : true }, tool )
282
278
if err != nil {
@@ -536,7 +532,7 @@ echo hello there
536
532
}
537
533
538
534
func TestToolChat (t * testing.T ) {
539
- tool := & ToolDef {
535
+ tool := ToolDef {
540
536
Chat : true ,
541
537
Instructions : "You are a chat bot. Don't finish the conversation until I say 'bye'." ,
542
538
Tools : []string {"sys.chat.finish" },
@@ -688,8 +684,8 @@ func TestToolWithGlobalTools(t *testing.T) {
688
684
689
685
func TestConfirm (t * testing.T ) {
690
686
var eventContent string
691
- tools := []fmt. Stringer {
692
- & ToolDef {
687
+ tools := []ToolDef {
688
+ {
693
689
Instructions : "List the files in the current directory" ,
694
690
Tools : []string {"sys.exec" },
695
691
},
@@ -759,8 +755,8 @@ func TestConfirm(t *testing.T) {
759
755
760
756
func TestConfirmDeny (t * testing.T ) {
761
757
var eventContent string
762
- tools := []fmt. Stringer {
763
- & ToolDef {
758
+ tools := []ToolDef {
759
+ {
764
760
Instructions : "List the files in the current directory" ,
765
761
Tools : []string {"sys.exec" },
766
762
},
@@ -831,8 +827,8 @@ func TestConfirmDeny(t *testing.T) {
831
827
832
828
func TestPrompt (t * testing.T ) {
833
829
var eventContent string
834
- tools := []fmt. Stringer {
835
- & ToolDef {
830
+ tools := []ToolDef {
831
+ {
836
832
Instructions : "Use the sys.prompt user to ask the user for 'first name' which is not sensitive. After you get their first name, say hello." ,
837
833
Tools : []string {"sys.prompt" },
838
834
},
@@ -914,8 +910,8 @@ func TestPrompt(t *testing.T) {
914
910
}
915
911
916
912
func TestPromptWithoutPromptAllowed (t * testing.T ) {
917
- tools := []fmt. Stringer {
918
- & ToolDef {
913
+ tools := []ToolDef {
914
+ {
919
915
Instructions : "Use the sys.prompt user to ask the user for 'first name' which is not sensitive. After you get their first name, say hello." ,
920
916
Tools : []string {"sys.prompt" },
921
917
},
0 commit comments