- SourcePipeline: retry split_entities stage once when 0 entity delimiters are found (free-tier models intermittently return short non-formatted responses); save raw LLM response to <stage>-raw.md alongside prompts - Return None (pause pipeline) rather than writing empty view file when no entities found after max retries - _http.py: wrap json.JSONDecodeError in LLMAPIError with body preview - extract-entities.md: add explicit H2-heading format example to Output Format section to prevent models from using inline "Section:" format Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.5 KiB
Extract Economic Entities
You are an analytical economist specializing in classical economic theory. Your task is to extract distinct economic entities from a chapter of Adam Smith's The Wealth of Nations.
Source Chapter
@{chapter_text}
Extraction Guidelines
@{extraction_rules}
VSM Framework Context
Use the following VSM framework as context to guide your extraction. Prioritize entities that are likely to have clear mappings to VSM concepts, but do not exclude entities simply because they lack an obvious mapping.
@{vsm_framework}
Existing Entities
The following entities have already been extracted from previous chapters of this work. Do NOT re-extract any of these. If one of these entities appears in the current chapter, you may omit it entirely — the infospace already contains it. Only extract entities that are genuinely new.
@{existing_entities}
Instructions
- Read the source chapter carefully.
- Review the list of existing entities above and do not duplicate them.
- Identify all distinct economic concepts, actors, mechanisms, and institutions that are NOT already in the existing entities list.
- For each new entity, produce a separate markdown document following the Economic Entity Schema v1.0.
- Each entity document must include:
- An H1 heading with the entity name
- A Definition section (20-150 words)
- A Source Chapter section citing the specific chapter
- A Context section describing where in the argument the entity appears
- An Economic Domain section classifying the entity
- Optionally include Smith's Original Wording (direct quote) and Modern Interpretation sections.
- Use neutral, analytical language throughout.
- Ensure each entity is distinct and self-contained.
Output Format
Output each entity as a separate markdown document, delimited by
--- ENTITY: <entity-name> --- markers.
Use H2 headings (##) for each section inside the entity document.
Do NOT use inline Section: format or H3 headings.
Example of a correctly formatted entity:
--- ENTITY: division of labour ---
# Division of Labour
## Definition
The separation of a work process into distinct tasks performed by specialised
workers, increasing productivity through greater dexterity, saved time, and
the invention of labour-saving machinery.
## Source Chapter
Book I, Chapter 1
## Context
The opening chapter's central argument, illustrated by Smith's pin factory
example showing how dividing 18 operations dramatically increases output.
## Economic Domain
Production
---