Skip to main content

Ollama-based embedding + retrieval pipeline backed by skeg.

Project description

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

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 --data-dir ./data                     # the KV+vector backend

Usage

from skeg_ollama import OllamaRetriever

with OllamaRetriever(
    skeg_addr=("127.0.0.1", 7379),
    index_name="my-notes",
    ollama_model="nomic-embed-text",
) 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

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-server fixture. 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.

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

skeg_ollama-0.1.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skeg_ollama-0.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file skeg_ollama-0.1.0.tar.gz.

File metadata

  • Download URL: skeg_ollama-0.1.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for skeg_ollama-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b02b938ddd0a1d2e58b2b3e74be6275e94f8a801e628c6ef822b6262b5fd1e51
MD5 962be4e9c4f1433322fb7db49f66899b
BLAKE2b-256 5bff7af066bdef425e14b6869da0880cb36ff756000e05280fdf729aa7cbe8b5

See more details on using hashes here.

File details

Details for the file skeg_ollama-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: skeg_ollama-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for skeg_ollama-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61926a3e9b55fdfde35eb2a07a8bac7ef2d9d70581247679d2b8a6c6d8daac41
MD5 063ddbb74b90c41502a2a0d64ed95073
BLAKE2b-256 b91fc5efe2b801390f537f2dd48de2a45604c4b981627b3d05ef63e10012cfb2

See more details on using hashes here.

Supported by

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