@@ -19,8 +19,8 @@ type fakeTool struct {
1919 output string
2020}
2121
22- func (f * fakeTool ) Name () string { return f .name }
23- func (f * fakeTool ) Description () string { return f .description }
22+ func (f * fakeTool ) Name () string { return f .name }
23+ func (f * fakeTool ) Description () string { return f .description }
2424func (f * fakeTool ) Schema () any {
2525 return map [string ]any {
2626 "type" : "object" ,
@@ -38,7 +38,7 @@ func TestEngine_Run_SimpleAnswer(t *testing.T) {
3838
3939 client := llm .New (server .URL , "sk-test" , "test-model" , "" )
4040 registry := tool .NewRegistry (nil )
41- engine := New (client , registry , 10 , "" )
41+ engine := New (client , registry , 10 , "" , nil )
4242
4343 result , err := engine .Run (context .Background (), "Say hello" )
4444 if err != nil {
@@ -80,7 +80,7 @@ func TestEngine_Run_ToolCallLoop(t *testing.T) {
8080 echoTool := & fakeTool {name : "echo" , description : "echoes input" , output : "hello output" }
8181 registry := tool .NewRegistry ([]tool.Tool {echoTool })
8282 client := llm .New (server .URL , "sk-test" , "test-model" , "" )
83- engine := New (client , registry , 10 , "" )
83+ engine := New (client , registry , 10 , "" , nil )
8484
8585 result , err := engine .Run (context .Background (), "Echo hello" )
8686 if err != nil {
@@ -117,7 +117,7 @@ func TestEngine_Run_MaxIterations(t *testing.T) {
117117 echoTool := & fakeTool {name : "echo" , description : "echo" , output : "ok" }
118118 registry := tool .NewRegistry ([]tool.Tool {echoTool })
119119 client := llm .New (server .URL , "sk-test" , "test-model" , "" )
120- engine := New (client , registry , 3 , "" )
120+ engine := New (client , registry , 3 , "" , nil )
121121
122122 _ , err := engine .Run (context .Background (), "Loop forever" )
123123 if err == nil {
@@ -132,7 +132,7 @@ func TestEngine_Run_ContextCancellation(t *testing.T) {
132132 defer server .Close ()
133133
134134 client := llm .New (server .URL , "sk-test" , "test-model" , "" )
135- engine := New (client , tool .NewRegistry (nil ), 10 , "" )
135+ engine := New (client , tool .NewRegistry (nil ), 10 , "" , nil )
136136
137137 ctx , cancel := context .WithCancel (context .Background ())
138138 cancel () // cancel immediately
@@ -166,7 +166,7 @@ func TestEngine_Run_SystemMessage(t *testing.T) {
166166 defer server .Close ()
167167
168168 client := llm .New (server .URL , "sk-test" , "test-model" , "" )
169- engine := New (client , tool .NewRegistry (nil ), 10 , "You are a test bot." )
169+ engine := New (client , tool .NewRegistry (nil ), 10 , "You are a test bot." , nil )
170170
171171 result , err := engine .Run (context .Background (), "hi" )
172172 if err != nil {
@@ -198,7 +198,7 @@ func TestEngine_Run_ToolNotFound(t *testing.T) {
198198
199199 // No tools registered — the tool call will fail
200200 client := llm .New (server .URL , "sk-test" , "test-model" , "" )
201- engine := New (client , tool .NewRegistry (nil ), 10 , "" )
201+ engine := New (client , tool .NewRegistry (nil ), 10 , "" , nil )
202202
203203 // The loop should handle the missing tool gracefully — the tool error
204204 // is fed back to the model as a tool response message. The test server
@@ -214,7 +214,7 @@ func TestEngine_BuildToolDefs(t *testing.T) {
214214 t2 := & fakeTool {name : "write" , description : "write files" }
215215 registry := tool .NewRegistry ([]tool.Tool {t1 , t2 })
216216
217- engine := New (nil , registry , 10 , "" )
217+ engine := New (nil , registry , 10 , "" , nil )
218218 defs := engine .buildToolDefs ()
219219
220220 if len (defs ) != 2 {
@@ -239,7 +239,7 @@ func TestEngine_BuildToolDefs_StringSchema(t *testing.T) {
239239 st := & stringSchemaTool {name : "custom" , description : "custom tool" , schemaStr : `{"type":"object"}` }
240240 registry := tool .NewRegistry ([]tool.Tool {st })
241241
242- engine := New (nil , registry , 10 , "" )
242+ engine := New (nil , registry , 10 , "" , nil )
243243 defs := engine .buildToolDefs ()
244244
245245 if len (defs ) != 1 {
@@ -254,7 +254,7 @@ func TestEngine_BuildToolDefs_EmptyStringSchema(t *testing.T) {
254254 st := & stringSchemaTool {name : "empty" , description : "empty" , schemaStr : "" }
255255 registry := tool .NewRegistry ([]tool.Tool {st })
256256
257- engine := New (nil , registry , 10 , "" )
257+ engine := New (nil , registry , 10 , "" , nil )
258258 defs := engine .buildToolDefs ()
259259
260260 if len (defs ) != 1 {
@@ -270,9 +270,9 @@ type stringSchemaTool struct {
270270 schemaStr string
271271}
272272
273- func (s * stringSchemaTool ) Name () string { return s .name }
274- func (s * stringSchemaTool ) Description () string { return s .description }
275- func (s * stringSchemaTool ) Schema () any { return s .schemaStr }
273+ func (s * stringSchemaTool ) Name () string { return s .name }
274+ func (s * stringSchemaTool ) Description () string { return s .description }
275+ func (s * stringSchemaTool ) Schema () any { return s .schemaStr }
276276func (s * stringSchemaTool ) Call (args string ) (string , error ) { return "ok" , nil }
277277
278278// Test context cancellation inside the iteration loop (not before start).
@@ -304,7 +304,7 @@ func TestEngine_Run_ContextCancelDuringLoop(t *testing.T) {
304304 echoTool := & fakeTool {name : "echo" , description : "echo" , output : "ok" }
305305 registry := tool .NewRegistry ([]tool.Tool {echoTool })
306306 client := llm .New (server .URL , "sk-test" , "test-model" , "" )
307- engine := New (client , registry , 10 , "" )
307+ engine := New (client , registry , 10 , "" , nil )
308308
309309 _ , err := engine .Run (ctx , "task" )
310310 if err == nil {
@@ -335,7 +335,7 @@ func TestEngine_Run_ToolCallError(t *testing.T) {
335335 failingTool := & errorTool {name : "failing" , description : "always fails" }
336336 registry := tool .NewRegistry ([]tool.Tool {failingTool })
337337 client := llm .New (server .URL , "sk-test" , "test-model" , "" )
338- engine := New (client , registry , 10 , "" )
338+ engine := New (client , registry , 10 , "" , nil )
339339
340340 // Tool error is fed back as a tool response; server only returns one
341341 // response, so we hit max iterations.
0 commit comments