From a692649ae1470f27866d103f3d456b3ab9c7f5d6 Mon Sep 17 00:00:00 2001 From: jackmc Date: Thu, 14 Dec 2023 19:45:10 +0000 Subject: [PATCH] fix: use generate content --- internal/dom/chatmodels/gemini_api.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/dom/chatmodels/gemini_api.go b/internal/dom/chatmodels/gemini_api.go index f9b6f71..44be53e 100644 --- a/internal/dom/chatmodels/gemini_api.go +++ b/internal/dom/chatmodels/gemini_api.go @@ -21,13 +21,12 @@ func NewGeminiApiClient(token string) *GeminiApiClient { } func (api *GeminiApiClient) GeminiChat(ctx context.Context, prompt string) (*genai.GenerateContentResponse, error) { - client, err := genai.NewClient(ctx, option.WithAPIKey(api.Token)) + client, err := genai.NewClient(ctx, option.WithAPIKey(api.Token), option.WithQuotaProject(""), option.) if err != nil { log.Fatal(err) } defer client.Close() model := client.GenerativeModel("gemini-pro") - cs := model.StartChat() - return cs.SendMessage(ctx, genai.Text(prompt)) + return model.GenerateContent(ctx, genai.Text(prompt)) }