🐛 fix: gemini function call error
This commit is contained in:
parent
6ab116c0eb
commit
6cd0f932c9
@ -139,18 +139,19 @@ func OpenAIToGeminiChatContent(openaiContents []types.ChatCompletionMessage) ([]
|
|||||||
Parts: make([]GeminiPart, 0),
|
Parts: make([]GeminiPart, 0),
|
||||||
}
|
}
|
||||||
content.Role = ConvertRole(openaiContent.Role)
|
content.Role = ConvertRole(openaiContent.Role)
|
||||||
if openaiContent.Role == types.ChatMessageRoleFunction {
|
if openaiContent.ToolCalls != nil {
|
||||||
contents = append(contents, GeminiChatContent{
|
content = GeminiChatContent{
|
||||||
Role: "model",
|
Role: "model",
|
||||||
Parts: []GeminiPart{
|
Parts: []GeminiPart{
|
||||||
{
|
{
|
||||||
FunctionCall: &GeminiFunctionCall{
|
FunctionCall: &GeminiFunctionCall{
|
||||||
Name: *openaiContent.Name,
|
Name: openaiContent.ToolCalls[0].Function.Name,
|
||||||
Args: map[string]interface{}{},
|
Args: map[string]interface{}{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
} else if openaiContent.Role == types.ChatMessageRoleTool {
|
||||||
content = GeminiChatContent{
|
content = GeminiChatContent{
|
||||||
Role: "function",
|
Role: "function",
|
||||||
Parts: []GeminiPart{
|
Parts: []GeminiPart{
|
||||||
|
Loading…
Reference in New Issue
Block a user