From 2682f790d084a31829978fb7ac2cca7f10ef87d2 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Sun, 11 Feb 2024 17:28:42 -0800 Subject: [PATCH] Extract key --- README.md | 5 +++++ google-gemini-content.el | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d3d31e5..6b7868b 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,11 @@ retrieve the key from an auth-source entry under the `:host` key `api.google-gem (setq google-gemini-key #'google-gemini-key-auth-source) ``` +> 💡 Tip +> +> The two variables `google-gemini-key` is the default values for sending requests! +> However, you can still overwrite the value by passing the keywords `:key`! + ## 🛠️ Contribute [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com) diff --git a/google-gemini-content.el b/google-gemini-content.el index cf1729f..e62c81f 100644 --- a/google-gemini-content.el +++ b/google-gemini-content.el @@ -33,6 +33,7 @@ (cl-defun google-gemini-content-generate ( text callback &key (content-type "application/json") + (key google-gemini-key) (category "HARM_CATEGORY_DANGEROUS_CONTENT") (threshold "BLOCK_ONLY_HIGH") stop-sequences @@ -41,8 +42,7 @@ top-p top-k) "Send generate content request." - (request (format "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=%s" - google-gemini-key) + (request (format "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=%s" key) :type "POST" :headers (google-gemini--headers content-type) :data (google-gemini--json-encode