Skip to main content

skeg-ollama

Ollama-backed embedding + retrieval pipeline using skeg. Two helpers: OllamaEmbedder (thin embeddings wrapper) and OllamaRetriever (end-to-end embed + store + search). A two-files-of-code path to "I have Ollama running locally, give me a vector DB that does not eat my LLM's RAM."

Talks to skeg over RESP3 (skeg-resp3, port 6379). That is where the TurboQuant tiers live: the native binary protocol cannot name them, because its kind byte 3 means PQ.

Install

pip install skeg-ollama

Pulls in skeg (Python client) and ollama automatically. Server + daemon install is separate:

brew tap skegdb/tap && brew install skeg   # skeg server
ollama serve                               # Ollama daemon
ollama pull nomic-embed-text               # embedding model
skeg-resp3 --data-dir ./data               # the KV+vector backend (RESP3)

Usage

from skeg_ollama import OllamaRetriever

with OllamaRetriever(
    skeg_addr=("127.0.0.1", 6379),
    index_name="my-notes",
    ollama_model="nomic-embed-text",
    # kind defaults to "tq2"; see the tier table below
) as r:
    r.add([
        "the sky is blue",
        "grass is green",
        "cats are fluffy",
    ])
    for text, score in r.search("what colour is the sky?", k=2):
        print(f"  {score:.3f}  {text}")

Output (roughly):

  0.812  the sky is blue
  0.124  grass is green

Quantisation tier (kind)

kind What it is When
tq2 TurboQuant, 2 bits/dim. The default. Start here. Near-f32 recall at a fraction of the RAM
tq1 TurboQuant, 1 bit/dim Tightest memory budget, some recall given up
tq4 TurboQuant, 4 bits/dim When tq2 measurably loses recall on your data
int8 8-bit integer Previous default; kept for existing indexes
f32 No quantisation Exact scores, largest footprint
binary 1-bit sign Hamming distance, specialised use

The tier is fixed when the index is created. Changing it means creating a new index and re-indexing.

Persistence

The retriever's vec_id counter is persisted under the skeg KV side at next-id:{index_name}, so restarting the process keeps the numbering monotonic. The VINDEX itself is persisted via skeg's normal disk path (vindex-<name>/ directory).

When to use this vs skeg-llamaindex

  • Use skeg-ollama when you want a tiny, transparent retrieval loop with full control: 200 lines of code top to bottom, no framework.
  • Use skeg-llamaindex when you want LlamaIndex's full surface: document chunking, metadata filters, query engines, response synthesis.

Test-suite safety

The pytest suite spawns its own skeg-resp3 fixture; set SKEG_RESP3_BIN to the binary, or the tests skip. Tests create VINDEX entries with names like ollama-test, ollama-batch-..., ollama-empty etc., and drop them at the end. The counter key next-id:<index_name> is left as forensic data after each test drop. If you ever override the fixture to hit an external server, expect those names to collide. The fixture is the safe default.

License

Apache-2.0.

Release files for skeg-ollama 0.2.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 skeg-ollama 0.2.0
File Size Uploaded
skeg_ollama-0.2.0.tar.gz 18.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for skeg-ollama 0.2.0
File Interpreter ABI Platform
skeg_ollama-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.3 kB

Release files / skeg_ollama-0.2.0.tar.gz

Download URL skeg_ollama-0.2.0.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d2bbc17b52e3efff8282f39371199e35136fb70b807260b96a67a6bcaadb0c61
BLAKE2b-256 checksum
How to use checksums
adf94a9a87798f19833a9d2f6330850ed7751e971225fe69e86f85c05236ebb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / skeg_ollama-0.2.0-py3-none-any.whl

Download URL skeg_ollama-0.2.0-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7bc66cb0c6f727e2be58a91d9b529a10cd2621a0abbec833857a2f5720708682
BLAKE2b-256 checksum
How to use checksums
e5c4282acac5a52bb27bdb516af0e98bdabfa39f93f725757bb033c06c3c2622
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.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