Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions crates/sprout-agent/src/llm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ fn anthropic_body(cfg: &Config, history: &[HistoryItem], tools: &[ToolDef]) -> V
"name": c.name, "input": c.arguments }));
}
if content.is_empty() {
// Anthropic requires non-empty content arrays AND rejects
// empty text blocks. A single space satisfies both.
content.push(json!({ "type": "text", "text": " " }));
// Empty assistant turn (no text, no tool calls) — skip it.
// Anthropic rejects empty text blocks, and a placeholder
// just defers the problem. No tool_use = no pairing
// constraint, so omitting is safe.
continue;
}
messages.push(json!({ "role": "assistant", "content": content }));
}
Expand Down
Loading