# Validate a RAG dataset before re-indexing

**Use case:** 

Catch broken chunk sequences, missing provenance, duplicates, and overlap before a scheduled RAG re-index replaces your production vectors.

## Input

```json
{
  "records": [
    {
      "chunkId": "release-0",
      "documentId": "release-notes",
      "sourceUrl": "https://example.com/releases",
      "chunkIndex": 0,
      "title": "Release notes",
      "headingPath": [
        "Version 2"
      ],
      "chunkText": "Create a repeatable quality gate before each scheduled re-index. Stable chunk identifiers and ordered indexes make regressions visible across ingestion runs."
    },
    {
      "chunkId": "release-2",
      "documentId": "release-notes",
      "sourceUrl": "https://example.com/releases",
      "chunkIndex": 2,
      "title": "Release notes",
      "headingPath": [
        "Version 2"
      ],
      "chunkText": "Review all structural findings before replacing the production index, and keep the previous index available until representative retrieval checks pass."
    },
    {
      "chunkId": "orphan-0",
      "chunkIndex": 0,
      "title": "Migration note",
      "headingPath": [
        "Migration"
      ],
      "chunkText": "This intentionally lacks document and source provenance so the scheduled validation report demonstrates a blocking structural finding."
    }
  ],
  "maxItems": 1000,
  "fieldMapping": {},
  "minTokens": 10,
  "maxTokens": 2000,
  "nearDuplicateSimilarity": 0.95,
  "maxAdjacentOverlapRatio": 0.35,
  "enableHeuristicWarnings": true,
  "maxFindings": 5000,
  "includeMarkdownReport": true,
  "failRunOnError": false
}
```

## Output

```json
{
  "gateStatus": {
    "label": "Gate",
    "format": "string"
  },
  "automationAction": {
    "label": "Action",
    "format": "string"
  },
  "sourceType": {
    "label": "Source type",
    "format": "string"
  },
  "sourceId": {
    "label": "Source ID",
    "format": "string"
  },
  "itemsAudited": {
    "label": "Audited",
    "format": "integer"
  },
  "findingCount": {
    "label": "Findings",
    "format": "integer"
  },
  "errorCount": {
    "label": "Errors",
    "format": "integer"
  },
  "warningCount": {
    "label": "Warnings",
    "format": "integer"
  },
  "exactDuplicateRate": {
    "label": "Exact duplicate rate",
    "format": "number"
  },
  "nearDuplicateRate": {
    "label": "Near duplicate rate",
    "format": "number"
  },
  "estimatedEmbeddingWasteTokens": {
    "label": "Estimated wasted tokens",
    "format": "integer"
  },
  "truncated": {
    "label": "Truncated",
    "format": "boolean"
  },
  "finishedAt": {
    "label": "Finished",
    "format": "string"
  }
}
```

## About this Actor

This example demonstrates how to use [RAG Dataset Linter](https://apify.com/sebastian-actors/rag-dataset-linter) with a specific input configuration. Visit the [Actor detail page](https://apify.com/sebastian-actors/rag-dataset-linter) to learn more, explore other use cases, and run it yourself.