Lead anthropic function call XML with newline

This commit is contained in:
Matt Low 2024-03-17 18:26:32 +00:00
parent 62f07dd240
commit 5e880d3b31
1 changed files with 5 additions and 1 deletions

View File

@ -94,7 +94,11 @@ func buildRequest(params model.RequestParameters, messages []model.Message) Requ
if err != nil { if err != nil {
panic("Could not serialize []ToolCall to XMLFunctionCall") 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: case model.MessageRoleToolResult:
xmlFuncResults := convertToolResultsToXMLFunctionResult(msg.ToolResults) xmlFuncResults := convertToolResultsToXMLFunctionResult(msg.ToolResults)
xmlString, err := xmlFuncResults.XMLString() xmlString, err := xmlFuncResults.XMLString()