Skip to main content

High-performance vector database with unified configuration, I/O optimization, and automatic embeddings

Project description

VittoriaDB Python SDK

PyPI version Python versions License

Python client for VittoriaDB — an embedded vector database shipped as a single Go binary. The SDK talks to the server over HTTP: collections, vectors, semantic search, server-side embeddings, document upload, and RAG-friendly content storage. Optional auto-start downloads a matching release binary (when available) and manages the process lifecycle.


Documentation

Topic Where
REST API (paths, JSON bodies, filters) docs/api.md
Embeddings & vectorizers docs/embeddings.md
Installation & troubleshooting docs/installation.md
Server & YAML configuration docs/configuration.md
Content storage for RAG docs/content-storage.md
CLI (run, backup, restore, …) docs/cli.md
Examples (Python / Go / curl) examples/README.md

Features

Area What the SDK exposes
Collections Create / list / delete; DistanceMetric, IndexType (FLAT, HNSW, IVF prototype)
Vectors insert, insert_batch, get, delete, search with optional metadata
Embeddings insert_text, insert_text_batch, search_text when the collection has a VectorizerConfig
Documents upload_file / upload_files — PDF, DOCX, TXT, MD, HTML (server-side processors)
Metadata filters Flat dict ({"category": "tech"}) or structured filter JSON; use search(..., use_post=True) for POST search bodies
Indexes HNSW tuning via config; IVF tuning via Configure.Index.ivf_flat(nlist=, nprobe=)
Observability health(), stats() (DatabaseStats: totals, latency, QPS), prometheus_metrics()GET /metrics text
Configuration config() → unified server config + feature flags (requires compatible server)
Errors Typed exceptions: ConnectionError, CollectionError, VectorError, SearchError, BinaryError

Backup and restore are not HTTP APIs: use the vittoriadb CLI (backup / restore). Stop the server before restore.


Installation

pip install vittoriadb

On install, the package tries to download a platform binary from GitHub Releases at tag v<sdk-version> (e.g. v0.7.0). If that asset is missing, you’ll see a warning — install the binary manually or put vittoriadb on your PATH.


Quick start

Connect

import vittoriadb

# Managed local server (downloads binary when release exists)
db = vittoriadb.connect()

# Existing server
db = vittoriadb.connect(url="http://localhost:8080", auto_start=False)

db.close()

Vectors and similarity search

collection = db.create_collection(
    name="docs",
    dimensions=384,
    metric="cosine",
)

collection.insert(
    "doc1",
    vector=[0.1] * 384,
    metadata={"title": "Hello", "category": "demo"},
)

results = collection.search(
    vector=[0.1] * 384,
    limit=5,
    filter={"category": "demo"},
    include_metadata=True,
)

# Structured / nested filters: POST search
results = collection.search(
    vector=[0.1] * 384,
    limit=5,
    use_post=True,
    filter={
        "and": [
            {"field": "category", "operator": "eq", "value": "demo"},
        ]
    },
)

Server-side embeddings

from vittoriadb.configure import Configure

collection = db.create_collection(
    name="smart",
    dimensions=384,
    vectorizer_config=Configure.Vectors.auto_embeddings(),
)

collection.insert_text(
    "a1",
    "Your text here.",
    metadata={"source": "wiki"},
)

hits = collection.search_text("your query", limit=5)

Observability

h = db.health()           # HealthStatus
s = db.stats()            # DatabaseStats: queries_total, avg_query_latency, queries_per_sec, …
text = db.prometheus_metrics()  # Prometheus exposition from GET /metrics

IVF index (prototype)

from vittoriadb import IndexType
from vittoriadb.configure import Configure

collection = db.create_collection(
    name="ivf_demo",
    dimensions=64,
    index_type=IndexType.IVF,
    config=Configure.Index.ivf_flat(nlist=16, nprobe=2),
)

RAG and content storage

Enable ContentStorageConfig on create_collection to persist chunk text for retrieval (include_content=True on search_text). See docs/content-storage.md.

