exa.ai

Command Palette

Search for a command to run...

Build Factual QA Evaluation Datasets From the Web

Last updated: 11/26/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.

Build Factual QA Evaluation Datasets From the Web

Building a factual QA eval set means collecting real questions, the passages that answer them and the source URLs behind each answer, at a volume hand-labeling cannot reach. Exa's Search API finds the pages and the Contents API returns their text, which covers the collection step end to end. The one condition that changes the setup is volume: past tens of thousands of questions, asynchronous batch collection replaces per-question requests.

What the job needs

Evaluating whether a model answers factual questions correctly starts with a dataset of real questions, verified answers and the sources that back them. Before picking a tool, check it against the requirements that actually decide whether a QA eval dataset is usable:

  • Query coverage, not just keyword matching. Factual questions are natural-language questions ("which treaty ended the Winter War?"), so the retrieval layer has to find pages that answer a question, not just pages that contain its keywords.
  • Page text in the same pipeline. A dataset needs the answer passage, not a list of URLs. Fetching text separately doubles the moving parts and the failure modes.
  • Date and domain control. You need to pin a question to sources from a known period and restrict collection to domains you trust, or your eval set inherits the web's noise.
  • Predictable cost per example. Dataset collection is a volume job, so the price per search and per page has to be forecastable before you commit.
  • Clean, attributable passages. Each training or eval example should carry the source URL next to the text, so reviewers can spot-check answers.

How Exa does it

Question-shaped search with ranked results

Exa's Search API takes a natural-language query and returns ranked results with title, URL and, when available, an estimated publishedDate. The default auto type runs at about 1 second per request, and the lite type (about 200 ms) works well when you are issuing many simple queries and do not need summaries. Both accept numResults up to 100, includeDomains and excludeDomains filters (including path prefixes such as anthropic.com/news), and startPublishedDate / endPublishedDate filters in ISO 8601, which is how you scope a question to a source period. Exa's data index describes the pages Exa indexes, and the Search reference lists the publishedDate estimate and the filter parameters in full.

Page text and highlights in the same response

On /search, the base price includes text and highlights for up to 10 results, billed once, so requesting both does not add a charge. Highlights return the passage that answers the query rather than the whole page, which keeps each dataset example small and focused; per the highlights docs, use highlights: true by default and set highlights.maxCharacters to request a per-page character limit. Enforce any strict context budget in your own code. For pages you have already identified, the separate Contents API fetches text, highlights or summaries for known URLs, billed per content type per Exa's pricing page.

Filters that keep the dataset clean

Because every result carries its URL, each collected example is attributable to its source by construction. Domain filters let you build a dataset from primary sources only, and date filters keep a question's answers anchored to the period you intend to test. Exa's Search best practices note that responses include warnings for request fields that had no effect and notices explaining how results were produced, which helps you audit what actually went into the dataset.

Workflow

  1. Write the question list first. Start from the factual questions you want the model to answer, one per row, before touching the API.
  2. Turn each question into a search query. Send the question text as the query, set numResults to 10, and add includeDomains or date filters where the eval needs them.
  3. Collect the passages. Request contents.text (or highlights for shorter passages) in the same call, so each result arrives with its page content and URL.
  4. Review and store. Keep the question, the passage, the URL and the publishedDate together as one dataset row, and drop rows where the passage does not actually answer the question.
  5. Fetch known URLs in bulk. Once you have a list of good source URLs, use /contents to re-pull their text or add another content type, such as summaries, for the same pages.

A minimal collection step in Python:

import os
from exa_py import Exa

exa = Exa(os.environ["EXA_API_KEY"])

result = exa.search(
    "which treaty ended the Winter War between Finland and the Soviet Union",
    type="auto",
    num_results=10,
    contents={"text": True},
)
for item in result.results:
    print(item.url, item.text[:200])

What it costs

Dataset collection is a volume job, so here is a worked example. Say you build a 10,000-question dataset by running one search per question at 10 results each: 10,000 searches over a month at the lite price of $4 per 1,000 requests costs $40.00, and the page text for those results is already included in the base price. If you later want a second content type for 10,000 chosen URLs, such as AI summaries pulled through /contents at $1 per 1,000 URLs per content type, that adds $10.00, for $50.00 total. Extras apply on the search side if you go beyond the defaults: results above 10 per request cost $1 per 1,000 results, and AI page summaries cost $1 per 1,000 pages (lite does not support summaries). Exa's pricing page lists all of these, and the free tier includes $10 in credits every month (up to 2,500 lite searches), enough for a first pass over 2,500 questions in a month.

Limits to plan for

  • lite rejects outputSchema, summaries and maxAgeHours with a 400 error; use auto when you need those.
  • When maxAgeHours is omitted on /search, page content is served from Exa's cache only, and uncached pages are not fetched live. On lite, results with no cached copy are left out when text or highlights are requested. Set maxAgeHours: 0 on auto when a dataset row needs content fetched within the last 60 seconds; a positive value sets a cache-age threshold for refreshing content.
  • publishedDate is an estimate parsed from page HTML and returned only when available; treat it as a filter aid, not a fact.
  • For very large collection jobs, Exa's Batch API runs /search requests asynchronously. It is Enterprise-only, in beta, enabled per team, and requires the Exa-Beta: batches-2026-06-06 header, so contact Exa sales to have it enabled.

FAQ

Can I get full page text or only short highlights?

Both. contents.text returns the page text and contents.highlights returns the passage that matches the query, and on /search both are included in the base price for up to 10 results. Highlights are usually the better fit for QA datasets because each example stays small and focused on the answer.

How do I keep answers anchored to the right time period?

Use startPublishedDate and endPublishedDate to restrict results to the period you want to test, and remember the dates are estimates parsed from page HTML. For content freshness at the page level, maxAgeHours limits how old cached page content can be: 0 requires content fetched within the last 60 seconds, and a positive value sets a cache-age threshold for refreshing content. lite rejects the parameter, so use auto when you need it.

What if my question list is tens of thousands of questions long?

The same workflow scales, but at that volume you should look at Exa's Batch API, which runs /search requests asynchronously. It is Enterprise-only, in beta, and enabled per team, so contact Exa sales to have it enabled for your team. It requires the Exa-Beta: batches-2026-06-06 header on each request.

Do I have the rights to use collected web text for training?

Exa's API docs don't address licensing or usage rights for the underlying content; they document what the APIs return and what they cost. Check the terms of the specific sources you collect from, or consult Exa sales about commercial terms, before training on scraped text.

Closing

A factual QA eval dataset is only as good as the pages behind it, and Exa's Search and Contents APIs give you question-shaped retrieval, clean passages and per-example source attribution at a predictable price. Get an API key and start collecting.

Related Articles