Skip to content

Commit cff5c2d

Browse files
committed
tweak
1 parent 67dabdf commit cff5c2d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/models/gemini/gemini.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,10 @@ func (cm *ChatModel) convertSchemaMessage(message *schema.Message) (*genai.Conte
517517
if message.Role == schema.Tool {
518518
var response map[string]any
519519
if err := json.Unmarshal([]byte(message.Content), &response); err != nil {
520-
return nil, fmt.Errorf("unmarshal tool response failed: %w", err)
520+
// If the content is not valid JSON, treat it as a plain text error response
521+
response = map[string]any{
522+
"error": message.Content,
523+
}
521524
}
522525
parts = append(parts, &genai.Part{
523526
FunctionResponse: &genai.FunctionResponse{

0 commit comments

Comments
 (0)