Skip to main content

Ellama

Embeddings library

ollama unsloth faiss langchain

pca t-sne umap matplotlib

test

Unlike the overwhelming majority of alternatives:

  • handles long inputs without truncation even if the underlying model has a small context window
  • minimal config
  • 100% human-written (thus sane & clean) codebase

[!TIP] Please open an issue if you know of any better alternatives. I would love to archive this repo.

from ellama import EllamaDB, Document

db = EllamaDB("test")
db.add_documents([
    Document("hello world", id="salutation"),
    Document("goodbye and goodnight", id="farewell")])
docs = db.similarity_search("Greetings, Earth!", k=1)
assert len(docs) == 1
assert docs[0].id == "salutation"

plot

Embedding database visualisation:

import matplotlib.pyplot as plt
from ellama import EllamaDB, Document
from sklearn.datasets import fetch_20newsgroups

raw = fetch_20newsgroups(data_home='.cache')
db = EllamaDB("20newsgroups")
db.add_documents([
    Document(raw.data[i], id=str(i), metadata={'name': raw.target_names[raw.target[i]]})
    for i in range(200)])

for group in ['alt.atheism', 'comp', 'misc.forsale', 'rec', 'rec.sport', 'sci',
              'soc.religion', 'talk.politics', 'talk.religion']:
    db.plot('t-SNE', label=group,
            filter=lambda metadata: metadata['name'].startswith(f'{group}.'))

plt.title(f"Newsgroup {db.embeddings.model} embeddings t-SNE")
plt.legend()
plt.show()

fine-tune

Low-rank adaptation (LoRA) re-using the newsgroups database created above:

from ellama import EllamaDB
db = EllamaDB("20newsgroups")
db.lora(['name'], "ellama-lora:news", epochs=600)
# ollama create ellama-lora:news -f .cache/20newsgroups/lora/ellama-lora-news/Modelfile

# create new database using the new model
db_lora = EllamaDB("20newsgroups_lora", "ellama-lora:news", pull=False)
db_lora.add_documents(db.get_docs({}))

install

pip (CPU)

pip install "ellama[cpu]"           # basic
pip install "ellama[cpu,plot]"      # plot('PCA' or 't-SNE')
pip install "ellama[cpu,plot,umap]" # plot('UMAP')
pip install "ellama[lora]"          # fine-tuning

conda (GPU)

name: ellama
channels: [pytorch, nvidia, conda-forge]
dependencies:
- langchain 1.*
- langchain-community
- faiss-gpu
- requests
- tqdm
#- matplotlib   # ellama plot()
#- scikit-learn # ellama plot()
#- umap-learn   # ellama plot('UMAP')
#- unsloth      # ellama lora()
- pip
- pip:
  - ellama

Release files for ellama 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ellama 0.4.0
File Size Uploaded
ellama-0.4.0.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ellama 0.4.0
File Interpreter ABI Platform
ellama-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / ellama-0.4.0.tar.gz

Download URL ellama-0.4.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
edaa10b360ce8a1bc496233ca501ff7617c9a943683bd6ab32370ac93d2c42fa
BLAKE2b-256 checksum
How to use checksums
ddba5ef39b542fc1530aa8ab60481c73ef5195d41542c1c0b2285e7c520aa65c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.2.0 CPython/3.14.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 9, 2026.

Transparency log

Release files / ellama-0.4.0-py3-none-any.whl

Download URL ellama-0.4.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2b30fcc802fe66bae2988aa9654531ec4eb247e9101bda845c96d1e6b0f12b8
BLAKE2b-256 checksum
How to use checksums
c378e07b8de2bc8e7bab058768ff5635bac28964f81eeac2941243435fb61875
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.2.0 CPython/3.14.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page