Tool

Evaluate Web Search Quality with Custom Datasets

Evaluate model web-search answer quality against a custom dataset using an LLM-based pass/fail grader.

Works with openai

Maintainer of this project? Claim this page to edit the listing.


93
Spark score
out of 100
Updated 18 days ago
Version 1.0.0
Models
gpt 4ogpt 4

Add to Favorites

Why it matters

Assess the accuracy and relevance of AI-generated web search results against a custom ground truth dataset. This asset helps you benchmark LLM information retrieval capabilities.

Outcomes

What it gets done

01

Define custom question-answer pairs for web search evaluation.

02

Configure an LLM-based grader to assess search result quality.

03

Run evaluations using the OpenAI Evals framework.

04

Analyze model outputs and pass/fail rates.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/oai-web-search-evaluation | bash

Overview

Evaluating Web Search Quality with a Custom Dataset

An OpenAI Evals notebook for testing web-search answer quality against a custom in-memory query-answer dataset, using an LLM-based pass/fail grader for flexible, open-ended judging. Use it as a starting template for evaluating web-search-based question answering, especially when ground-truth answers are open-ended enough that exact-match grading wouldn't work.

What it does

This notebook demonstrates evaluating a language model's ability to retrieve correct answers from the web, using the OpenAI Evals framework with a small, custom in-memory dataset rather than an existing logs-based source. Each dataset item is a query (the search prompt) paired with an answer (the expected ground truth), and it's meant as a template you can extend with your own search scenarios.

When to use - and when NOT to

Use this as a starting template when you want to test information-retrieval quality for models using a web search tool, and your ground-truth answers are open-ended enough that exact string matching wouldn't work reliably. An LLM-based pass/fail grader is used specifically because it can flexibly judge whether an answer matches or contains the correct information, even when phrasing varies - a rigid exact-match check would be too brittle for this kind of open-ended web search response.

Inputs and outputs

The evaluation configuration specifies the eval name and dataset, the schema for each Q&A item, the grader(s) to use, and the passing criteria and labels, with all of it defined up front to keep the evaluation reproducible. The example runs the evaluation against both gpt-4.1 and gpt-4.1-mini using the web search tool, then polls at intervals until each run reaches a completed or failed status rather than blocking synchronously, deliberately avoiding excessive API calls while waiting for results.

Integrations

After a run completes, each model's answer per query is printed for manual inspection against the expected answer, and full results can be visualized in the OpenAI Evals dashboard at platform.openai.com/evaluations. Suggested next steps include expanding the dataset with more diverse and challenging queries, summarizing pass/fail rates or performing error analysis to find specific weaknesses, testing additional models or web search tool configurations side by side, and automating report generation (summary tables or plots) for easier sharing with a team.

Who it's for

Developers who want a reproducible way to measure and compare how well different models perform at web-search-based question answering, using a lightweight, extensible starting dataset rather than building a full eval harness from scratch. The notebook frames this as a template rather than a finished benchmark - the small dataset shown is meant to be grown with more diverse and challenging queries as your own evaluation needs mature, and the same clear-schema, clear-grader approach transfers directly to other information-retrieval tasks beyond plain web search.

Source README

Evaluating Web Search Quality with a Custom Dataset

This notebook demonstrates how to evaluate a model's ability to retrieve correct answers from the web using the OpenAI Evals framework with a custom in-memory dataset.

Goals:

  • Show how to set up and run an evaluation for web search quality.
  • Provide a template for evaluating information retrieval capabilities of LLMs.

Environment Setup

We begin by importing the required libraries and configuring the OpenAI client.
This ensures we have access to the OpenAI API and all necessary utilities for evaluation.

Define the Custom Evaluation Dataset

We define a small, in-memory dataset of question-answer pairs for web search evaluation.
Each item contains a query (the user's search prompt) and an answer (the expected ground truth).

Tip:
You can modify or extend this dataset to suit your own use case or test broader search scenarios.

Define Grading Logic

To evaluate the model’s answers, we use an LLM-based pass/fail grader:

  • Pass/Fail Grader:
    An LLM-based grader that checks if the model’s answer (from web search) matches the expected answer (ground truth) or contains the correct information.

Best Practice:
Using an LLM-based grader provides flexibility for evaluating open-ended or fuzzy responses.

Define the Evaluation Configuration

We now configure the evaluation using the OpenAI Evals framework.

This step specifies:

  • The evaluation name and dataset.
  • The schema for each item (what fields are present in each Q&A pair).
  • The grader(s) to use (LLM-based pass/fail).
  • The passing criteria and labels.

Best Practice:
Clearly defining your evaluation schema and grading logic up front ensures reproducibility and transparency.

Run the Model and Poll for Completion

We now run the evaluation for the selected models (gpt-4.1 and gpt-4.1-mini).

After launching the evaluation run, we poll until it is complete (either completed or failed).

Best Practice:
Polling with a delay avoids excessive API calls and ensures efficient resource usage.

Display and Interpret Model Outputs

Finally, we display the outputs from the model for manual inspection and further analysis.

  • Each answer is printed for each query in the dataset.
  • You can compare the outputs to the expected answers to assess quality, relevance, and correctness.

You can visualize the results in the evals dashboard by going to https://platform.openai.com/evaluations as shown in the image below:

In this notebook, we demonstrated a workflow for evaluating the web search capabilities of language models using the OpenAI Evals framework.

Key points covered:

  • Defined a focused, custom dataset for web search evaluation.
  • Configured an LLM-based grader for robust assessment.
  • Ran a reproducible evaluation with the latest OpenAI models and web search tool.
  • Retrieved and displayed model outputs for inspection.

Next steps and suggestions:

  • Expand the dataset: Add more diverse and challenging queries to better assess model capabilities.
  • Analyze results: Summarize pass/fail rates, visualize performance, or perform error analysis to identify strengths and weaknesses.
  • Experiment with models/tools: Try additional models, adjust tool configurations, or test on other types of information retrieval tasks.
  • Automate reporting: Generate summary tables or plots for easier sharing and decision-making.

For more information, see the OpenAI Evals documentation.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.