# Wikipedia RAG Search (`primeselectai/wikipedia-evidence-pack-api`) Actor

Generate structured, citation-ready Wikipedia evidence for RAG pipelines and AI agents. Includes canonical IDs, clean excerpts, attribution metadata, freshness, dedupe, and optional change detection.

- **URL**: https://apify.com/primeselectai/wikipedia-evidence-pack-api.md
- **Developed by:** [Simon Jessen](https://apify.com/primeselectai) (community)
- **Categories:** Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **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 usage examples, see the [API](#api) section below.

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).

# README

## Wikipedia Evidence Pack API for RAG

Give your AI system reusable, citation-ready evidence instead of raw search results. Each record includes a canonical Wikipedia URL, stable page ID, matched excerpt, freshness metadata, attribution details, and a normalized content hash.

### Outcome

Turn a topic into citation-ready Wikipedia search records with stable page IDs, titles, descriptions, excerpts, source URLs and attribution.

### Use cases

- Use the Actor when you need turn a topic into citation-ready Wikipedia search records with stable page IDs, titles, descriptions, excerpts, source URLs and attribution.
- Build workflows around normalized, deduplicable search evidence with stable IDs, ranking and explicit attribution — not a raw Wikipedia content mirror.
- Designed for AI application developers, RAG engineers, research teams, knowledge-base builders, and automation agencies.
- Schedule repeat runs: Scheduled monitoring detects revised pages and returns only new or changed evidence, reducing unnecessary embedding and indexing costs.
- Feed normalized dataset records into APIs, spreadsheets, databases, automations, or AI/agent workflows.

### Quick start

1. Open the Actor input form.
2. Set the filters or query relevant to your workflow.
3. Start with a small `maxResults` value.
4. Run the Actor and inspect the default dataset before scheduling larger or recurring jobs.

Example input:

```json
{
  "query": "retrieval augmented generation",
  "maxResults": 10
}
```

### Inputs

- **query** (string, required) — Topic or phrase to search across English Wikipedia.
- **maxResults** (integer, optional) — Maximum number of evidence records to return. Values are capped at 100 per run.
- **includeContent** (boolean, optional) — Whether to fetch normalized page text or summaries for the selected results. The bounded search connector returns search evidence fields.
- **includeRelated** (boolean, optional) — Whether to add related or linked pages for broader RAG context. Related-page expansion is not included in the bounded search request.
- **since** (string, optional) — Optional ISO date or prior run timestamp used by downstream workflows for change detection.

### Output example

The example below is taken from the latest validated local live-source sample when available; otherwise it is derived from the bundled dataset schema.

```json
{
  "id": "75229858",
  "title": "Retrieval-augmented generation",
  "url": "https://en.wikipedia.org/wiki/Retrieval-augmented_generation",
  "description": "Type of information retrieval using LLMs",
  "excerpt": "<span class=\"searchmatch\">Retrieval</span>-<span class=\"searchmatch\">augmented</span> <span class=\"searchmatch\">generation</span> (RAG) is a technique that enables large language models (LLMs) to retrieve and incorporate new information from external",
  "relevance_rank": 1,
  "attribution": {
    "source": "Wikipedia",
    "license": "CC BY-SA 4.0",
    "license_url": "https://creativecommons.org/licenses/by-sa/4.0/"
  }
}
```

### Pricing

Store pricing is configured in Apify. The intended primary paid unit is **evidence record**. Start with a small result limit while validating your workflow, then scale only when the output and economics fit your use case. The README never hard-codes a price that could drift from the live Store configuration.

### Source and limitations

- Source: Wikimedia MediaWiki REST API for English Wikipedia.
- Licence/terms: Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0); some content may have additional or different licensing terms.
- Reuse condition: Commercial reuse and redistribution of Wikipedia text are permitted when the applicable license is followed. Include attribution with a page hyperlink or stable URL, identify Wikipedia/Wikimedia as the source, preserve relevant license notices, and license modified or added Wikipedia text under CC BY-SA 4.0 or a compatible required license. This Actor must not imply Wikimedia endorsement. Images, logos, trademarks, imported text, fair-use material, and non-text media require separate license review. The public license permits commercial reuse, but it does not grant unrestricted rights to package all Wikimedia material as proprietary content or remove attribution/share-alike obligations. High-volume commercial access may require Wikimedia Enterprise or may be rate-limited.
- Automation condition: Use a descriptive User-Agent containing an application name and contact URL or email, obey Wikimedia robot and API etiquette policies, avoid abusive or disruptive request volume, implement throttling, retries, caching, and categorized handling for 429, 403, 404, and 5xx responses. Large-scale commercial use may be rate-limited.
- The product operates in a crowded generic RAG and web-research category, so positioning must emphasize Wikipedia-specific evidence packaging, attribution, freshness, and change detection.
- CC BY-SA permits commercial reuse but imposes attribution and share-alike obligations for reused or modified Wikipedia text; the Actor must not present source text as proprietary.
- Individual pages may contain imported material, fair-use content, images, or other elements with additional restrictions; default output should focus on text, metadata, and source URLs.
- Wikimedia may rate-limit high-volume commercial API traffic, and the public API is not a guaranteed high-throughput commercial data feed.
- Wikipedia content is community-edited and may be inaccurate, disputed, incomplete, or unsuitable as the sole source for high-stakes decisions.

