Fixed gemini system prompt handling

This commit is contained in:
Matt Low 2024-06-01 19:47:08 +00:00
parent 60a474d516
commit e1092e69ae
2 changed files with 12 additions and 6 deletions

View File

@ -159,7 +159,13 @@ func createGenerateContentRequest(
request := &GenerateContentRequest{ request := &GenerateContentRequest{
Contents: requestContents, Contents: requestContents,
SystemInstructions: system, SystemInstruction: Content{
Parts: []ContentPart{
{
Text: system,
},
},
},
GenerationConfig: &GenerationConfig{ GenerationConfig: &GenerationConfig{
MaxOutputTokens: &params.MaxTokens, MaxOutputTokens: &params.MaxTokens,
Temperature: &params.Temperature, Temperature: &params.Temperature,

View File

@ -36,7 +36,7 @@ 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"`
} }