Merge pull request #1166 from RedwindA/fix/gemini-functionResponse
Fix: Correctly relay FunctionResponse content for Gemini API
This commit is contained in:
@@ -27,14 +27,9 @@ type FunctionCall struct {
|
|||||||
Arguments any `json:"args"`
|
Arguments any `json:"args"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GeminiFunctionResponseContent struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Content any `json:"content"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FunctionResponse struct {
|
type FunctionResponse struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Response GeminiFunctionResponseContent `json:"response"`
|
Response map[string]interface{} `json:"response"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GeminiPartExecutableCode struct {
|
type GeminiPartExecutableCode struct {
|
||||||
|
|||||||
@@ -186,17 +186,12 @@ func CovertGemini2OpenAI(textRequest dto.GeneralOpenAIRequest, info *relaycommon
|
|||||||
} else if val, exists := tool_call_ids[message.ToolCallId]; exists {
|
} else if val, exists := tool_call_ids[message.ToolCallId]; exists {
|
||||||
name = val
|
name = val
|
||||||
}
|
}
|
||||||
content := common.StrToMap(message.StringContent())
|
contentMap := common.StrToMap(message.StringContent())
|
||||||
functionResp := &FunctionResponse{
|
functionResp := &FunctionResponse{
|
||||||
Name: name,
|
Name: name,
|
||||||
Response: GeminiFunctionResponseContent{
|
Response: contentMap,
|
||||||
Name: name,
|
|
||||||
Content: content,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
if content == nil {
|
|
||||||
functionResp.Response.Content = message.StringContent()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*parts = append(*parts, GeminiPart{
|
*parts = append(*parts, GeminiPart{
|
||||||
FunctionResponse: functionResp,
|
FunctionResponse: functionResp,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user