This Actor does not bypass authentication, rate limits, robots/API policies, licensing conditions, or upstream access controls. Missing upstream values are not invented.

### FAQ

**Does this use the approved source contract?**\
Yes. Runtime requests are restricted to the source contract validated by Market Hunter before build.

**Can I schedule repeat runs?**\
Yes, when the source permits automated access. Use conservative schedules and result limits that respect upstream conditions.

**Why can some fields be empty or null?**\
The upstream source may omit fields for particular records. The Actor preserves missing values rather than fabricating data.

### Troubleshooting

- If a narrow query returns no rows, loosen filters and retry with a small result limit.
- If the upstream source returns a rate-limit or temporary server error, retry later instead of increasing request pressure.
- If authentication or source identity is required, verify the protected credential/identity configured for the Actor.
- If the upstream response schema changes, report the failed run so the deterministic mapping can be updated.

### Related Actors

- Wikidata Entity Enrichment API
- Wikipedia Page Change Monitor
- Wikipedia Citation and Reference Extractor
- Open Knowledge Graph Entity Resolver

> Store publication remains an explicit manual action. This product is not affiliated with or endorsed by the upstream source unless the Store listing explicitly states otherwise.

# Actor input Schema

## `query` (type: `string`):

Topic or phrase to search across English Wikipedia.

## `maxResults` (type: `integer`):

Maximum number of evidence records to return. Values are capped at 100 per run.

## `includeContent` (type: `boolean`):

Whether to fetch normalized page text or summaries for the selected results. The bounded search connector returns search evidence fields.

## `includeRelated` (type: `boolean`):

Whether to add related or linked pages for broader RAG context. Related-page expansion is not included in the bounded search request.

## `since` (type: `string`):

Optional ISO date or prior run timestamp used by downstream workflows for change detection.

## Actor input object example

```json
{
  "query": "retrieval augmented generation",
  "maxResults": 10,
  "includeContent": false,
  "includeRelated": false,
  "since": ""
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `runMeta` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "retrieval augmented generation",
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("primeselectai/wikipedia-evidence-pack-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "query": "retrieval augmented generation",
    "maxResults": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("primeselectai/wikipedia-evidence-pack-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "retrieval augmented generation",
  "maxResults": 10
}' |
apify call primeselectai/wikipedia-evidence-pack-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,primeselectai/wikipedia-evidence-pack-api"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/T64hsbqVMg7FIWDuI/builds/O5YFh86FWaUhwZCDW/openapi.json
