Views
No views yet

[!NOTE] This model card is dedicated to the smallerSchematron-8Bmodel. Check outSchematron-3Bfor the smaller model.
[!NOTE] The JSON Schema passed as input needs to conform to the schema.org schema.
| Model | LLM-as-Judge Score |
|---|---|
| GPT-4.1 | 4.74 |
| Schematron-8B | 4.64 |
| Schematron-3B | 4.41 |
| Gemini-3B-Base | 2.24 |

1from lxml.html.clean import Cleaner
2import lxml.html as LH
3
4HTML_CLEANER = Cleaner(
5 scripts=True,
6 javascript=True,
7 style=True,
8 inline_style=True,
9 safe_attrs_only=False,
10)
11
12
13def strip_noise(html: str) -> str:
14 """Remove scripts, styles, and JavaScript from HTML using lxml.
15 """
16 if not html or not html.strip():
17 return ""
18 try:
19 doc = LH.fromstring(html)
20 cleaned = HTML_CLEANER.clean_html(doc)
21 return LH.tostring(cleaned, encoding="unicode")
22 except Exception:
23 return ""1def construct_messages(schema: str, html: str):
2 """Construct messages for a schema‑guided extraction request."""
3 response_prompt = {
4 "prompt_part_one": (
5 "You are going to be given a JSON schema following the standardized JSON "
6 "Schema format. You are going to be given a HTML page and you are going "
7 "to apply the schema to the HTML page however you see it as applicable "
8 "and return the results in a JSON object. The schema is as follows:"
9 ),
10 "prompt_part_two": "Here is the HTML page:",
11 "prompt_part_three": "MAKE SURE ITS VALID JSON.",
12 }
13
14 user_prompt = (
15 response_prompt['prompt_part_one']
16 + "\n\n" + schema + "\n\n"
17 + response_prompt['prompt_part_two']
18 + "\n\n" + html + "\n\n"
19 + response_prompt['prompt_part_three']
20 )
21
22 return [
23 {"role": "system", "content": "You are a helpful assistant"},
24 {"role": "user", "content": user_prompt},
25 ][!NOTE] In the serverless API there's no need to pass anything but the HTML. We handle the prompt formatting for you.