Name | llm-gemini JSON |
Version |
0.1a3
JSON |
| download |
home_page | None |
Summary | LLM plugin to access Google's Gemini family of models |
upload_time | 2024-04-10 21:38:12 |
maintainer | None |
docs_url | None |
author | Simon Willison |
requires_python | None |
license | Apache-2.0 |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# llm-gemini
[![PyPI](https://img.shields.io/pypi/v/llm-gemini.svg)](https://pypi.org/project/llm-gemini/)
[![Changelog](https://img.shields.io/github/v/release/simonw/llm-gemini?include_prereleases&label=changelog)](https://github.com/simonw/llm-gemini/releases)
[![Tests](https://github.com/simonw/llm-gemini/workflows/Test/badge.svg)](https://github.com/simonw/llm-gemini/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-gemini/blob/main/LICENSE)
API access to Google's Gemini models
## Installation
Install this plugin in the same environment as [LLM](https://llm.datasette.io/).
```bash
llm install llm-gemini
```
## Usage
Configure the model by setting a key called "gemini" to your [API key](https://ai.google.dev/):
```bash
llm keys set gemini
```
```
<paste key here>
```
Now run the model using `-m gemini-pro`, for example:
```bash
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`:
```bash
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:
```bash
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`:
```bash
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:
```bash
llm similar readmes -c 'upload csvs to stuff' -d embed.db
```
See the [LLM embeddings documentation](https://llm.datasette.io/en/stable/embeddings/cli.html) for further details.
## Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd llm-gemini
python3 -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
llm install -e '.[test]'
```
To run the tests:
```bash
pytest
```
Raw data
{
"_id": null,
"home_page": null,
"name": "llm-gemini",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Simon Willison",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/2a/b2/9be29a1b28ed883c864da3fafd2e5f49d1a38ec3e5f0d2b782c5a2e09279/llm-gemini-0.1a3.tar.gz",
"platform": null,
"description": "# llm-gemini\n\n[![PyPI](https://img.shields.io/pypi/v/llm-gemini.svg)](https://pypi.org/project/llm-gemini/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/llm-gemini?include_prereleases&label=changelog)](https://github.com/simonw/llm-gemini/releases)\n[![Tests](https://github.com/simonw/llm-gemini/workflows/Test/badge.svg)](https://github.com/simonw/llm-gemini/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-gemini/blob/main/LICENSE)\n\nAPI access to Google's Gemini models\n\n## Installation\n\nInstall this plugin in the same environment as [LLM](https://llm.datasette.io/).\n```bash\nllm install llm-gemini\n```\n## Usage\n\nConfigure the model by setting a key called \"gemini\" to your [API key](https://ai.google.dev/):\n\n```bash\nllm keys set gemini\n```\n```\n<paste key here>\n```\n\nNow run the model using `-m gemini-pro`, for example:\n\n```bash\nllm -m gemini-pro \"A joke about a pelican and a walrus\"\n```\n\n> Why did the pelican get mad at the walrus?\n>\n> Because he called him a hippo-crit.\n\nTo chat interactively with the model, run `llm chat`:\n\n```bash\nllm chat -m gemini-pro\n```\n\nIf you have access to the Gemini 1.5 Pro preview you can use `-m gemini-1.5-pro-latest` to work with that model.\n\n### Embeddings\n\nThe plugin also adds support for the `text-embedding-004` embedding model.\n\nRun that against a single string like this:\n```bash\nllm embed -m text-embedding-004 -c 'hello world'\n```\nThis returns a JSON array of 768 numbers.\n\nThis 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`:\n\n```bash\nllm embed-multi readmes --files . '*/README.md' -d embed.db -m text-embedding-004\n```\nYou can then run similarity searches against that collection like this:\n```bash\nllm similar readmes -c 'upload csvs to stuff' -d embed.db\n```\n\nSee the [LLM embeddings documentation](https://llm.datasette.io/en/stable/embeddings/cli.html) for further details.\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd llm-gemini\npython3 -m venv venv\nsource venv/bin/activate\n```\nNow install the dependencies and test dependencies:\n```bash\nllm install -e '.[test]'\n```\nTo run the tests:\n```bash\npytest\n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "LLM plugin to access Google's Gemini family of models",
"version": "0.1a3",
"project_urls": {
"CI": "https://github.com/simonw/llm-gemini/actions",
"Changelog": "https://github.com/simonw/llm-gemini/releases",
"Homepage": "https://github.com/simonw/llm-gemini",
"Issues": "https://github.com/simonw/llm-gemini/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ca77e8f6cc7262297f37cc8b8dc7971e4765c165e1b6511b9379cb8aa286309a",
"md5": "6687460718304494f15e93421ae39bce",
"sha256": "13ee72fca47aa2b05722359190e750f60d408bf357280914a45efe3f589fa70c"
},
"downloads": -1,
"filename": "llm_gemini-0.1a3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6687460718304494f15e93421ae39bce",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8122,
"upload_time": "2024-04-10T21:38:10",
"upload_time_iso_8601": "2024-04-10T21:38:10.902616Z",
"url": "https://files.pythonhosted.org/packages/ca/77/e8f6cc7262297f37cc8b8dc7971e4765c165e1b6511b9379cb8aa286309a/llm_gemini-0.1a3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2ab29be29a1b28ed883c864da3fafd2e5f49d1a38ec3e5f0d2b782c5a2e09279",
"md5": "4bd165eb2b86a64adaa1405212654e92",
"sha256": "fbb15bbb92949d72d6a7c9da0945f815c81eed8124c53571bd3f586c9557a32a"
},
"downloads": -1,
"filename": "llm-gemini-0.1a3.tar.gz",
"has_sig": false,
"md5_digest": "4bd165eb2b86a64adaa1405212654e92",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7801,
"upload_time": "2024-04-10T21:38:12",
"upload_time_iso_8601": "2024-04-10T21:38:12.450139Z",
"url": "https://files.pythonhosted.org/packages/2a/b2/9be29a1b28ed883c864da3fafd2e5f49d1a38ec3e5f0d2b782c5a2e09279/llm-gemini-0.1a3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-10 21:38:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "simonw",
"github_project": "llm-gemini",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "llm-gemini"
}