Skip to main content

haystack-pixeltable

PyPI CI License

Haystack Document Store and Retriever backed by Pixeltable — persistent, versioned, multimodal data infrastructure for AI applications.

Requires Pixeltable >= 0.6.8 and Haystack 2.x.

Installation

pip install haystack-pixeltable

Quick Start

Document Store

from haystack import Document
from haystack_pixeltable import PixeltableDocumentStore

store = PixeltableDocumentStore(
    table_name="myproject.docs",
    embedding_dimension=1536,
)

# Write documents
store.write_documents(
    [
        Document(content="Pixeltable is multimodal data infrastructure.", embedding=[...]),
        Document(content="Haystack is a framework for building RAG pipelines.", embedding=[...]),
    ]
)

# Filter documents
results = store.filter_documents(filters={"field": "meta.category", "operator": "==", "value": "docs"})

# Count
print(store.count_documents())

Retriever (Similarity Search)

from haystack_pixeltable import PixeltableDocumentStore, PixeltableRetriever

store = PixeltableDocumentStore(
    table_name="myproject.docs",
    embedding_dimension=1536,
)
retriever = PixeltableRetriever(document_store=store, top_k=5)

# Search by embedding vector
result = retriever.run(query_embedding=[0.1, 0.2, ...])
for doc in result["documents"]:
    print(f"{doc.content} (score: {doc.score:.3f})")

In a Haystack Pipeline

from haystack import Pipeline
from haystack.components.embedders import SentenceTransformersTextEmbedder, SentenceTransformersDocumentEmbedder
from haystack.components.writers import DocumentWriter
from haystack_pixeltable import PixeltableDocumentStore, PixeltableRetriever

store = PixeltableDocumentStore(
    table_name="rag.knowledge",
    embedding_dimension=384,
)

# Indexing pipeline
indexing = Pipeline()
indexing.add_component("embedder", SentenceTransformersDocumentEmbedder())
indexing.add_component("writer", DocumentWriter(document_store=store))
indexing.connect("embedder", "writer")

# Query pipeline
query = Pipeline()
query.add_component("embedder", SentenceTransformersTextEmbedder())
query.add_component("retriever", PixeltableRetriever(document_store=store, top_k=5))
query.connect("embedder.embedding", "retriever.query_embedding")

Filtering

The Document Store supports the Haystack filter specification:

# Simple equality
store.filter_documents(filters={"field": "meta.category", "operator": "==", "value": "science"})

# Comparison operators: ==, !=, >, >=, <, <=
store.filter_documents(filters={"field": "meta.score", "operator": ">", "value": 0.8})

# Compound AND
store.filter_documents(
    filters={
        "operator": "AND",
        "conditions": [
            {"field": "meta.category", "operator": "==", "value": "science"},
            {"field": "meta.score", "operator": ">", "value": 0.5},
        ],
    }
)

# Compound OR
store.filter_documents(
    filters={
        "operator": "OR",
        "conditions": [
            {"field": "meta.source", "operator": "==", "value": "arxiv"},
            {"field": "meta.source", "operator": "==", "value": "pubmed"},
        ],
    }
)

Pixeltable Escape Hatch: .table

The .table property gives direct access to the underlying Pixeltable table for operations beyond the Haystack interface:

store = PixeltableDocumentStore(table_name="myproject.docs", embedding_dimension=1536)
t = store.table

# Add a computed column that summarizes each document on insert
import pixeltable.functions.openai as openai

t.add_computed_column(
    summary=openai.chat_completions(
        messages=[{"role": "user", "content": t.content}],
        model="gpt-4o-mini",
    )
    .choices[0]
    .message.content,
    if_exists="ignore",
)

# Use arbitrary Pixeltable queries
results = t.where(t.meta["category"] == "science").select(t.content, t.summary).collect()

# Version history
print(t.history(n=5))

Features

  • Persistent storage via Pixeltable's embedded PostgreSQL
  • Embedding index with cosine / IP / L2 metrics
  • Haystack metadata filtering (AND / OR / comparisons)
  • .table escape hatch for computed columns, version history, and multimodal types

Development

pip install -e ".[dev]"
pytest tests/ -v
ruff check . && ruff format --check .

License

Apache 2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

haystack_pixeltable-0.1.1.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

haystack_pixeltable-0.1.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file haystack_pixeltable-0.1.1.tar.gz.

File metadata

  • Download URL: haystack_pixeltable-0.1.1.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for haystack_pixeltable-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8abb9b346428707c500f018fe42acff49e24eb1fe3a462fbe725a34089dfe82e
MD5 73e394de7744950f4a93e2b0c3cbb3af
BLAKE2b-256 d8be8c92ed720c2755515422eb596c2f34fecbebac3a00f2d8bf29f7284c79c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for haystack_pixeltable-0.1.1.tar.gz:

Publisher: release.yml on pixeltable/haystack-pixeltable

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file haystack_pixeltable-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for haystack_pixeltable-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c22aca760b49448cf398b30eb77b465022a19360f86e60d1b223b32be3be859c
MD5 c3c19e7d63becd26a30ed029245d2847
BLAKE2b-256 f30a90dee17a5695b7bd5dbb158109616ad754d0994437c33fe36c1717053450

See more details on using hashes here.

Provenance

The following attestation bundles were made for haystack_pixeltable-0.1.1-py3-none-any.whl:

Publisher: release.yml on pixeltable/haystack-pixeltable

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 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