npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@reaatech/hybrid-rag

v0.1.0

Published

Core domain types, schemas, and shared utilities for hybrid RAG systems

Readme

@reaatech/hybrid-rag

npm version License: MIT CI

Status: Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.

Core domain types, Zod schemas, and shared type utilities for the hybrid RAG ecosystem. This package is the single source of truth for all document, chunking, retrieval, evaluation, ablation, and benchmarking types used throughout the @reaatech/hybrid-rag-* family.

Installation

npm install @reaatech/hybrid-rag
# or
pnpm add @reaatech/hybrid-rag

Feature Overview

  • Domain typesDocument, Chunk, RetrievalResult, HybridResult, RerankedResult, and more
  • Enum typesChunkingStrategy with four strategies (fixed-size, semantic, recursive, sliding-window)
  • Zod schemas — runtime validation for documents, chunks, chunking configs, evaluation samples, ablation configs, vector queries, and BM25 queries
  • Evaluation typesEvaluationSample, EvaluationResult, summary metrics with standard deviations
  • Ablation typesAblationConfig, AblationResult with delta comparisons
  • Benchmarking typesBenchmarkResult with latency percentiles, component breakdowns, cost tracking, throughput, and environment info
  • Zero runtime dependencies beyond zod — lightweight and tree-shakeable
  • Dual ESM/CJS output — works with import and require

Quick Start

import {
  ChunkingStrategy,
  type Document,
  type Chunk,
  type ChunkingConfig,
  type RetrievalResult,
  type EvaluationSample,
} from '@reaatech/hybrid-rag';

const doc: Document = {
  id: 'doc-001',
  content: 'Your document text here...',
  source: '/data/knowledge-base.md',
  metadata: { department: 'engineering' },
};

const config: ChunkingConfig = {
  strategy: ChunkingStrategy.SEMANTIC,
  chunkSize: 512,
  overlap: 50,
};

Schema Validation

Every type has a matching Zod schema for runtime validation:

import { DocumentSchema, ChunkingConfigSchema, validateDocument } from '@reaatech/hybrid-rag';

// Validate at the boundary — throws ZodError on invalid data
const validDoc = DocumentSchema.parse(rawJson);

// Or use the convenience validators
const validatedDoc = validateDocument(rawJson);

Exports

Document Types

| Export | Description | |--------|-------------| | Document | Source document with id, content, source, metadata, optional title/author/date | | DocumentSchema / DocumentInput | Zod schema and inferred type for document validation |

Chunking Types

| Export | Description | |--------|-------------| | ChunkingStrategy | Enum: fixed-size, semantic, recursive, sliding-window | | ChunkingConfig | Strategy configuration: chunkSize, overlap, thresholds, separators | | ChunkingConfigSchema | Zod schema with defaults (512 chunk size, 50 overlap) | | Chunk | Text chunk: id, documentId, content, embedding, tokenCount, position, metadata |

Retrieval Types

| Export | Description | |--------|-------------| | VectorQuery | Vector search input: vector, topK, distance metric, filter | | BM25Query | BM25 search input: query text, topK, k1/b parameters, filter | | RetrievalResult | Single result: chunkId, documentId, content, score, source | | HybridResult | Post-fusion results with vectorScore, bm25Score, vectorRank, bm25Rank | | RerankedResult | Post-reranker results with rerankerScore, fusedScore, finalScore |

Evaluation Types

| Export | Description | |--------|-------------| | EvaluationSample | Ground truth: query_id, query, relevant_docs, relevant_chunks, ideal_answer | | EvaluationResult | Per-query metrics + aggregate summary with standard deviations | | EvaluationSampleSchema | Zod schema with required relevant_docs and relevant_chunks arrays |

Ablation Types

| Export | Description | |--------|-------------| | AblationConfig | Baseline + variants with changes to chunking, retrieval, reranker, weights | | AblationResult | Baseline metrics + per-variant results with delta comparisons | | AblationConfigSchema | Zod schema with nullable reranker field |

Benchmarking Types

| Export | Description | |--------|-------------| | BenchmarkResult | Latency percentiles (p50/p90/p95/p99), component breakdown, cost, throughput |

Related Packages

License

MIT