From 5e880d3b31f4d9d533c8370286ee0e3ee158b261 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Sun, 17 Mar 2024 18:26:32 +0000 Subject: [PATCH] Lead anthropic function call XML with newline --- pkg/lmcli/provider/anthropic/anthropic.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/lmcli/provider/anthropic/anthropic.go b/pkg/lmcli/provider/anthropic/anthropic.go index 8a410de..3908258 100644 --- a/pkg/lmcli/provider/anthropic/anthropic.go +++ b/pkg/lmcli/provider/anthropic/anthropic.go @@ -94,7 +94,11 @@ func buildRequest(params model.RequestParameters, messages []model.Message) Requ if err != nil { panic("Could not serialize []ToolCall to XMLFunctionCall") } - message.Content += xmlString + if len(message.Content) > 0 { + message.Content += fmt.Sprintf("\n\n%s", xmlString) + } else { + message.Content = xmlString + } case model.MessageRoleToolResult: xmlFuncResults := convertToolResultsToXMLFunctionResult(msg.ToolResults) xmlString, err := xmlFuncResults.XMLString()