task_id stringlengths 6 6 | category stringclasses 5
values | prompt stringlengths 67 138 | documents stringclasses 1
value | doc_name stringclasses 3
values | html stringclasses 3
values | expected_output stringlengths 19 211 |
|---|---|---|---|---|---|---|
bs-000 | selection | Return the text of every <h2>, in document order, as a list of 1-element lists. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["Maidenhair Fern"], ["Snake Plant"], ["Fiddle Leaf Fig"], ["Terracotta 12cm"], ["Glazed Blue 18cm"]]} |
bs-001 | selection | Return [href] for every <a> whose class list includes 'nav', in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["/plants"], ["/pots"], ["https://example.org/about"]]} |
bs-002 | selection | Using a CSS selector, return [data-sku] for every article with BOTH classes 'item' and 'sale', in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["P-101"], ["C-201"]]} |
bs-003 | selection | Return [id, data-count] for every <section> that has a data-count attribute, in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["plants", "3"], ["pots", "2"]]} |
bs-004 | selection | Return [text] of every <li> inside the article whose data-sku is 'P-101', in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["hardy"], ["low-light"], ["air"]]} |
bs-005 | selection | Return [href] for every <a> whose href starts with 'https://', in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["https://example.org/about"]]} |
bs-006 | selection | Using a CSS selector, return [text] of the FIRST <p class='price'> only, as a single-row list. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["\u00a318.50"]]} |
bs-007 | attributes | Return [data-sku, data-cents as an int] for every article.item, in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["P-100", 1850], ["P-101", 1200], ["P-102", 4200], ["C-200", 600], ["C-201", 2400]]} |
bs-008 | attributes | Return [content] of the <meta name='description'> tag, as a single-row list. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["Plants and pots"]]} |
bs-009 | attributes | Return [text] of the <title>, as a single-row list. HTML entities must be decoded. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["Fern & Stone \u2014 Catalogue"]]} |
bs-010 | attributes | Return [data-sku, number of <li> tags in that article] for every article.item, in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["P-100", 2], ["P-101", 3], ["P-102", 1], ["C-200", 0], ["C-201", 0]]} |
bs-011 | attributes | Return [src, alt] for every <img> in the document, using an empty string when alt is absent. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | messy | <html><body>
<div class="post">
<h3>Notes</h3>
<ul>
<li>first
<li>second
<li>third
</ul>
<p>Intro text<div class="inner">nested block</div>tail text</p>
<span>loose</span></span>
<img src="/a.png" alt="A"><img src="/b.png">
</div>
</body></html> | {"rows": [["/a.png", "A"], ["/b.png", ""]]} |
bs-012 | attributes | Return [class list joined by a single space] for every article.item, in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["item"], ["item sale"], ["item"], ["item"], ["item sale"]]} |
bs-013 | navigation | For the <h2> whose text is 'Snake Plant', return [text of its next <p> sibling], as a single-row list. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["\u00a312.00"]]} |
bs-014 | navigation | For the article whose data-sku is 'C-201', return [id of its ancestor <section>], as a single-row list. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["pots"]]} |
bs-015 | navigation | Return [tag name] of every DIRECT child element of <main>, in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["section"], ["section"]]} |
bs-016 | navigation | For each article.item, return [h2 text, href of its 'details' link], in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["Maidenhair Fern", "/plants/maidenhair"], ["Snake Plant", "/plants/snake"], ["Fiddle Leaf Fig", "/plants/fiddle"], ["Terracotta 12cm", "/pots/terracotta-12"], ["Glazed Blue 18cm", "/pots/glazed-18"]]} |
bs-017 | navigation | Return [text] of every element inside <footer>, for direct children only, in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | catalogue | <!DOCTYPE html>
<html lang="en">
<head><title>Fern & Stone — Catalogue</title>
<meta name="description" content="Plants and pots">
</head>
<body>
<header id="top"><h1 class="site">Fern & Stone</h1></header>
<nav><a href="/plants" class="nav">Plants</a><a href="/pots" class="nav">Pots</a>
... | {"rows": [["\u00a9 2026 Fern & Stone"], ["Contact"]]} |
bs-018 | tables | From the stock table, return the header cell texts as a single row. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | table | <html><body>
<table id="stock">
<thead><tr><th>SKU</th><th>Name</th><th>Qty</th><th>Location</th></tr></thead>
<tbody>
<tr><td>P-100</td><td>Maidenhair Fern</td><td>14</td><td>A1</td></tr>
<tr class="low"><td>P-101</td><td>Snake Plant</td><td>3</td><td>A2</td></tr>
<tr><td>P-102</td><td>Fiddle Leaf Fig<... | {"rows": [["SKU", "Name", "Qty", "Location"]]} |
bs-019 | tables | From the stock table, return [sku, name, qty as an int, location] for every tbody row, in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | table | <html><body>
<table id="stock">
<thead><tr><th>SKU</th><th>Name</th><th>Qty</th><th>Location</th></tr></thead>
<tbody>
<tr><td>P-100</td><td>Maidenhair Fern</td><td>14</td><td>A1</td></tr>
<tr class="low"><td>P-101</td><td>Snake Plant</td><td>3</td><td>A2</td></tr>
<tr><td>P-102</td><td>Fiddle Leaf Fig<... | {"rows": [["P-100", "Maidenhair Fern", 14, "A1"], ["P-101", "Snake Plant", 3, "A2"], ["P-102", "Fiddle Leaf Fig", 7, "B1"], ["C-200", "Terracotta 12cm", 2, "C3"]]} |
bs-020 | tables | From the stock table, return [sku, qty as an int] for rows carrying the class 'low', in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | table | <html><body>
<table id="stock">
<thead><tr><th>SKU</th><th>Name</th><th>Qty</th><th>Location</th></tr></thead>
<tbody>
<tr><td>P-100</td><td>Maidenhair Fern</td><td>14</td><td>A1</td></tr>
<tr class="low"><td>P-101</td><td>Snake Plant</td><td>3</td><td>A2</td></tr>
<tr><td>P-102</td><td>Fiddle Leaf Fig<... | {"rows": [["P-101", 3], ["C-200", 2]]} |
bs-021 | tables | From the stock table, return a single row [number of tbody rows, total qty as an int]. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | table | <html><body>
<table id="stock">
<thead><tr><th>SKU</th><th>Name</th><th>Qty</th><th>Location</th></tr></thead>
<tbody>
<tr><td>P-100</td><td>Maidenhair Fern</td><td>14</td><td>A1</td></tr>
<tr class="low"><td>P-101</td><td>Snake Plant</td><td>3</td><td>A2</td></tr>
<tr><td>P-102</td><td>Fiddle Leaf Fig<... | {"rows": [[4, 26]]} |
bs-022 | malformed | This document has UNCLOSED <li> tags. Parsed with html.parser, return [stripped text] of every <li>, in document order. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | messy | <html><body>
<div class="post">
<h3>Notes</h3>
<ul>
<li>first
<li>second
<li>third
</ul>
<p>Intro text<div class="inner">nested block</div>tail text</p>
<span>loose</span></span>
<img src="/a.png" alt="A"><img src="/b.png">
</div>
</body></html> | {"rows": [["firstsecondthird"], ["secondthird"], ["third"]]} |
bs-023 | malformed | This document has a <div> inside a <p>. Parsed with html.parser, return a single row [the <p>'s full get_text() with whitespace stripped]. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | messy | <html><body>
<div class="post">
<h3>Notes</h3>
<ul>
<li>first
<li>second
<li>third
</ul>
<p>Intro text<div class="inner">nested block</div>tail text</p>
<span>loose</span></span>
<img src="/a.png" alt="A"><img src="/b.png">
</div>
</body></html> | {"rows": [["Intro textnested blocktail text"]]} |
bs-024 | malformed | Return a single row [number of <li> tags, number of <img> tags, number of <span> tags] found in this document. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | messy | <html><body>
<div class="post">
<h3>Notes</h3>
<ul>
<li>first
<li>second
<li>third
</ul>
<p>Intro text<div class="inner">nested block</div>tail text</p>
<span>loose</span></span>
<img src="/a.png" alt="A"><img src="/b.png">
</div>
</body></html> | {"rows": [[3, 2, 1]]} |
bs-025 | malformed | Return a single row [the text of the <h3>, the class attribute of its parent <div>]. | Three HTML documents are preloaded as strings:
catalogue : a small shop page — nav links, two <section>s of <article class="item">
with data-sku / data-cents attributes, tag lists, a footer
table : one <table id="stock"> with a thead and four tbody rows, some <tr class="low">
messy ... | messy | <html><body>
<div class="post">
<h3>Notes</h3>
<ul>
<li>first
<li>second
<li>third
</ul>
<p>Intro text<div class="inner">nested block</div>tail text</p>
<span>loose</span></span>
<img src="/a.png" alt="A"><img src="/b.png">
</div>
</body></html> | {"rows": [["Notes", "post"]]} |
beautifulsoup-tasks-v1
Task dataset for a BeautifulSoup RL / eval environment, in the shape used by the Prime Intellect Environments Hub.
26 HTML-extraction tasks over three fixed documents. Each task gives the model the documents
and an instruction; the answer is the list of rows left in result, compared exactly to a
reference. Grading is deterministic — no LLM judge, no external API, no network.
| Category | Tasks | Covers |
|---|---|---|
| selection | 7 | find_all, class filters, CSS selectors, attribute presence, select_one, href predicates |
| attributes | 6 | reading and casting data-*, meta content, entity decoding, missing attributes with a default, class lists |
| navigation | 5 | find_next_sibling, find_parent, direct children only (recursive=False), pairing a heading with its link |
| tables | 4 | header cells, full row extraction with type casting, filtering rows by class, aggregate over a column |
| malformed | 4 | unclosed <li>, a <div> inside a <p>, a stray </span>, an <img> with no alt |
⚠ The determinism trap in this domain, and how it is handled
BeautifulSoup's result depends on the parser — and this was measured, not assumed. On the
malformed document in this dataset, asking for the <p>'s text gives:
html.parser -> "Intro textnested blocktail text" (keeps the <div> inside the <p>)
lxml -> "Intro text" (closes the <p> first, per HTML5)
An answer key built with one parser and graded under another is simply wrong. Therefore:
- every task states
BeautifulSoup(html, "html.parser")explicitly in its prompt; html.parseris used because it ships with CPython — no extra dependency can be missing or differently versioned in the sandbox;- the malformed-HTML tasks are labelled as such, so the expected repair behaviour is the thing being tested rather than an accident.
Fields
| Field | Description |
|---|---|
task_id |
stable id, e.g. bs-017 |
category |
one of the five above |
prompt |
the natural-language instruction |
documents |
a short description of all three documents |
doc_name |
which document this task uses (catalogue, table, messy) |
html |
the full source of that document, so the task is self-contained |
expected_output |
{"rows": [[...], ...]} — the reference result |
Verification
Every task is independently checked: it runs, is deterministic across two fresh parses, returns
a non-empty list of JSON-safe primitives (which catches the common error of returning a
Tag or NavigableString instead of extracted text), contains no accidental empty strings
outside the tasks that legitimately allow one, and survives the serialisation round-trip
exactly. All 26 pass on beautifulsoup4 4.15.0.
Builder and verifier:
build_tasks.py.
- Downloads last month
- -