agentleFS
MigoXLabMigoXLab/dingo/AGENTS.md

dingo

AGENTS.md757 starsChanged 7 months agoApache-2.0View on GitHub

Dingo is a comprehensive AI data quality evaluation tool for ML practitioners, data engineers, and AI researchers. It systematically assesses training data, fine-tuning datasets, and production AI systems using rule-based, LLM-based, and agent-based evaluation methods. Repository: https://github.com/MigoXLab/dingo PyPI: pip install dingo-python License: Apache 2.0

  • Reads credentials
  • Installs packages

We split this AGENTS.md into the rules it gives an agent

14 rules. About 1 is common, 6 are distinctive, and 7 are very specific to this project.

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All evaluators use decorator-based registration:

    line 99
  2. Very specific:

    All evaluators must return EvalDetail with metric, status, label, reason

    line 193
  3. Distinctive:

    Use lazy imports for optional heavy dependencies (torch, transformers, pyarrow, etc.)

    line 194
  4. Common:

    Never hardcode API keys; use environment variables or config parameters

    line 195
  5. Very specific:

    Create class in dingo/model/rule/rule_common.py (or a new file under dingo/model/rule/)

    line 199
  6. Very specific:

    Create class in dingo/model/llm/ (appropriate subdirectory)

    line 207
  7. Very specific:

    Create datasource class in dingo/data/datasource/

    line 215
  8. Very specific:

    Create dataset class in dingo/data/dataset/

    line 216
  9. Distinctive:

    Use lazy imports if new dependencies required

    line 218
  10. Very specific:

    Add dependency to requirements/runtime.txt (core) or setup.py extras (heavy/optional)

    line 219
  11. Distinctive:

    Follow semantic versioning (MAJOR.MINOR.PATCH)

    line 273
  12. Very specific:

    Start via CLI: dingo serve (SSE default) or dingo serve --transport stdio Legacy entry point: mcp_server.py Framework: FastMCP

    line 277
  13. Distinctive:

    When these events occur, update the corresponding files:

    line 304
  14. Distinctive:

    After completing a feature, check if any of the above need updating.

    line 317

≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md 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
AGENTS.md

Dingo — Agent Instructions

Project Overview

Dingo is a comprehensive AI data quality evaluation tool for ML practitioners, data engineers, and AI researchers. It systematically assesses training data, fine-tuning datasets, and production AI systems using rule-based, LLM-based, and agent-based evaluation methods.

Repository: https://github.com/MigoXLab/dingo PyPI: pip install dingo-python License: Apache 2.0

Tech Stack

LayerTechnology
LanguagePython 3.10+
Data ModelsPydantic (BaseModel, extra="allow")
LLM IntegrationOpenAI SDK (supports any compatible API)
MCP ServerFastMCP + SSE transport
DistributedPySpark (optional)

Directory Structure

