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...))
|
||||
case llm.RoleAssistant:
|
||||
blocks := []anthropic.ContentBlockParamUnion{
|
||||
anthropic.NewTextBlock(msg.Text()),
|
||||
var blocks []anthropic.ContentBlockParamUnion
|
||||
if text := msg.Text(); text != "" {
|
||||
blocks = append(blocks, anthropic.NewTextBlock(text))
|
||||
}
|
||||
for _, tc := range msg.ToolCalls {
|
||||
var input any
|
||||
|
||||
Reference in New Issue
Block a user