llm-nomic-api-embed


Namellm-nomic-api-embed JSON
Version 0.3 PyPI version JSON
download
home_pageNone
SummaryCreate embeddings using the Nomic API
upload_time2024-11-21 23:06:52
maintainerNone
docs_urlNone
authorSimon Willison
requires_pythonNone
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # llm-nomic-api-embed

[![PyPI](https://img.shields.io/pypi/v/llm-nomic-api-embed.svg)](https://pypi.org/project/llm-nomic-api-embed/)
[![Changelog](https://img.shields.io/github/v/release/simonw/llm-nomic-api-embed?include_prereleases&label=changelog)](https://github.com/simonw/llm-nomic-api-embed/releases)
[![Tests](https://github.com/simonw/llm-nomic-api-embed/actions/workflows/test.yml/badge.svg)](https://github.com/simonw/llm-nomic-api-embed/actions/workflows/test.yml)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-nomic-api-embed/blob/main/LICENSE)

Create embeddings using the Nomic API

## Installation

Install this plugin in the same environment as [LLM](https://llm.datasette.io/).
```bash
llm install llm-nomic-api-embed
```
## Usage

This plugin requires [a Nomic API key](https://atlas.nomic.ai/). These include a generous free allowance for their embedding API.

Configure the key like this:
```bash
llm keys set nomic
# Paste key here
```
You can then use the Nomic embedding models like this:
```bash
llm embed -m nomic-1.5 -c 'hello world'
```
This will return a 768 item floating point array as JSON.

See [the LLM embeddings documentation](https://llm.datasette.io/en/stable/embeddings/index.html) for more you can do with the tool.

## Models

Run `llm embed-models` for a full list. The Nomic models are:

```
nomic-embed-text-v1 (aliases: nomic-1)
nomic-embed-text-v1.5 (aliases: nomic-1.5)
nomic-embed-text-v1.5-512 (aliases: nomic-1.5-512)
nomic-embed-text-v1.5-256 (aliases: nomic-1.5-256)
nomic-embed-text-v1.5-128 (aliases: nomic-1.5-128)
nomic-embed-text-v1.5-64 (aliases: nomic-1.5-64)
nomic-embed-vision-v1
nomic-embed-vision-v1.5
nomic-embed-combined-v1
nomic-embed-combined-v1.5
```
Vision models can be used with image files using the `--binary` option, for example:

```bash
llm embed-multi images --files . '*.png' \
  --binary --model nomic-embed-vision-v1.5
```

### Combined vision and text models

The `nomic-embed-combined-v1` and `nomic-embed-combined-v1.5` models are special - they will automatically use their respective text models for text inputs and their respective vision models for images.

This means you can use them to create a collection that mixes images and text, or you can create an image collection with them and then use text to find similar images.

Here's how do do that for a `photos/` directory full of JPEGs:

```bash
llm embed-multi --binary -m nomic-embed-combined-v1.5 \
  -d photos.db photos --files photos/ '*.jpeg'
```
Then run similarity searches like this:
```bash
llm similar photos -d photos.db -c pelican
```

## Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd llm-nomic-api-embed
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-nomic-api-embed",
    "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/73/aa/a39f0dde114ad184c841ddfee26a2ab387b4cae162a5bc46a67ae1080391/llm_nomic_api_embed-0.3.tar.gz",
    "platform": null,
    "description": "# llm-nomic-api-embed\n\n[![PyPI](https://img.shields.io/pypi/v/llm-nomic-api-embed.svg)](https://pypi.org/project/llm-nomic-api-embed/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/llm-nomic-api-embed?include_prereleases&label=changelog)](https://github.com/simonw/llm-nomic-api-embed/releases)\n[![Tests](https://github.com/simonw/llm-nomic-api-embed/actions/workflows/test.yml/badge.svg)](https://github.com/simonw/llm-nomic-api-embed/actions/workflows/test.yml)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-nomic-api-embed/blob/main/LICENSE)\n\nCreate embeddings using the Nomic API\n\n## Installation\n\nInstall this plugin in the same environment as [LLM](https://llm.datasette.io/).\n```bash\nllm install llm-nomic-api-embed\n```\n## Usage\n\nThis plugin requires [a Nomic API key](https://atlas.nomic.ai/). These include a generous free allowance for their embedding API.\n\nConfigure the key like this:\n```bash\nllm keys set nomic\n# Paste key here\n```\nYou can then use the Nomic embedding models like this:\n```bash\nllm embed -m nomic-1.5 -c 'hello world'\n```\nThis will return a 768 item floating point array as JSON.\n\nSee [the LLM embeddings documentation](https://llm.datasette.io/en/stable/embeddings/index.html) for more you can do with the tool.\n\n## Models\n\nRun `llm embed-models` for a full list. The Nomic models are:\n\n```\nnomic-embed-text-v1 (aliases: nomic-1)\nnomic-embed-text-v1.5 (aliases: nomic-1.5)\nnomic-embed-text-v1.5-512 (aliases: nomic-1.5-512)\nnomic-embed-text-v1.5-256 (aliases: nomic-1.5-256)\nnomic-embed-text-v1.5-128 (aliases: nomic-1.5-128)\nnomic-embed-text-v1.5-64 (aliases: nomic-1.5-64)\nnomic-embed-vision-v1\nnomic-embed-vision-v1.5\nnomic-embed-combined-v1\nnomic-embed-combined-v1.5\n```\nVision models can be used with image files using the `--binary` option, for example:\n\n```bash\nllm embed-multi images --files . '*.png' \\\n  --binary --model nomic-embed-vision-v1.5\n```\n\n### Combined vision and text models\n\nThe `nomic-embed-combined-v1` and `nomic-embed-combined-v1.5` models are special - they will automatically use their respective text models for text inputs and their respective vision models for images.\n\nThis means you can use them to create a collection that mixes images and text, or you can create an image collection with them and then use text to find similar images.\n\nHere's how do do that for a `photos/` directory full of JPEGs:\n\n```bash\nllm embed-multi --binary -m nomic-embed-combined-v1.5 \\\n  -d photos.db photos --files photos/ '*.jpeg'\n```\nThen run similarity searches like this:\n```bash\nllm similar photos -d photos.db -c pelican\n```\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd llm-nomic-api-embed\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": "Create embeddings using the Nomic API",
    "version": "0.3",
    "project_urls": {
        "CI": "https://github.com/simonw/llm-nomic-api-embed/actions",
        "Changelog": "https://github.com/simonw/llm-nomic-api-embed/releases",
        "Homepage": "https://github.com/simonw/llm-nomic-api-embed",
        "Issues": "https://github.com/simonw/llm-nomic-api-embed/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2af6309ac014bc8812956d5275941a73a29d33ed4fb2385183bd954a1dcacbe9",
                "md5": "82844411a3cb0472e0915183a025acbf",
                "sha256": "c7046739761cfb4058e3fcc19acf56612ff71631dde5cd774377ba298495a05f"
            },
            "downloads": -1,
            "filename": "llm_nomic_api_embed-0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "82844411a3cb0472e0915183a025acbf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8057,
            "upload_time": "2024-11-21T23:06:51",
            "upload_time_iso_8601": "2024-11-21T23:06:51.118641Z",
            "url": "https://files.pythonhosted.org/packages/2a/f6/309ac014bc8812956d5275941a73a29d33ed4fb2385183bd954a1dcacbe9/llm_nomic_api_embed-0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "73aaa39f0dde114ad184c841ddfee26a2ab387b4cae162a5bc46a67ae1080391",
                "md5": "c5ad1986fb24a589265d28084c212634",
                "sha256": "96729b3fbcfbc925b62208d55d38ca7850063cb96a81911ee0a73b21aff8699b"
            },
            "downloads": -1,
            "filename": "llm_nomic_api_embed-0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "c5ad1986fb24a589265d28084c212634",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8257,
            "upload_time": "2024-11-21T23:06:52",
            "upload_time_iso_8601": "2024-11-21T23:06:52.160082Z",
            "url": "https://files.pythonhosted.org/packages/73/aa/a39f0dde114ad184c841ddfee26a2ab387b4cae162a5bc46a67ae1080391/llm_nomic_api_embed-0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-21 23:06:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "simonw",
    "github_project": "llm-nomic-api-embed",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "llm-nomic-api-embed"
}
        
Elapsed time: 1.53533s