You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// For other types, we might need more specific checks,
138
+
// but for now return false if kinds don't match or not handled
129
139
returnfalse
130
140
}
131
141
}
132
142
returntrue
133
143
}
144
+
145
+
funcTestTranslateChatResponse(t*testing.T) {
146
+
tests:= []struct {
147
+
namestring
148
+
inputstring
149
+
want*ai.ModelResponse
150
+
wantReasoningstring
151
+
wantErrbool
152
+
}{
153
+
{
154
+
name: "Thinking field present",
155
+
input: `{"model": "deepseek-r1", "created_at": "2024-06-20T12:34:56Z", "message": {"role": "assistant", "content": "Hello", "thinking": "I should say hello"}}`,
156
+
want: &ai.ModelResponse{
157
+
Message: &ai.Message{
158
+
Role: ai.RoleModel,
159
+
Content: []*ai.Part{
160
+
ai.NewReasoningPart("I should say hello", nil),
161
+
ai.NewTextPart("Hello"),
162
+
},
163
+
},
164
+
},
165
+
wantReasoning: "I should say hello",
166
+
},
167
+
{
168
+
name: "Thinking in content tag",
169
+
input: `{"model": "deepseek-r1", "created_at": "2024-06-20T12:34:56Z", "message": {"role": "assistant", "content": "<think>I should say hello</think>Hello"}}`,
0 commit comments