from vittoriadb import ContentStorageConfig

collection = db.create_collection(
    name="rag",
    dimensions=384,
    vectorizer_config=Configure.Vectors.auto_embeddings(),
    content_storage=ContentStorageConfig(enabled=True, field_name="_content"),
)

collection.insert_text("id1", "Long passage …", metadata={"title": "Doc"})

for r in collection.search_text("query", limit=3, include_content=True):
    if r.has_content():
        print(r.content)

Vectorizer presets (Configure.Vectors)

Method Use case
auto_embeddings(...) Default server-side pipeline (often Sentence Transformers–backed on server)
sentence_transformers(model=, dimensions=) Explicit ST model
openai_embeddings(api_key=, …) OpenAI API
huggingface_embeddings(api_key=, …) Hugging Face Inference API
ollama_embeddings(model=, dimensions=, base_url=) Local Ollama

Details: docs/embeddings.md.


Index tuning

HNSW — pass index_type="hnsw" or IndexType.HNSW and config keys such as m, ef_construction, ef_search (see API / server defaults).

IVFindex_type=IndexType.IVF and config=Configure.Index.ivf_flat(nlist=16, nprobe=2) (prototype index on server).


Configuration inspection

info = db.config()   # dict: unified config + metadata from GET /config

API overview

VittoriaDB

Method Description
connect(url=, auto_start=, port=, host=, data_dir=, extra_args=) Client instance
create_collection(...) New collection
get_collection(name) Handle to existing collection
list_collections() List CollectionInfo
delete_collection(name) Drop collection
health() HealthStatus
stats() DatabaseStats
prometheus_metrics() Raw Prometheus text
config() Server configuration JSON
close() Cleanup / stop auto-started server

Collection

Method Description
insert(id, vector, metadata=) Single vector
insert_batch(vectors) Batch
insert_text / insert_text_batch Server-side embedding
search(vector, limit=, filter=, use_post=, …) Similarity search
search_text(query, limit=, filter=, …) Query embedding + search
upload_file / upload_files Document → chunks + vectors
get / delete / count CRUD helpers

Exported types include Vector, SearchResult, CollectionInfo, HealthStatus, DatabaseStats, DistanceMetric, IndexType, VectorizerConfig, ContentStorageConfig, and configuration/error types listed in vittoriadb.__all__.


Contributing & license


Changelog (high level)

  • 0.7.0 — Aligned with VittoriaDB v0.7.0 GitHub release assets; same feature set as 0.6.x (filters, use_post, prometheus_metrics, Configure.Index.ivf_flat, HealthStatus / DatabaseStats); documentation table and API overview updated.
  • 0.6.x — Metadata filters, observability helpers, IVF config in client; README refresh.
  • 0.5.x — Unified server configuration; config(); performance-related server features.

Full release notes: GitHub Releases.

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

vittoriadb-0.7.0.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

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

vittoriadb-0.7.0-py3-none-any.whl (4.1 MB view details)

Uploaded Python 3

File details

Details for the file vittoriadb-0.7.0.tar.gz.

File metadata

  • Download URL: vittoriadb-0.7.0.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for vittoriadb-0.7.0.tar.gz
Algorithm Hash digest
SHA256 6ebdb08d972fa24c4e401200f57031b34d505646a994ce2d3116209ff3d4d4d4
MD5 69f5bae781aa0b122b70005399feafd3
BLAKE2b-256 006557e856a1836d6bbd93c1870118e11935eabaa8cc92592516e513050db1d1

See more details on using hashes here.

File details

Details for the file vittoriadb-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: vittoriadb-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for vittoriadb-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d57ff997df543279e4361ce9e284289b558b4bfddec32dd2b843e983f62111e
MD5 b0f681c98856b1cd57b3500a3b6e773e
BLAKE2b-256 0cc2bcaaf58acfaf3c932e9277cd03e00ba16e9a227d8be2c3cf51fc1413c66d

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