Skip to main content

fenecdb for Python

A client for fenec-server's HTTP endpoint (fenec-server --http <address>), and vector stores for LangChain and LlamaIndex on top of it.

pip install "fenecdb[langchain]"      # or "fenecdb[llama-index]"
from fenecdb import Client

db = Client("http://127.0.0.1:8080", token="...")
db.query("get articles select title near embed $1 limit 5", [[0.1, 0.2, 0.3]])

In an event loop -- FastAPI, aiohttp, an agent -- AsyncClient makes the same calls awaited, over one kept-alive connection, the standard library alone:

from fenecdb import AsyncClient

async with AsyncClient("http://127.0.0.1:8080", token="...") as db:
    rows = await db.query("get articles select title near embed $1 limit 5", [[0.1, 0.2, 0.3]])
    await db.batch([("put articles {title: $1}", ["a"]), ("put articles {title: $1}", ["b"])])

Every write on the server's disk (fenec-server --cdc), for a consumer whose cursor the server keeps -- each batch committed once the loop comes back for the next, so each write comes at least once -- and the same handed on to another program or a webhook:

for batch in db.follow("search-index"):
    for change in batch:               # {"seq", "at", "collection", "op", "id", "doc"}
        index(change)
python -m fenecdb.relay http://127.0.0.1:8080 --consumer kafka | kcat -P -b broker:9092 -t fenec
from fenecdb.langchain import FenecVectorStore

store = FenecVectorStore(embeddings, "docs", url="http://127.0.0.1:8080", token="...",
                         metadata_fields={"source": "text"})
store.add_documents(documents)
store.similarity_search("how do I compact", k=4, filter={"source": "handbook"})
from fenecdb.llama_index import FenecVectorStore
from llama_index.core import StorageContext, VectorStoreIndex

store = FenecVectorStore("docs", url="http://127.0.0.1:8080", token="...")
index = VectorStoreIndex.from_documents(
    documents, storage_context=StorageContext.from_defaults(vector_store=store)
)

A document or node is a row -- its id, text, metadata as JSON and vector under @hnsw -- in a collection created on the first write. Fields named in metadata_fields get columns of their own under @hash, and filters over them are answered by the index before the search runs.

With full_text=True the text is indexed for BM25 too, and both stores search by the words alone or by the words and the vector fused -- LangChain's mode="text" and mode="hybrid", LlamaIndex's TEXT_SEARCH and HYBRID. quant="int8" or "bit" keeps the graph over codes.

store = FenecVectorStore(embeddings, "docs", url=..., token=..., full_text=True)
store.similarity_search("how do I compact", k=4, mode="hybrid")

./run-tests.sh runs LangChain's standard vector store suite and the tests LlamaIndex's own integrations run against a fenec-server it builds and starts. Full reference: https://fenecdb.com/docs/integrations

Metadata

Release files for fenecdb 0.1.7

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

Source distribution (sdist)

Source distribution for fenecdb 0.1.7
File Size Uploaded
fenecdb-0.1.7.tar.gz 20.0 kB Details

Built distribution (wheel)

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

Total release size: 36.9 kB

Release files / fenecdb-0.1.7.tar.gz

Download URL fenecdb-0.1.7.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1d6b0d3de44707d1f3b392a28194249af66cb0e5e9b73cdfa9c71cf9726c7600
BLAKE2b-256 checksum
How to use checksums
37e3cdd94e6972a97a44b79825584b0f5f0b8b4b916f829ffe46615eb8523648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / fenecdb-0.1.7-py3-none-any.whl

Download URL fenecdb-0.1.7-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e89d720adcf5a2b6645f231e5bdea14debaeee78b6f7a5718d637fa45fbeacb
BLAKE2b-256 checksum
How to use checksums
6a7d4c80f4121a8e461cd6ef90db3f446c619beb451c3ac149c75a36f80b6f41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.1.9

2 release files

0.1.8

2 release files

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

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