mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
fix: skip empty assistant turns instead of placeholder space (#560)
This commit is contained in:
@@ -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 }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user