Fixed gemini system prompt handling
This commit is contained in:
parent
60a474d516
commit
1ddbba2489
@ -158,8 +158,7 @@ func createGenerateContentRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
request := &GenerateContentRequest{
|
request := &GenerateContentRequest{
|
||||||
Contents: requestContents,
|
Contents: requestContents,
|
||||||
SystemInstructions: system,
|
|
||||||
GenerationConfig: &GenerationConfig{
|
GenerationConfig: &GenerationConfig{
|
||||||
MaxOutputTokens: ¶ms.MaxTokens,
|
MaxOutputTokens: ¶ms.MaxTokens,
|
||||||
Temperature: ¶ms.Temperature,
|
Temperature: ¶ms.Temperature,
|
||||||
@ -167,6 +166,16 @@ func createGenerateContentRequest(
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if system != "" {
|
||||||
|
request.SystemInstruction = Content{
|
||||||
|
Parts: []ContentPart{
|
||||||
|
{
|
||||||
|
Text: system,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(params.ToolBag) > 0 {
|
if len(params.ToolBag) > 0 {
|
||||||
request.Tools = convertTools(params.ToolBag)
|
request.Tools = convertTools(params.ToolBag)
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,10 @@ type GenerationConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GenerateContentRequest struct {
|
type GenerateContentRequest struct {
|
||||||
Contents []Content `json:"contents"`
|
Contents []Content `json:"contents"`
|
||||||
Tools []Tool `json:"tools,omitempty"`
|
Tools []Tool `json:"tools,omitempty"`
|
||||||
SystemInstructions string `json:"systemInstructions,omitempty"`
|
SystemInstruction *Content `json:"systemInstruction,omitempty"`
|
||||||
GenerationConfig *GenerationConfig `json:"generationConfig,omitempty"`
|
GenerationConfig *GenerationConfig `json:"generationConfig,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Candidate struct {
|
type Candidate struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user