LLM plugin to access Google's Gemini family of models
Project description
llm-gemini
API access to Google's Gemini models
Installation
Install this plugin in the same environment as LLM.
llm install llm-gemini
Usage
Configure the model by setting a key called "gemini" to your API key:
llm keys set gemini
<paste key here>
Now run the model using -m gemini-pro
, for example:
llm -m gemini-pro "A joke about a pelican and a walrus"
Why did the pelican get mad at the walrus?
Because he called him a hippo-crit.
To chat interactively with the model, run llm chat
:
llm chat -m gemini-pro
If you have access to the Gemini 1.5 Pro preview you can use -m gemini-1.5-pro-latest
to work with that model.
Embeddings
The plugin also adds support for the text-embedding-004
embedding model.
Run that against a single string like this:
llm embed -m text-embedding-004 -c 'hello world'
This returns a JSON array of 768 numbers.
This command will embed every README.md
file in child directories of the current directory and store the results in a SQLite database called embed.db
in a collection called readmes
:
llm embed-multi readmes --files . '*/README.md' -d embed.db -m text-embedding-004
You can then run similarity searches against that collection like this:
llm similar readmes -c 'upload csvs to stuff' -d embed.db
See the LLM embeddings documentation for further details.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-gemini
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
llm install -e '.[test]'
To run the tests:
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file llm_gemini-0.1a4.tar.gz
.
File metadata
- Download URL: llm_gemini-0.1a4.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3675a8d55f4bca425f32f1f243f1613dace95fa93083902bf3ddba28e8a826b |
|
MD5 | 2cf6d1a4b1286878cf325d0d0b3c48cc |
|
BLAKE2b-256 | f95975cd412222572f974ec28360f3e9325e5bd1e965f5c4ba6b02ab4e43b6d1 |
File details
Details for the file llm_gemini-0.1a4-py3-none-any.whl
.
File metadata
- Download URL: llm_gemini-0.1a4-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4f0ef4c67e2b486268a19734e99e576114a9d31188fc0dac276978a56ec2b29 |
|
MD5 | 2dade25821176c2d647cfde3c38919b6 |
|
BLAKE2b-256 | 17b987f783f94a1a79aa7af69f895b6c26b0635e5139c48255453217d36b9910 |