expectTemplate:"user: [img-0]What's in this image?\n",
expectNumImages:1,
},
{
name:"chat debug with tools",
request:api.ChatRequest{
Model:"test-model",
Messages:[]api.Message{
{Role:"user",Content:"Get the weather"},
},
Tools:api.Tools{
{
Type:"function",
Function:api.ToolFunction{
Name:"get_weather",
Description:"Get weather information",
},
},
},
DebugRenderOnly:true,
},
expectDebug:true,
expectTemplate:"[{\"type\":\"function\",\"function\":{\"name\":\"get_weather\",\"description\":\"Get weather information\",\"parameters\":{\"type\":\"\",\"required\":null,\"properties\":null}}}]user: Get the weather\n",
},
}
for_,tt:=rangetests{
// Test both with and without streaming
streamValues:=[]bool{false,true}
for_,stream:=rangestreamValues{
streamSuffix:=""
ifstream{
streamSuffix=" (streaming)"
}
t.Run(tt.name+streamSuffix,func(t*testing.T){
req:=tt.request
req.Stream=&stream
w:=createRequest(t,s.ChatHandler,req)
iftt.expectDebug{
ifw.Code!=http.StatusOK{
t.Errorf("expected status %d, got %d, body: %s",http.StatusOK,w.Code,w.Body.String())