Skip to main content

Embedding models using Ollama pulled models

Project description

llm-embed-ollama

PyPI Changelog Tests License

Embedding models using Ollama

Background

Ollama provides Few embedding models. This plugin enables the usage of those models using llm and ollama embeddings..

To utilize these models, you need to have an instance of the Ollama server running.

See also Embeddings: What they are and why they matter for background on embeddings and an explanation of the LLM embeddings tool.

See also Ollama Embeddings Models Blog

Installation

Install this plugin in the same environment as LLM.

llm install llm-embed-ollama

Usage

This plugin adds support for three new embedding models:

  • all-minilm
  • nomic-embed-text
  • mxbai-embed-large

The models needs to be downloaded. Using `ollama pull the first time you try to use them.

See the LLM documentation for everything you can do.

To get started embedding a single string, run the following:

Make sure you have the appropriate ollama model.

ollama pull all-minilm
llm embed -m all-minilm -c 'Hello world'

This will output a JSON array of 384 floating point numbers to your terminal.

To calculate and store embeddings for every README in the current directory (try this somewhere with a node_modules directory to get lots of READMEs) run this:

llm embed-multi ollama-readmes \
    -m all-minilm \
    --files . '**/README.md' --store

Then you can run searches against them like this:

llm similar ollama-readmes -c 'utility functions'

Add | jq to pipe it through jq for pretty-printed output, or | jq .id to just see the matching filenames.

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-embed-ollama
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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_embed_ollama-0.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

llm_embed_ollama-0.1.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file llm_embed_ollama-0.1.1.tar.gz.

File metadata

  • Download URL: llm_embed_ollama-0.1.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for llm_embed_ollama-0.1.1.tar.gz
Algorithm Hash digest
SHA256 aa3ee4b0a5b613c28de5e364810a66268c69917283f5b185330b0bd8e0ffb5b8
MD5 5df4c12434ce30ff42fcee72ea905899
BLAKE2b-256 308affe9c16491a50d7e7f17d4d3ce7242bbbd3c2e35e79aed67e6e546115c29

See more details on using hashes here.

File details

Details for the file llm_embed_ollama-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_embed_ollama-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8352f72e38848a725c58dae9d2ed0821ade060fe3161f2137d88988fc9a8be3a
MD5 e15ae47cab7c7a58446fd8c442f16b48
BLAKE2b-256 b97dbe1edcfc0b524837c8ba82c16241a03f07d46075d0737c4d43e9273fceb1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page