Skip to content

fixes for docu, spelling, plus single elisp #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down Expand Up @@ -96,34 +97,34 @@ 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!**

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/.*
Expand All @@ -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 <https://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

See [`LICENSE`](./LICENSE) for details.


<!-- Links -->

[Google Gemini]: https://gemini.google.com/
30 changes: 15 additions & 15 deletions google-gemini-chat.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 17 additions & 17 deletions google-gemini-content.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 10 additions & 7 deletions google-gemini-count-tokens.el
Original file line number Diff line number Diff line change
Expand Up @@ -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="
Expand Down
17 changes: 10 additions & 7 deletions google-gemini-embedding.el
Original file line number Diff line number Diff line change
Expand Up @@ -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="
Expand Down
22 changes: 11 additions & 11 deletions google-gemini-model.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."
Expand Down
9 changes: 4 additions & 5 deletions google-gemini.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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)
Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -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