# Remove duplicate RAG text without losing source URLs

**Use case:** 

Try five fictional crawler records: get two verbatim candidate documents, preserve four source references and inspect one empty-record diagnostic. Start with START_HERE.md. Five records have $0.00375 in entry-tier event fees; check current Pricing. No source writes, crawling, embeddings or automatic near-duplicate removal.

## Input

```json
{
  "records": [
    {
      "url": "https://example.com/help/delivery",
      "markdown": "# Delivery policy\nStandard delivery takes three to five working days after dispatch. Tracking information is sent by email when the parcel leaves the warehouse. Delivery estimates exclude public holidays. Customers can contact support with their order number if tracking has not updated for two working days.\n"
    },
    {
      "url": "https://example.com/help/delivery?utm_source=newsletter",
      "markdown": "# Delivery policy\nStandard delivery takes three to five working days after dispatch. Tracking information is sent by email when the parcel leaves the warehouse. Delivery estimates exclude public holidays. Customers can contact support with their order number if tracking has not updated for two working days.\n"
    },
    {
      "url": "https://example.com/help/returns",
      "markdown": "# Returns policy\nUnused products can be returned within fourteen days of delivery. Keep the original packaging and contact support for return instructions before sending the parcel. Refunds are processed after the returned item has been inspected. This sample policy is fictional demonstration content.\n"
    },
    {
      "url": "https://example.com/archive/delivery",
      "markdown": "# Delivery policy\nStandard delivery takes three to five working days after dispatch. Tracking information is sent by email when the parcel leaves the warehouse. Delivery estimates exclude public holidays. Customers can contact support with their order number if tracking has not updated for two working days.\n"
    },
    {
      "url": "https://example.com/help/empty",
      "markdown": "   "
    }
  ],
  "maxDocuments": 5
}
```

## Output

```json
{
  "document_index": {
    "label": "Source row",
    "format": "number"
  },
  "action": {
    "label": "Decision",
    "format": "text"
  },
  "canonical_index": {
    "label": "Retained row",
    "format": "number"
  },
  "source_url": {
    "label": "Source URL",
    "format": "link"
  },
  "text_field": {
    "label": "Original field",
    "format": "text"
  },
  "original_hash": {
    "label": "Original SHA256",
    "format": "text"
  },
  "flags": {
    "label": "Reasons",
    "format": "array"
  },
  "near_duplicates": {
    "label": "Near-duplicate review",
    "format": "array"
  },
  "boilerplate_spans": {
    "label": "Repeated-line review",
    "format": "array"
  },
  "text_metrics": {
    "label": "Text metrics",
    "format": "object"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The RAG Dataset Cleaner - Text Deduplication and Source URLs Actor is ready to run with the inputs already set for "Remove duplicate RAG text without losing source URLs". [Sign up or log in](https://console.apify.com/create-task-from-example/f6Ud2HM9cg8Mhz8dd) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Remove duplicate RAG text without losing source URLs" task

The RAG Dataset Cleaner - Text Deduplication and Source URLs Actor will start running based on the input automatically. You can also change all the input fields, like inline document records and maximum documents, to match your specific use case.

### 3. Receive the "Remove duplicate RAG text without losing source URLs" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as source row, decision, retained row, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Remove duplicate RAG text without losing source URLs" task via API](https://apify.com/variable_mitts/rag-dataset-cleaner-evidence.md).

## About this Actor

This example demonstrates how to use [RAG Dataset Cleaner - Text Deduplication and Source URLs](https://apify.com/variable_mitts/rag-dataset-cleaner-evidence.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/variable_mitts/rag-dataset-cleaner-evidence.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

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

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
