Skip to main content

achillesdb

Python client for AchillesDB, a hybrid vector and document database (WiredTiger + FAISS under the hood).

Install

pip install achillesdb

Requires Python >= 3.10. The client talks to a running AchillesDB server over HTTP, so you'll need one reachable (defaults to localhost:8180).

Quickstart (sync)

from achillesdb import AchillesClient

with AchillesClient(host="localhost", port=8180) as client:
    db = client.create_database("docs")

    collection = db.create_collection("articles")
    collection.add_documents(
        ids=["1", "2"],
        documents=["hello world", "goodbye world"],
        embeddings=[[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]],
        metadatas=[{"category": "tech"}, {"category": "food"}],
    )

    results = collection.query(top_k=5, query_embedding=[0.1, 0.2, 0.3])
    print(results)

Quickstart (async)

import asyncio
from achillesdb import AsyncAchillesClient

async def main():
    async with AsyncAchillesClient(host="localhost", port=8180) as client:
        db = await client.create_database("docs")
        collection = await db.create_collection("articles")
        await collection.add_documents(
            ids=["1"],
            documents=["hello world"],
            embeddings=[[0.1, 0.2, 0.3]],
        )
        results = await collection.query(top_k=5, query_embedding=[0.1, 0.2, 0.3])
        print(results)

asyncio.run(main())

Filtering with where

Pass a plain dict shaped like the HTTP API's where field, or use the W builder for a fluent API. Supported operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $arrContains, $and, $or.

from achillesdb import W

collection.query(
    top_k=5,
    query_embedding=[0.1, 0.2, 0.3],
    where=W.and_(W.eq("category", "tech"), W.nin_("year", [2020, 2021])),
)

# equivalent plain-dict form
collection.query(
    top_k=5,
    query_embedding=[0.1, 0.2, 0.3],
    where={"$and": [{"category": "tech"}, {"year": {"$nin": [2020, 2021]}}]},
)

Embedding functions

Pass embedding_function to the client to embed text automatically instead of supplying embeddings/query_embedding yourself:

client = AchillesClient(embedding_function=my_embed_fn)
collection.add_documents(ids=["1"], documents=["hello world"])
collection.query(top_k=5, query="hello")

my_embed_fn takes a list[str] and returns a list[list[float]] (sync or async, matching the client's mode).

Development

cd sdk/python
uv sync
uv run pytest -m unit            # unit + mocked tests, no server required
uv run pytest -m integration     # requires a running AchillesDB server

License

See the repository root for license information.

Metadata

Release files for achillesdb 0.1.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 achillesdb 0.1.0
File Size Uploaded
achillesdb-0.1.0.tar.gz 18.8 kB Details

Built distribution (wheel)

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

Total release size: 41.9 kB

Release files / achillesdb-0.1.0.tar.gz

Download URL achillesdb-0.1.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2b6fbd200f25006f61bd1fce420c8cab38ed6686e82ad4fd3fd3c3b2c779a329
BLAKE2b-256 checksum
How to use checksums
e99fb5e76592eb6ca6201f600b5946dc173e69286e3f1a2059b5130b39af5b2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.20

Release files / achillesdb-0.1.0-py3-none-any.whl

Download URL achillesdb-0.1.0-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1cfc3aa1fdd666ddf199fdc182753ce66961b1f96517517b488c3bd047aa3f2
BLAKE2b-256 checksum
How to use checksums
f38f07dcfc787f84b3d84966417c9a13a3dac8f3d7cdd9b4089032b1a14d4f8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.20

Release history Release notifications | RSS feed

This release

0.1.0 This release

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