Skip empty text block in Anthropic tool-only assistant turns
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -189,8 +189,9 @@ func buildMessages(messages []llm.Message) []anthropic.MessageParam {
|
|||||||
}
|
}
|
||||||
out = append(out, anthropic.NewUserMessage(blocks...))
|
out = append(out, anthropic.NewUserMessage(blocks...))
|
||||||
case llm.RoleAssistant:
|
case llm.RoleAssistant:
|
||||||
blocks := []anthropic.ContentBlockParamUnion{
|
var blocks []anthropic.ContentBlockParamUnion
|
||||||
anthropic.NewTextBlock(msg.Text()),
|
if text := msg.Text(); text != "" {
|
||||||
|
blocks = append(blocks, anthropic.NewTextBlock(text))
|
||||||
}
|
}
|
||||||
for _, tc := range msg.ToolCalls {
|
for _, tc := range msg.ToolCalls {
|
||||||
var input any
|
var input any
|
||||||
|
|||||||
Reference in New Issue
Block a user