if an openai message has content and multicontent, fix it before passing it off to the api

This commit is contained in:
Steve Dudenhoeffer 2024-10-20 21:50:12 -04:00
parent b8dc1d1a96
commit c4f4f6abe6

View File

@ -43,6 +43,16 @@ func (o openai) requestToOpenAIRequest(request Request) oai.ChatCompletionReques
}
}
// openai does not allow Content and MultiContent to be set at the same time, so we need to check
if len(m.MultiContent) > 0 && m.Content != "" {
m.MultiContent = append([]oai.ChatMessagePart{{
Type: "text",
Text: m.Content,
}}, m.MultiContent...)
m.Content = ""
}
res.Messages = append(res.Messages, m)
}