records := modelReadUsage(t, compactor.client.usage.path)
require.Len(t, records, 3)
+
for n, record := range records {
require.Equal(t, &[2]int{0, 0}, record.Node)
require.Equal(t, len(long[n]), record.TextBytes)
first := compactorInputTexts(t, server.Call(0))
require.Len(t, first, 2)
+
for n, want := range []string{long[0], long[1]} {
call := server.Call(n + 1)
texts := compactorInputTexts(t, call)
}{
{
name: "failed call",
- reply: func(w http.ResponseWriter, call ModelFakeCall) {
+ reply: func(w http.ResponseWriter, _ ModelFakeCall) {
w.WriteHeader(http.StatusInternalServerError)
+
_, _ = io.WriteString(w, "down")
},
want: "HTTP 500",
},
{
name: "tool call and no text",
- reply: func(w http.ResponseWriter, call ModelFakeCall) {
+ reply: func(w http.ResponseWriter, _ ModelFakeCall) {
modelWriteEvents(w, modelCompletedEvent([]any{map[string]any{"type": "function_call", "name": "zoom", "arguments": "{}"}}, 100, 0, 5))
},
want: "no line",
server.reply = func(w http.ResponseWriter, call ModelFakeCall) {
if call.number == 0 {
w.WriteHeader(http.StatusServiceUnavailable)
+
return
}
require.Equal(t, "user", message.Role)
require.Len(t, message.Content, 1)
require.Equal(t, "input_text", message.Content[0].Type)
+
texts[n] = message.Content[0].Text
}