From e1092e69ae9ad221db936ceb7a7a042a0ad21b1a Mon Sep 17 00:00:00 2001 From: Matt Low Date: Sat, 1 Jun 2024 19:47:08 +0000 Subject: [PATCH] Fixed gemini system prompt handling --- pkg/lmcli/provider/google/google.go | 10 ++++++++-- pkg/lmcli/provider/google/types.go | 8 ++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pkg/lmcli/provider/google/google.go b/pkg/lmcli/provider/google/google.go index 51ca5e0..eb9dc00 100644 --- a/pkg/lmcli/provider/google/google.go +++ b/pkg/lmcli/provider/google/google.go @@ -158,8 +158,14 @@ func createGenerateContentRequest( } request := &GenerateContentRequest{ - Contents: requestContents, - SystemInstructions: system, + Contents: requestContents, + SystemInstruction: Content{ + Parts: []ContentPart{ + { + Text: system, + }, + }, + }, GenerationConfig: &GenerationConfig{ MaxOutputTokens: ¶ms.MaxTokens, Temperature: ¶ms.Temperature, diff --git a/pkg/lmcli/provider/google/types.go b/pkg/lmcli/provider/google/types.go index 1d2eb30..277ce95 100644 --- a/pkg/lmcli/provider/google/types.go +++ b/pkg/lmcli/provider/google/types.go @@ -34,10 +34,10 @@ type GenerationConfig struct { } type GenerateContentRequest struct { - Contents []Content `json:"contents"` - Tools []Tool `json:"tools,omitempty"` - SystemInstructions string `json:"systemInstructions,omitempty"` - GenerationConfig *GenerationConfig `json:"generationConfig,omitempty"` + Contents []Content `json:"contents"` + Tools []Tool `json:"tools,omitempty"` + SystemInstruction Content `json:"systemInstruction,omitempty"` + GenerationConfig *GenerationConfig `json:"generationConfig,omitempty"` } type Candidate struct {