Skip to content

API Reference parrot_tools.scraping.extraction_plan_generator

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.scraping.extraction_plan_generator

View source

ExtractionPlanGenerator — LLM-based ExtractionPlan generation.

Analyzes raw HTML content and a natural language objective to produce an ExtractionPlan via a single LLM recon call. The resulting plan specifies entity types, fields, and CSS selectors derived from the page structure.

Alias ExtractionPlan

Re-exported from parrot_tools.scraping.extraction_models.ExtractionPlan.

Class ExtractionPlanGenerator

Generates ExtractionPlan from HTML content + objective using LLM reconnaissance.

Makes a single LLM call with a cleaned version of the page HTML and the extraction objective. The LLM is prompted to identify entity types and emit CSS selectors that can be used for mechanical extraction.

The LLM client must support async def complete(prompt: str) -> str.

Parameter Type Default Description
llm_client Any Any object with an async complete(prompt) method.

Method ExtractionPlanGenerator.generate

Generate an ExtractionPlan via LLM reconnaissance.

Cleans the HTML (applying ignore_sections to strip noise), builds the recon prompt, calls the LLM, and parses the JSON response into a validated ExtractionPlan.

generate(url: str, objective: str, content: str, hints: Optional[Dict[str, Any]] = None, ignore_sections: Optional[List[str]] = None) -> ExtractionPlan

Parameter Type Default Description
url str Target URL being analyzed.
objective str Natural language goal for extraction.
content str Raw HTML content of the page.
hints Optional[Dict[str, Any]] None Optional dict of hints to bias plan generation.
ignore_sections Optional[List[str]] None Optional list of CSS selectors for page sections to strip before sending HTML to the LLM (e.g. from a pre-existing ExtractionPlan's ignore_sections field).

Returns: ExtractionPlan — Validated ExtractionPlan parsed from LLM response.

Raises:

  • ValueError — If the LLM response cannot be parsed into a valid plan.

Attribute RECON_PROMPT

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally