diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c533da9..1a03036 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,27 +26,27 @@ jobs: - 29.3 experimental: [false] include: - - os: ubuntu-latest - emacs-version: snapshot - experimental: true - - os: macos-latest - emacs-version: snapshot - experimental: true - - os: windows-latest - emacs-version: snapshot - experimental: true + - os: ubuntu-latest + emacs-version: snapshot + experimental: true + - os: macos-latest + emacs-version: snapshot + experimental: true + - os: windows-latest + emacs-version: snapshot + experimental: true steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - uses: jcs090218/setup-emacs@master - with: - version: ${{ matrix.emacs-version }} + - uses: jcs090218/setup-emacs@master + with: + version: ${{ matrix.emacs-version }} - - uses: emacs-eask/setup-eask@master - with: - version: 'snapshot' + - uses: emacs-eask/setup-eask@master + with: + version: 'snapshot' - - name: Run tests - run: - make ci + - name: Run tests + run: + make ci diff --git a/README.md b/README.md index a212b51..c90bd66 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,13 @@ [![JCS-ELPA](https://raw.githubusercontent.com/jcs-emacs/badges/master/elpa/v/google-gemini.svg)](https://jcs-emacs.github.io/jcs-elpa/#/google-gemini) # google-gemini + > Elisp library for the Google Gemini API [![CI](https://github.com/emacs-openai/google-gemini/actions/workflows/test.yml/badge.svg)](https://github.com/emacs-openai/google-gemini/actions/workflows/test.yml) The [Google Gemini][] Elisp library provides convenient access to the Gemini API from -applications written in the Elisp language. +applications written in the Elisp language. *P.S. This package is expected to be used as a library, so there are only a few interactable commands you can use, and those are mostly examples.* @@ -96,20 +97,20 @@ To run the test locally, you will need the following tools: Install all dependencies and development dependencies: ```sh -$ eask install-deps --dev +eask install-deps --dev ``` To test the package's installation: ```sh -$ eask package -$ eask install +eask package +eask install ``` To test compilation: ```sh -$ eask compile +eask compile ``` **🪧 The following steps are optional, but we recommend you follow these lint results!** @@ -117,13 +118,13 @@ $ eask compile The built-in `checkdoc` linter: ```sh -$ eask lint checkdoc +eask lint checkdoc ``` The standard `package` linter: ```sh -$ eask lint package +eask lint package ``` *📝 P.S. For more information, find the Eask manual at https://emacs-eask.github.io/.* @@ -141,11 +142,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . See [`LICENSE`](./LICENSE) for details. - [Google Gemini]: https://gemini.google.com/ diff --git a/google-gemini-chat.el b/google-gemini-chat.el index 90e6359..148fce9 100644 --- a/google-gemini-chat.el +++ b/google-gemini-chat.el @@ -30,29 +30,29 @@ ;;; API ;;;###autoload -(cl-defun google-gemini-chat ( contents callback - &key - (content-type "application/json") - (parameters google-gemini-parameters) - (key google-gemini-key) - (model "gemini-pro") - (category "HARM_CATEGORY_DANGEROUS_CONTENT") - (threshold "BLOCK_ONLY_HIGH") - stop-sequences - temperature - max-output-tokens - top-p - top-k) +(cl-defun google-gemini-chat (contents callback + &key + (content-type "application/json") + (parameters google-gemini-parameters) + (key google-gemini-key) + (model "gemini-pro") + (category "HARM_CATEGORY_DANGEROUS_CONTENT") + (threshold "BLOCK_ONLY_HIGH") + stop-sequences + temperature + max-output-tokens + top-p + top-k) "Send chat request. Arguments CONTENTS and CALLBACK are required for this type of request. -CONTENTS is the chat conversation data. CALLBACK is the execuation after +CONTENTS is the chat conversation data. CALLBACK is the execution after request is made. Arguments PARAMETERS, CONTENT-TYPE, and KEY are global options; however, you can overwrite the value by passing it in. -The rest of the arugments are optional, please see Google Gemini API reference +The rest of the arguments are optional, please see Google Gemini API reference page for more information. Arguments here refer to MODEL, TEMPERATURE, STOP-SEQUENCES, MAX-OUTPUT-TOKENS, TOP-P, and TOP-K." (google-gemini-request (concat google-gemini-generativelanguage-url diff --git a/google-gemini-content.el b/google-gemini-content.el index 261ebb9..5a83321 100644 --- a/google-gemini-content.el +++ b/google-gemini-content.el @@ -30,30 +30,30 @@ ;;; API ;;;###autoload -(cl-defun google-gemini-content-generate ( text callback - &key - (parameters google-gemini-parameters) - (content-type "application/json") - (key google-gemini-key) - (model "gemini-pro") - (category "HARM_CATEGORY_DANGEROUS_CONTENT") - (threshold "BLOCK_ONLY_HIGH") - stop-sequences - temperature - max-output-tokens - top-p - top-k) +(cl-defun google-gemini-content-generate (text callback + &key + (parameters google-gemini-parameters) + (content-type "application/json") + (key google-gemini-key) + (model "gemini-pro") + (category "HARM_CATEGORY_DANGEROUS_CONTENT") + (threshold "BLOCK_ONLY_HIGH") + stop-sequences + temperature + max-output-tokens + top-p + top-k) "Send generate content request. Arguments TEXT and CALLBACK are required for this type of request. -TEXT is the content data. CALLBACK is the execuation after request is made. +TEXT is the content data. CALLBACK is the execution after request is made. Arguments PARAMETERS, CONTENT-TYPE, and KEY are global options; however, you can overwrite the value by passing it in. -The rest of the arugments are optional, please see Google Gemini API reference -page for more information. Arguments here refer to MODEL, TEMPERATURE, -STOP-SEQUENCES, MAX-OUTPUT-TOKENS, TOP-P, and TOP-K." +The rest of the arguments are optional, please see Google Gemini API reference +page for more information. Arguments here refer to MODEL, CATEGORY, THRESHOLD, +TEMPERATURE, STOP-SEQUENCES, MAX-OUTPUT-TOKENS, TOP-P, and TOP-K." (google-gemini-request (concat google-gemini-generativelanguage-url "v1beta/models/" model ":generateContent?key=" key) diff --git a/google-gemini-count-tokens.el b/google-gemini-count-tokens.el index bfb1b40..b0edd47 100644 --- a/google-gemini-count-tokens.el +++ b/google-gemini-count-tokens.el @@ -28,18 +28,21 @@ ;;; API ;;;###autoload -(cl-defun google-gemini-count-tokens ( text callback - &key - (parameters google-gemini-parameters) - (content-type "application/json") - (key google-gemini-key) - (model "gemini-pro")) +(cl-defun google-gemini-count-tokens (text callback + &key + (parameters google-gemini-parameters) + (content-type "application/json") + (key google-gemini-key) + (model "gemini-pro")) "Send count tokens request. +Arguments TEXT and CALLBACK are required for this type of request. +TEXT is the content data. CALLBACK is the execution after request is made. + Arguments PARAMETERS, CONTENT-TYPE, and KEY are global options; however, you can overwrite the value by passing it in. -The rest of the arugments are optional, please see Google Gemini API reference +The rest of the arguments are optional, please see Google Gemini API reference page for more information. Arguments here refer to MODEL." (google-gemini-request (concat google-gemini-generativelanguage-url "v1beta/models/" model ":countTokens?key=" diff --git a/google-gemini-embedding.el b/google-gemini-embedding.el index 433860f..6a36c3e 100644 --- a/google-gemini-embedding.el +++ b/google-gemini-embedding.el @@ -30,18 +30,21 @@ ;;; API ;;;###autoload -(cl-defun google-gemini-embedding ( text callback - &key - (parameters google-gemini-parameters) - (content-type "application/json") - (key google-gemini-key) - (model "embedding-001")) +(cl-defun google-gemini-embedding (text callback + &key + (parameters google-gemini-parameters) + (content-type "application/json") + (key google-gemini-key) + (model "embedding-001")) "Send generate content request. +Arguments TEXT and CALLBACK are required for this type of request. +TEXT is the content data. CALLBACK is the execution after request is made. + Arguments PARAMETERS, CONTENT-TYPE, and KEY are global options; however, you can overwrite the value by passing it in. -The rest of the arugments are optional, please see Google Gemini API reference +The rest of the arguments are optional, please see Google Gemini API reference page for more information. Arguments here refer to MODEL." (google-gemini-request (concat google-gemini-generativelanguage-url "v1beta/models/" model ":embedContent?key=" diff --git a/google-gemini-model.el b/google-gemini-model.el index 67c4670..3a9b1f8 100644 --- a/google-gemini-model.el +++ b/google-gemini-model.el @@ -30,15 +30,15 @@ ;;; API ;;;###autoload -(cl-defun google-gemini-model ( model - callback - &key - (parameters google-gemini-parameters) - (key google-gemini-key)) +(cl-defun google-gemini-model (model + callback + &key + (parameters google-gemini-parameters) + (key google-gemini-key)) "Send request to get model information. Arguments MODEL and CALLBACK are required for this type of request. -MODEL is the name of the model. CALLBACK is the execuation after request +MODEL is the name of the model. CALLBACK is the execution after request is made. Arguments PARAMETERS, and KEY are global options; however, you can overwrite the @@ -54,14 +54,14 @@ value by passing it in." (funcall callback data))))) ;;;###autoload -(cl-defun google-gemini-models ( callback - &key - (parameters google-gemini-parameters) - (key google-gemini-key)) +(cl-defun google-gemini-models (callback + &key + (parameters google-gemini-parameters) + (key google-gemini-key)) "Send request to get a list of supported models. Arguments CALLBACK is required for this type of request. -CALLBACK is the execuation after request is made. +CALLBACK is the execution after request is made. Arguments PARAMETERS, and KEY are global options; however, you can overwrite the value by passing it in." diff --git a/google-gemini.el b/google-gemini.el index f95e827..71027cc 100644 --- a/google-gemini.el +++ b/google-gemini.el @@ -62,7 +62,7 @@ ;;; Request (defvar google-gemini-key "" - "Variable storing the gemini key or a function name to retrieve it. + "Variable storing the Gemini key or a function name to retrieve it. The function should take no arguments and return a string containing the key. @@ -77,7 +77,7 @@ auth-source is provided for convenience.") (defcustom google-gemini-parameters '() "The parameters for the Google Gemini request." :type 'list - :group 'openai) + :group 'google-gemini) ;;;###autoload (defun google-gemini-key-auth-source (&optional base-url) @@ -108,8 +108,7 @@ Arguments CONTENT-TYPE are common request headers." `(("Content-Type" . ,content-type)))) (defun google-gemini--json-encode (object) - "Wrapper for function `json-encode' but it remove nil value before -constructing JSON data. + "Wrapper `json-encode' removing nil value before constructing JSON data. The argument OBJECT is an alist that can be construct to JSON data; see function `json-encode' for the detials." @@ -151,7 +150,7 @@ The URL is the url for `request' function; then BODY is the arguments for rest." (defconst google-gemini-generativelanguage-url "https://generativelanguage.googleapis.com/" - "Base Url for generativelanguage services.") + "Base URL for generativelanguage services.") (provide 'google-gemini) ;;; google-gemini.el ends here