# Audit RAG Chunks Before Vector Database Ingestion

**Use case:** 

Find empty, stale, undersized, and duplicate RAG chunks before indexing them in Pinecone, Weaviate, Qdrant, or another vector database.

## Input

```json
{
  "documents": [
    {
      "id": "guide-1",
      "title": "Refund policy",
      "url": "https://example.com/refunds",
      "text": "Customers may request a refund within 30 days of purchase. Requests must include the order number and the email address used at checkout. Approved refunds return to the original payment method within five to ten business days. Digital products that have been substantially consumed may not qualify. Contact support before filing a payment dispute so the team can investigate and document the request.",
      "updatedAt": "2026-08-01T00:00:00.000Z"
    },
    {
      "id": "guide-1-copy",
      "title": "Refund policy copy",
      "url": "https://example.com/refunds-copy",
      "text": "Customers may request a refund within 30 days of purchase. Requests must include the order number and the email address used at checkout. Approved refunds return to the original payment method within five to ten business days. Digital products that have been substantially consumed may not qualify. Contact support before filing a payment dispute so the team can investigate and document the request.",
      "updatedAt": "2026-08-01T00:00:00.000Z"
    },
    {
      "id": "empty",
      "title": "Placeholder",
      "text": ""
    },
    {
      "id": "stale",
      "title": "Old cancellation note",
      "text": "Legacy cancellation instructions that no longer contain enough context for reliable retrieval.",
      "updatedAt": "2019-01-01T00:00:00.000Z"
    }
  ],
  "maxDocuments": 100,
  "minWords": 50,
  "maxWords": 2000,
  "staleAfterDays": 365,
  "nearDuplicateThreshold": 0.92,
  "contentFields": [
    "text",
    "markdown",
    "content",
    "body"
  ],
  "titleFields": [
    "title",
    "name",
    "heading"
  ],
  "urlFields": [
    "url",
    "sourceUrl",
    "canonicalUrl"
  ],
  "updatedAtFields": [
    "updatedAt",
    "lastModified",
    "modifiedAt",
    "publishedAt"
  ],
  "includeContentPreview": false,
  "contentPreviewCharacters": 280
}
```

## Output

```json
{
  "qualityScore": {
    "label": "Quality score",
    "format": "integer"
  },
  "grade": {
    "label": "Grade",
    "format": "string"
  },
  "documentId": {
    "label": "Document ID",
    "format": "string"
  },
  "title": {
    "label": "Title",
    "format": "string"
  },
  "url": {
    "label": "Source URL",
    "format": "string"
  },
  "wordCount": {
    "label": "Words",
    "format": "integer"
  },
  "issueCount": {
    "label": "Issues",
    "format": "integer"
  },
  "criticalCount": {
    "label": "Critical",
    "format": "integer"
  },
  "highCount": {
    "label": "High",
    "format": "integer"
  },
  "exactDuplicateOf": {
    "label": "Exact duplicate of",
    "format": "string"
  },
  "nearDuplicateOf": {
    "label": "Near duplicate of",
    "format": "string"
  },
  "similarity": {
    "label": "Similarity",
    "format": "number"
  },
  "issueCodes": {
    "label": "Issue codes",
    "format": "array"
  }
}
```

## About this Actor

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


## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
This Task's input is already configured above — use it as-is rather than inventing a new one.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/gifted_wagon/rag-dataset-quality-auditor.md

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).