dingo/
├── AGENTS.md                ← this file (agent instructions)
├── setup.py                 ← package config (extras_require for optional deps)
├── mcp_server.py            ← MCP server entry point (legacy, use `dingo serve` instead)
├── requirements/
│   ├── runtime.txt          ← core dependencies (minimal)
│   ├── datasource.txt       ← optional datasource deps (S3, SQL, Parquet, etc.)
│   ├── optional.txt         ← heavy optional deps (torch, pyspark, etc.)
│   └── agent.txt            ← agent evaluation deps (langchain, tavily)
│
├── SKILL.md                 ← AI agent skill definition (symlink → clawhub/SKILL.md)
├── dingo/                   ← core Python package
│   ├── config/
│   │   └── input_args.py    ← InputArgs, EvalPiplineConfig, EvaluatorGroupConfig
│   ├── io/
│   │   ├── input/data.py    ← Data model (Pydantic, extra="allow")
│   │   └── output/          ← ResultInfo, EvalDetail, SummaryModel, BenchmarkReport
│   │       └── benchmark_report.py ← Multi-system/dataset comparison & aggregation
│   ├── data/
│   │   ├── datasource/      ← LocalDataSource, SQLDataSource, S3DataSource, HFDataSource
│   │   ├── dataset/         ← Dataset implementations per source
│   │   ├── searcher.py      ← Searcher protocol + SearchResult + registry (mock, ES)
│   │   └── converter/       ← Format converters (JSON, JSONL, CSV, Parquet, MinerU, etc.)
│   ├── model/
│   │   ├── model.py         ← Model registry (rule_register, llm_register)
│   │   ├── rule/            ← Rule-based evaluators (80+ built-in)
│   │   │   ├── base.py      ← BaseRule
│   │   │   ├── rule_common.py ← Common rules (text quality, format, PII, etc.)
│   │   │   ├── guobiao/
│   │   │   │   └── rule_tc609_quality.py ← TC609 quality metrics and placeholders
│   │   │   ├── rule_search_ranking.py ← IR ranking metrics (NDCG, MRR, Recall, Precision, MAP, HitRate)
│   │   │   └── utils/       ← Shared utilities (normalize, ngrams, etc.)
│   │   └── llm/             ← LLM-based evaluators
│   │       ├── base_openai.py ← BaseOpenAI (base class for all LLM evaluators)
│   │       ├── text_quality/  ← Text quality evaluators (V4, V5)
│   │       ├── rag/          ← RAG metrics (Faithfulness, Precision, Recall, etc.)
│   │       ├── llm_search_result_relevance.py ← Search result relevance (Exa-style pointwise)
│   │       ├── hhh/          ← 3H evaluators (Honest, Helpful, Harmless)
│   │       ├── compare/      ← Document comparison evaluators
│   │       └── agent/        ← Agent-based evaluators
│   │           ├── base_agent.py  ← BaseAgent
│   │           ├── tools/         ← Tool registry + implementations
│   │           ├── agent_fact_check.py
│   │           └── agent_hallucination.py
│   ├── exec/
│   │   ├── local.py         ← LocalExecutor (single machine, cross-layer conflict detection)
│   │   ├── spark.py         ← SparkExecutor (distributed)
│   │   └── retrieval.py     ← RetrievalExecutor (MTEB retrieval benchmarks)
│   ├── retrieval/            ← Retrieval evaluation module
│   │   ├── search_client.py ← SearchClient ABC + registry + PaperResult/SearchResponse
│   │   ├── backends/
│   │   │   └── agentic.py   ← AgenticSearchClient (local + public mode)
│   │   ├── mteb_adapter.py  ← SearchClientModel (MTEB SearchProtocol adapter)
│   │   └── eval_utils.py    ← normalize_title, resolve_hit, save_json
│   └── run/
│       └── cli.py           ← CLI entry point (subcommands: eval, eval-retrieval, info, serve)
│
├── examples/                ← Usage examples (SDK, CLI, various scenarios)
├── test/                    ← Test suite
│   ├── data/                ← Test data files
│   ├── env/                 ← Test environment configs
│   └── scripts/             ← Test scripts (pytest)
└── docs/                    ← Documentation

Core Concepts

Data Flow

Data Input → Interface (SDK/CLI/MCP) → Datasource → Dataset → Converter → Evaluator → Executor → Report

Registration System

All evaluators use decorator-based registration:

# Rule evaluator
@Model.rule_register('QUALITY_BAD_COMPLETENESS', ['default', 'pretrain'])
class MyRule(BaseRule):
    @classmethod
    def eval(cls, input_data: Data) -> EvalDetail: ...

# LLM evaluator
@Model.llm_register('MyLLMEvaluator')
class MyLLMEvaluator(BaseOpenAI):
    prompt = "..."
    @classmethod
    def build_messages(cls, input_data: Data) -> List: ...

# Agent evaluator
@Model.llm_register('MyAgent')
class MyAgent(BaseAgent):
    available_tools = ["tavily_search"]
    @classmethod
    def eval(cls, input_data: Data) -> EvalDetail: ...

Data Model

Data uses extra = "allow" — any field can be set dynamically:

class Data(BaseModel):
    class Config:
        extra = "allow"

Common fields: data_id, prompt, content, image, context, raw_data, reference, user_input, response, retrieved_contexts.

InputArgs Configuration

input_data = {
    "input_path": "data.jsonl",
    "dataset": {"source": "local", "format": "jsonl"},
    "executor": {"max_workers": 4, "batch_size": 10, "result_save": {"bad": True, "good": True}},
    "evaluator": [
        {
            "fields": {"content": "text_field", "prompt": "question_field"},
            "evals": [
                {"name": "RuleAbnormalChar"},
                {"name": "LLMTextQualityV5", "config": {"key": "...", "model": "gpt-4o", "api_url": "..."}}
            ]
        }
    ]
}

Supported Data Formats

Formatdataset.formatDescription
JSONjsonTop-level array, each element is one sample
JSONLjsonlOne JSON object per line
CSVcsvComma-separated values with header
ParquetparquetApache Parquet columnar format
Plain textplaintextOne line per sample, mapped to content
List JSONlistjsonTop-level {key: [...]} structure
MinerU V1mineruMinerU content_list.json (flat block array)
MinerU V2mineru_v2MinerU content_list_v2.json (pages × blocks)

MinerU formats automatically flatten blocks into Data objects, preserving all original fields (type, bbox, page_idx, etc.) via Pydantic extra="allow". Use dataset.mineru_config.include_types to filter by block type.

Execution Modes

ModeClassUse Case
LocalExecutor.exec_map["local"]Development, < 100K rows
SparkExecutor.exec_map["spark"]Production, > 1M rows
RetrievalExecutor.exec_map["retrieval"]Search API benchmark evaluation (MTEB)

Optional Dependencies (extras_require)

