Skip to main content

dxmt-haystack

DXMT as a Haystack document store, with an embedding retriever, a BM25 retriever and a hybrid retriever.

pip install dxmt-haystack

A DXMT server has to be running (vectordb serve, or docker run -p 9999:9999 dxmtai/dxmt).

from haystack import Document, Pipeline
from haystack_integrations.document_stores.dxmt import DXMTDocumentStore
from haystack_integrations.components.retrievers.dxmt import (
    DXMTBM25Retriever, DXMTEmbeddingRetriever, DXMTHybridRetriever,
)

store = DXMTDocumentStore(table_name="docs", embedding_dim=768, enable_full_text_search=True)
store.write_documents([
    Document(content="rust borrows memory instead of collecting it", meta={"lang": "rust"}, embedding=[...]),
    Document(content="go collects garbage instead of borrowing",    meta={"lang": "go"},   embedding=[...]),
])

store.filter_documents({"field": "meta.lang", "operator": "==", "value": "rust"})
DXMTEmbeddingRetriever(store, top_k=5).run(query_embedding=[...])
DXMTBM25Retriever(store, top_k=5).run(query="garbage")
DXMTHybridRetriever(store, top_k=5).run(query="garbage", query_embedding=[...])

What the store does

  • One document, one record. id is the record id, embedding the vector, sparse_embedding the sparse vector, and the payload holds content and meta as they are, meta nested, so a filter on meta.page is the server path meta.page.
  • Documents without an embedding are kept, as in every Haystack store. The server wants a vector per record, so such a document is written with a fixed stand-in vector and __has_embedding: false; it comes back with embedding=None and the embedding retriever never ranks it. With server_embedding={"model": ...} the server embeds content instead and the embedding retriever takes query_text.
  • Filters. The full Haystack filter language is supported by filter_documents: a filter the server has a flat form for (==, !=, numeric ranges, in, not in, AND, OR, NOT of one condition) runs on the server; anything else (dates, strings under >, None, nested AND inside OR, NOT over several conditions) is evaluated with Haystack's own document_matches_filter over a scroll of the table, which is correct and slower. The retrievers only take filters with a server form and refuse the rest by name, because a ranked page cannot be filtered afterwards without changing what it means.
  • Duplicate policies NONE and OVERWRITE upsert, SKIP writes only the missing ids, FAIL raises DuplicateDocumentError.
  • blob is not stored (DXMT payloads are JSON); a warning says so.

Tests

tests/test_document_store.py runs Haystack's own DocumentStoreBaseTests (count, write, delete and 39 filter cases, with the in-memory evaluator as the oracle) against a live server:

DXMT_HOST=127.0.0.1 DXMT_PORT=9999 pytest

tests/test_filters.py needs no server and pins which filters get a server form.

Metadata

Release files for dxmt-haystack 1.6.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 dxmt-haystack 1.6.0
File Size Uploaded Provenance Actions
dxmt_haystack-1.6.0.tar.gz 17.9 kB Without provenance Details for dxmt_haystack-1.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dxmt-haystack 1.6.0
File Interpreter ABI Platform Actions
dxmt_haystack-1.6.0-py3-none-any.whl Python 3 none any Details for dxmt_haystack-1.6.0-py3-none-any.whl

Total release size: 34.0 kB

Release files / dxmt_haystack-1.6.0.tar.gz

Download URL dxmt_haystack-1.6.0.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6b441dabbae68da8050404f05c44a0decd8d50a12929077d6e7d5c85a69250c0
BLAKE2b-256 checksum
How to use checksums
acc62001b480b46797d7554ec55d20b9516b8c7df812720d17cd1ac864dae982
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / dxmt_haystack-1.6.0-py3-none-any.whl

Download URL dxmt_haystack-1.6.0-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
402aede5d5395f5de0305becdd877a20c8c81ee47487567fb32570770e1437a9
BLAKE2b-256 checksum
How to use checksums
1af1d281875a59a5fbfd08d2ff8a077aaae9db6088d452dfbfb054fee8ce6e8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for dxmt-haystack 1.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files No provenance

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