agentleFS
NomaDamasNomaDamas/AutoRAG-Research/.agents/skills/create-ingestor-plugin/SKILL.md

create-ingestor-plugin

Skill149 starsChanged 8 months agoApache-2.0View on GitHub

Guide developers through creating a custom data ingestor plugin for AutoRAG-Research. Ingestors load external datasets (HuggingFace, local files, APIs) into the database. Uses @register_ingestor decorator for automatic CLI parameter extraction. Use when ingesting a new dataset format into AutoRAG-Research.

  • Installs packages

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read the generated ingestor.py, pyproject.toml, and test file to understand the structure.

    line 25
  2. Very specific:

    Use ingestor_test_utils for integration tests against a real PostgreSQL database:

    line 100

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Create Ingestor Plugin

Workflow

1. Scaffold

autorag-research plugin create my_dataset --type=ingestor

Read the generated ingestor.py, pyproject.toml, and test file to understand the structure.

The generated pyproject.toml registers the autorag_research.ingestors entry point. The @register_ingestor decorator handles automatic CLI parameter extraction from __init__ type hints.

2. Implement the ingestor

For the code-level implementation rules that are shared with the agent workflows, read:

  • ai_instructions/implementation_specialist.md
  • ai_instructions/schema_architect.md
  • ai_instructions/test_writer.md

Required methods:

  • __init__(embedding_model, ...) — accept embedding model + dataset-specific params
  • detect_primary_key_type() → "bigint" or "string"
  • ingest(subset, query_limit, min_corpus_cnt) — load data and save via self.service

__init__ type hints drive CLI generation automatically:

Type HintCLI Behavior
Literal["a", "b"]--param with choices, required
str--param, required
int = 100--param, optional with default
bool = False--param/--no-param flag

Parameters named embedding_model or late_interaction_embedding_model are auto-skipped (injected by CLI).

self.service is injected after construction via set_service(). Read existing ingestors for exact service method signatures.

3. Database Schema (critical)

Ingestors must populate the correct entity hierarchy:

Document → Page → Chunk (text)
                → ImageChunk (images)
  • Document — top-level container (e.g., a Wikipedia article, a PDF)
  • Page — subdivision within a document (linked via document_id)
  • Chunk — text passage with embedding vector (linked to Page via PageChunkRelation)
  • ImageChunk — image binary with embedding vector (linked to Page via PageChunkRelation)
  • Query — search query with generation_gt: list[str] | None (ground truth answers)

RetrievalRelation — links queries to relevant chunks using AND/OR group structure:

RetrievalRelation(query_id, chunk_id, group_index, group_order, score)

group_index = AND group number
group_order = OR position within the group

Example: query needs (chunk_A OR chunk_B) AND chunk_C
  → (query, chunk_A, group_index=0, group_order=0)
  → (query, chunk_B, group_index=0, group_order=1)
  → (query, chunk_C, group_index=1, group_order=0)

This AND/OR structure is critical for multi-hop queries. See ai_instructions/db_schema.md for the full DBML schema.

4. Install and verify

cd my_dataset_plugin
pip install -e .   # or: uv pip install -e .

No plugin sync needed — ingestors are discovered automatically via entry points.

autorag-research ingest my_dataset --dataset-name subset_a

Testing

Use ingestor_test_utils for integration tests against a real PostgreSQL database:

  • IngestorTestConfig — declare expected counts (queries, chunks, image_chunks), relation checks, primary key type
  • create_test_database(config) — context manager that creates/drops an isolated test DB
  • IngestorTestVerifier — runs all configured checks: count verification, format validation, retrieval relation checks, generation_gt checks, content hash verification

See tests/autorag_research/data/ingestor_test_utils.py for full API and usage examples in the module docstring.

Key Files

PurposePath
Base classesautorag_research/data/base.py → TextEmbeddingDataIngestor, MultiModalEmbeddingDataIngestor
Registration decoratorautorag_research/data/registry.py → @register_ingestor
Text ingestion serviceautorag_research/orm/service/text_ingestion.py
Multi-modal ingestion serviceautorag_research/orm/service/multi_modal_ingestion.py
DB schema referenceai_instructions/db_schema.md
Test utilitiestests/autorag_research/data/ingestor_test_utils.py

Examples

Study these existing implementations for patterns:

  • autorag_research/data/beir.py — BEIR benchmark (simple, good starting point)
  • autorag_research/data/bright.py — BRIGHT dataset
  • autorag_research/data/mrtydi.py — Mr. TyDi multilingual dataset
  • autorag_research/data/ragbench.py — RAGBench dataset

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.