pip install dingo-python                # Core (includes all datasource support)
pip install "dingo-python[hhem]"        # + HHEM hallucination detection (transformers + torch)
pip install "dingo-python[agent]"       # + Agent-based evaluation (langchain)
pip install "dingo-python[retrieval]"   # + Retrieval benchmark evaluation (mteb, tqdm)
pip install "dingo-python[all]"         # + Everything

Development Conventions

General

  • Python 3.10+ required
  • Code comments in English or Chinese (both acceptable)
  • All evaluators must return EvalDetail with metric, status, label, reason
  • Use lazy imports for optional heavy dependencies (torch, transformers, pyarrow, etc.)
  • Never hardcode API keys; use environment variables or config parameters

Adding a New Rule Evaluator

  1. Create class in dingo/model/rule/rule_common.py (or a new file under dingo/model/rule/)
  2. Inherit from BaseRule
  3. Decorate with @Model.rule_register(metric_type, groups)
  4. Implement eval(cls, input_data: Data) -> EvalDetail as classmethod
  5. Set _required_fields to declare needed input fields

Adding a New LLM Evaluator

  1. Create class in dingo/model/llm/ (appropriate subdirectory)
  2. Inherit from BaseOpenAI
  3. Decorate with @Model.llm_register('EvaluatorName')
  4. Set prompt attribute or override build_messages()
  5. Override parse_result() if custom response parsing needed

Adding a New Datasource

  1. Create datasource class in dingo/data/datasource/
  2. Create dataset class in dingo/data/dataset/
  3. Register in the respective __init__.py
  4. Use lazy imports if new dependencies required
  5. Add dependency to requirements/runtime.txt (core) or setup.py extras (heavy/optional)

Testing

# Run all tests
pytest test/scripts --ignore=test/scripts/data

# Run specific test
pytest test/scripts/model/llm/test_rag.py -v

# Integration tests (CLI)
dingo eval --input .github/env/local_plaintext.json
dingo eval --input .github/env/local_json.json --json

CLI Reference

Dingo provides a dingo CLI command (installed via pip install dingo-python):

# Run evaluation (primary command)
dingo eval --input config.json            # Human-readable output
dingo eval --input config.json --json     # JSON output (for agents/automation)

# Run retrieval benchmark evaluation
dingo eval-retrieval --backend agentic --tasks SciFact \
  --api-url https://api.sciverse.space --api-token <token> --limit 100
dingo eval-retrieval --tasks SciFact LitSearch --max-queries 50 --max-workers 4 \
  --api-url http://localhost:8080

# List available evaluators, groups
dingo info                                # Show all (rules, LLM, groups)
dingo info --rules                        # Rule evaluators only
dingo info --llm                          # LLM evaluators only
dingo info --groups                       # Rule groups only
dingo info --json                         # JSON output
dingo info --count                        # Metric counts only (rules / llm / groups / total_metrics)
dingo info --json --count                  # JSON with top-level "counts" plus full lists

# Start MCP server (for AI agent integration)
dingo serve                               # SSE transport on 0.0.0.0:8000
dingo serve --port 9000                   # Custom port
dingo serve --transport stdio             # stdio transport (for local agent)

# Backward compatibility (no subcommand)
dingo --input config.json                 # Same as `dingo eval --input config.json`
python -m dingo.run.cli --input config.json

Version Conventions

  • Version defined in setup.py (version="2.0.0")
  • Follow semantic versioning (MAJOR.MINOR.PATCH)

MCP Server

Start via CLI: dingo serve (SSE default) or dingo serve --transport stdio Legacy entry point: mcp_server.py Framework: FastMCP

Available MCP Tools

ToolPurpose
run_dingo_evaluationRun rule or LLM evaluation on a file
list_dingo_componentsList rule groups, LLM models, prompts
get_rule_detailsGet details about a specific rule
get_llm_detailsGet details about a specific LLM evaluator
get_prompt_detailsGet embedded prompt for an LLM
run_quick_evaluationGoal-based evaluation (auto-infer settings)

MCP Environment Variables

VariablePurpose
OPENAI_API_KEYOpenAI API key for LLM evaluation
OPENAI_BASE_URLCustom API base URL
OPENAI_MODELModel name (default: gpt-4)
DEFAULT_OUTPUT_DIRDefault output directory
LOG_LEVELLogging level (default: info)

Config Maintenance Rules

When these events occur, update the corresponding files:

EventUpdate
New evaluator addedEnsure registration decorator is correct; update docs/metrics.md
New datasource addedUpdate requirements/runtime.txt, setup.py extras if heavy, README install section
New dependency addedDecide: runtime.txt (core) vs setup.py extras (heavy/optional); use lazy import for optional
New MCP tool addedUpdate MCP Tools table in this file
New CLI subcommand addedUpdate CLI Reference section in this file
New search backend addedAdd to dingo/retrieval/backends/, register with @register_backend
Directory structure changeUpdate this file
Version bumpUpdate setup.py version field

After completing a feature, check if any of the above need updating.

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.