mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-17 09:16:36 +08:00
Compare commits
2 Commits
b3d2a32312
...
6e1f5a8396
Author | SHA1 | Date | |
---|---|---|---|
|
6e1f5a8396 | ||
|
cf0ce425e6 |
@ -93,22 +93,13 @@ func ConvertRequest(textRequest model.GeneralOpenAIRequest) *ChatRequest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if textRequest.Tools != nil {
|
if textRequest.Tools != nil {
|
||||||
functions := make([]model.Function, 0, len(textRequest.Tools))
|
geminiRequest.Tools = textRequest.Tools
|
||||||
for _, tool := range textRequest.Tools {
|
|
||||||
functions = append(functions, tool.Function)
|
|
||||||
}
|
|
||||||
geminiRequest.Tools = []ChatTools{
|
|
||||||
{
|
|
||||||
FunctionDeclarations: functions,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
} else if textRequest.Functions != nil {
|
|
||||||
geminiRequest.Tools = []ChatTools{
|
|
||||||
{
|
|
||||||
FunctionDeclarations: textRequest.Functions,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if textRequest.Functions != nil {
|
||||||
|
geminiRequest.Tools = textRequest.Functions
|
||||||
|
}
|
||||||
|
|
||||||
shouldAddDummyModelMessage := false
|
shouldAddDummyModelMessage := false
|
||||||
for _, message := range textRequest.Messages {
|
for _, message := range textRequest.Messages {
|
||||||
content := ChatContent{
|
content := ChatContent{
|
||||||
|
@ -4,7 +4,7 @@ type ChatRequest struct {
|
|||||||
Contents []ChatContent `json:"contents"`
|
Contents []ChatContent `json:"contents"`
|
||||||
SafetySettings []ChatSafetySettings `json:"safety_settings,omitempty"`
|
SafetySettings []ChatSafetySettings `json:"safety_settings,omitempty"`
|
||||||
GenerationConfig ChatGenerationConfig `json:"generation_config,omitempty"`
|
GenerationConfig ChatGenerationConfig `json:"generation_config,omitempty"`
|
||||||
Tools []ChatTools `json:"tools,omitempty"`
|
Tools interface{} `json:"tools,omitempty"`
|
||||||
SystemInstruction *ChatContent `json:"system_instruction,omitempty"`
|
SystemInstruction *ChatContent `json:"system_instruction,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user