Python · Open Source · MIT · v1.0.1

ai-ready-data

Turn messy document folders into governed, hybrid-searchable datasets for AI agents.

Overview

What it is

Pure vector search misses exact terms. Keyword search misses semantic matches. ai-ready-data combines OpenAI-powered metadata enrichment with BM25 + dense hybrid retrieval — so agents can find the right document whether the query is precise or paraphrased.

For teams building agents over professional document folders: legal, property, due diligence, compliance, public-sector research, and operations.

Evidence

Benchmarked on two corpora.

Measured on a clean technical documentation corpus and a mixed real-world document corpus. Hybrid mode is the default.

Corpus 1 — Pine Script v6 docs

Clean markdown, single domain

11-query oracle · 303 chunks · text-embedding-3-small 512 dims

ModeHit@1Hit@3MRR
vector10/118/110.745
hybrid11/1111/111.000

Three persistent failures in vector-only mode — “repainting”, “lookahead bias”, “plot shapes” — are resolved by hybrid. BM25 over the enriched searchable_text directly matches the exact terms.

Corpus 2 — Mixed documents

PDF / form / invoice / table / DOCX / CSV / HTML / scanned

10-question oracle · 9 files · 8/9 extracted · 1 expected EmptyText

ModeHit@1MRRn
vector0.8330.8676
hybrid0.9000.92510

n=6 shared questions for the hybrid/vector comparison. The scanned image-only PDF produced the expected EmptyText failure — confirming the vision extraction gap.

Pipeline

How it works.

  1. 1

    Extract

    PDF (text-layer), DOCX, HTML, CSV, JSON, Markdown, plain text, and code files. Scanned PDFs with no text layer fail cleanly with an EmptyText signal.

  2. 2

    Filter

    OpenAI decides whether each document is relevant to the dataset goal before enrichment runs.

  3. 3

    Enrich

    OpenAI structured output extracts topics, document type, sensitivity, jurisdiction, effective date, routing summary, key questions, and a use_when routing hint.

  4. 4

    Index

    searchable_text — title + metadata + summary + key questions + chunk text — is indexed by BM25 and by a dense embedding model (text-embedding-3-small, 512 dims).

  5. 5

    Search

    Hybrid RRF: BM25 and dense search run independently. Their candidate lists are fused with Reciprocal Rank Fusion. Hybrid is the default mode.

Design

Key concepts.

Four ideas that distinguish this from a plain embedding pipeline.

searchable_text

Enrichment metadata is concatenated into every chunk before BM25 indexing. BM25 over that enriched representation directly matches exact terms in the summary and key questions — not just the raw chunk text.

TagDefinitions

Dataset-level schema governance. Define which fields are extracted, their value types (string, number, boolean, multi-value), allowed values, and projection policy: include → searchable_text + index, metadata_only → index payload only, exclude → stored but not indexed.

DataSlices

Named pre-set filter views over a dataset. Constrain an agent's search to a governed subset without re-ingesting — create a slice with a filter expression, then search within it.

Hybrid RRF

Independent BM25 and dense search candidates are fused with Reciprocal Rank Fusion. No alpha weights to tune. Vector, keyword, and hybrid modes are all available.

Surfaces

CLI · REST API · MCP.

Every surface uses the same Retriever code path. The domain MCP template ships a pre-built wrapper for production agent integrations.

CLI

  • ai-ready ingest <folder> --dataset <name> --goal <text>
  • ai-ready search <dataset> <query> --mode hybrid
  • ai-ready eval-pinescript <dataset> --mode hybrid
  • ai-ready metadata list --dataset <name>
  • ai-ready export-jsonl <dataset> <path>

REST API

  • POST /datasets/{name}/search
  • POST /datasets/{name}/ingest
  • GET /datasets/{name}/documents
  • GET /datasets/{name}/schema
  • GET /health

MCP

  • search_dataset
  • get_document_summary
  • read_page
  • list_data_slices / search_in_slice
  • get_dataset_schema
  • ingest_drive_folder

Limitations

What it does not do.

Documented honestly. These are the known gaps as of v1.0.1.

  • No vision extraction yet

    Scanned PDFs with no text layer produce an EmptyText failure and are excluded. A vision fallback (gpt-4o-mini, opt-in) is planned but not yet built.

  • No auth or multi-tenant enforcement

    Tenants are stored separately but no request-level auth gates access. Not suitable for hosted multi-user deployments without adding an auth layer.

  • Synchronous ingestion

    The pipeline is CLI-first and blocks the caller. Large corpora (thousands of files) will be slow.

  • No UI

    Dataset management, metadata governance, and search are CLI, REST API, and MCP only.

Open source, MIT licensed.

Built and maintained by BOUCH. If you are building agents over professional document corpora and want help adapting the pipeline — book a call.

What ships with it

  • Ingest pipeline: PDF, DOCX, HTML, CSV, JSON, Markdown
  • Hybrid BM25 + dense retrieval with RRF fusion
  • TagDefinition schema governance + DataSlices
  • MCP server: search, entity graph, page-level reads, schema and tag governance
  • Domain MCP template for production agent integrations
  • Two reproducible benchmark harnesses