Skip to main content

Production RAG pipeline with vector retrieval, configurable chunking, and evaluation harness

Project description

bifrost-rag

PyPI Python 3.10+

Production RAG pipeline with vector retrieval, configurable chunking, and evaluation harness.

Features

  • Chunking strategies — Fixed-size, sentence-based, and recursive splitting
  • Vector stores — ChromaDB (local) with pluggable store interface
  • Retrieval — Top-K retrieval with score thresholds
  • Evaluation harness — Precision@K, Recall@K, F1, MRR metrics
  • Pipeline orchestrator — Ingest, retrieve, and query in one interface

Architecture

┌─────────────┐    ┌──────────────┐    ┌──────────────┐
│   Chunking   │───▶│  Embeddings  │───▶│ Vector Store │
│  strategies  │    │   (Voyage)   │    │  (ChromaDB)  │
└─────────────┘    └──────────────┘    └──────┬───────┘
                                              │
                   ┌──────────────┐    ┌──────▼───────┐
                   │  Evaluation  │◀───│  Retrieval   │
                   │   harness    │    │   pipeline   │
                   └──────────────┘    └──────────────┘

Installation

pip install bifrost-rag

Quick Start

from bifrost_rag import ChromaStore, Document, RAGPipeline, FixedSizeChunker

# Create a vector store
store = ChromaStore(collection_name="my-docs")

# Chunk and ingest documents
chunker = FixedSizeChunker(chunk_size=500, overlap=50)
text = "Your long document text here..."
chunks = chunker.chunk(text, metadata={"source": "doc1"})

# Add documents with embeddings (from your embedding provider)
docs = [
    Document(id=f"chunk-{c.index}", text=c.text, embedding=your_embeddings[i])
    for i, c in enumerate(chunks)
]
pipeline = RAGPipeline(store=store, top_k=5)
pipeline.ingest(docs)

# Query
result = pipeline.query(query_embedding=query_embed)
print(result.sources)

Chunking Strategies

Strategy Description
FixedSizeChunker Split by character count with overlap
SentenceChunker Split by sentence boundaries
RecursiveChunker Hierarchical split: paragraphs → sentences → characters

Evaluation

from bifrost_rag import RAGEvaluator, Document

evaluator = RAGEvaluator()

# Evaluate retrieval quality
dataset = [
    {
        "retrieved": [Document(id="d1", text="..."), Document(id="d2", text="...")],
        "relevant_ids": {"d1"},
    },
]
result = evaluator.evaluate(dataset, k=5)
print(result.summary())

License

MIT

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

bifrost_rag-0.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

bifrost_rag-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file bifrost_rag-0.1.0.tar.gz.

File metadata

  • Download URL: bifrost_rag-0.1.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for bifrost_rag-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c7ae8af76fe8513d7d7d7f40a1523c63a88bef7db91bc9ca062d112dd3b4ded
MD5 474b272971c3fb7b590afd883a04fdc7
BLAKE2b-256 87fd30167fcc4f73532d07b5abb68c6d70a0976219d7cf02a63ac14197552947

See more details on using hashes here.

File details

Details for the file bifrost_rag-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bifrost_rag-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for bifrost_rag-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b240bc4851b820f256854a30a9229bf96c8c7d4479ccc84d11a3293a2c87c57f
MD5 29eed7ea601341817d63cc49327a5773
BLAKE2b-256 63f542ccd49167154cadd87ccf5f151cc8a383c79409bae8dcbab63832e41160

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