Przejdź do treści
Biblioteka skilli
AI i agenci · Budowanie i kod

structured-output-extraction

/structured-output-extraction

Projektuje schematy i walidację wyników modeli językowych, by dane w JSON trafiały do kodu bez wymyślonych wartości pól.

Repozytorium
skilldeck ↗
Licencja
MIT
Ostatnia zmiana repozytorium
09.11.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 09.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Projektuje schematy i walidację wyników modeli językowych, by dane w JSON trafiały do kodu bez wymyślonych wartości pól.

Oryginalny opis (EN)

Get reliable structured data out of LLMs - extraction schema design with explicit nulls and enums, choosing constrained decoding versus prompt-only formatting, parse and semantic validation, bounded repair retries, and field-level accuracy measurement. Use when model output feeds code, databases, or APIs, or when JSON parsing failures and invented field values appear.

Jak działa

  1. When to use
  2. Inputs
  3. Procedure
  4. Expected output
  5. Constraints and limitations
  6. Examples
Sekcje z nagłówków SKILL.md, w oryginale · 55 linii, 695 słów
Podgląd SKILL.md
---
name: structured-output-extraction
description: Get reliable structured data out of LLMs - extraction schema design with explicit nulls and enums, choosing constrained decoding versus prompt-only formatting, parse and semantic validation, bounded repair retries, and field-level accuracy measurement. Use when model output feeds code, databases, or APIs, or when JSON parsing failures and invented field values appear.
---

# Structured Output Extraction

## When to use
- Extracting fields from documents, emails, transcripts, or forms into JSON.
- Any LLM output consumed by code rather than a person.
- Seeing parse errors, wrong types, or plausible-looking values that are not in the source.

Not for: defining tools an agent calls (see `tool-schema-design`), or verifying free-text answers against sources (see `hallucination-detection`).

## Inputs
- Target data model and the downstream consumer's requirements.
- 20+ sample inputs with hand-labeled expected outputs (more for production gating).
- Provider capabilities: native JSON schema or structured-output mode, tool calling, or plain text only.

## Procedure
1. **Design the schema for extraction, not storage.**
   - Make absence explicit: nullable fields (`"type": ["string", "null"]`) plus an instruction that null means "not stated in the source". This is the single biggest defence against invented values.
   - Use `enum` for categorical fields and include `other` or `unknown` where the world is open.
   - Normalize formats in the schema description (ISO 8601 dates, ISO 4217 currency codes, amounts as strings or integers in minor units to avoid float issues).
   - Keep nesting shallow; use arrays of objects for repeated items (line items, parties).
   - Optionally add an `evidence` or `source_span` field per critical value, quoting the text it came from; it makes review and verification far easier.
2. **Choose the enforcement mechanism, strongest first.** Native schema-constrained output where the provider supports it guarantees syntactic validity for supported keywords; tool or function calling with the schema as parameters is the next option; prompt-only JSON with a schema and example is weakest. Constrained decoding guarantees shape, not correctness.
3. **Write the extraction prompt.** Provide the schema, field definitions with edge-case rules (for example "if two dates appear, use the effective date, not the signature date"), one or two complete examples including a null case, and the source text in a clearly delimited block. Ask for output only, no prose, when not using native modes.
4. **Validate in two layers.**
   - Syntactic: parse, then validate against the JSON Schema (types, required, enums, patterns).
   - Semantic: business rules the schema cannot express, such as totals equal sum of line items, end date after start date, and `evidence` text actually appearing in the source.
5. **Repair with a budget.** On failure, retry once or twice with the validator's error messages appended ("field `currency` must be one of [...]; got `dollars`"). After the budget, route to a fallback: human review queue, partial result with flagged fields, or rejection. Never loop indefinitely, and never "repair" by letting code guess values.
6. **Measure field-level accuracy.** On the labeled set, compute per-field exact match (after normalization), null precision (how often a predicted null is truly absent) and null recall, plus schema-valid rate and repair rate. Aggregate document accuracy hides weak fields.
7. **Monitor in production.** Log validation failure types, repair counts, and null rates per field (without raw sensitive values). Drift in null rates often signals a new input format.

## Expected output
```markdown
## Extraction spec: <document type> v<n>
Enforcement: <native schema | tool call | prompt-only>; model <name/version>
Schema: { ...JSON Schema... }
Semantic rules: total == sum(line_items.amount); end_date > start_date; evidence in source
Repair policy: max 2 retries with validator errors, then human review

| Field | Exact match | Null precision | Null recall | Notes |
|---|---|---|---|---|
| invoice_date | 0.97 | 1.00 | 0.90 | |

Schema-valid first pass <x>%, after repair <y>%, routed to review <z>%
```

## Constraints and limitations
- Schema validity is not truth; always measure field accuracy against labels.
- Provider structured-output modes support different subsets of JSON Schema; check documentation for your provider and version.
- Long documents may exceed context; chunk and merge carefully, deduplicating repeated entities.
- Extract only the fields you need when inputs contain personal data.

## Examples
Invoice extraction produced a `due_date` on 100% of documents although only 70% stated one; the model was inferring "30 days after issue". Making `due_date` nullable, adding a rule "null if not explicitly stated", and an `evidence` field cut invented due dates to near zero on the 150-document labeled set, while exact match on stated dates stayed at 0.96.
Pliki w paczce (2)
  • SKILL.md 5 KB
  • manifest.yaml 2 KB

Wersje

W bazie nie ma innych skilli o nazwie structured-output-extraction.

Migawka bazy z 13.11.2026 · wersja paczki 716317bd0fa5 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 90structured-output
    Zapewnia poprawne dane ustrukturyzowane z modeli językowych przez generowanie z ograniczeniem schematu, walidację na granicy i pętle naprawcze, gdy wynik trafia do kodu lub baz danych.
  • 90structured-outputs
    Wydobywa z modeli językowych dane w pełni zgodne ze schematem i typami, korzystając z JSON Schema, Pydantic, Zod, ograniczonego dekodowania i walidacji.
  • 100structured-output
    Pomaga uzyskać typowany JSON z LLM przez ograniczone dekodowanie, JSON Schema, Zod, Pydantic i Instructor, także przy błędnym JSON.
  • 100create-structured-output
    Projektuje i weryfikuje Structured Outputs Vapi, czyli typowane dane wyciągane po rozmowie, np. przez JSON Schema.
  • 100create-structured-output
    Projektuje i weryfikuje Structured Outputs Vapi, czyli typowane dane wyciągane po rozmowie, np. przez JSON Schema.
  • 100structured-output
    Prowadzi przez zwracanie przez LLM danych czytelnych maszynowo: projekt schematu, natywne tryby structured output, walidację i naprawę oraz ekstrakcję z nieuporządkowanych danych wejściowych.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.