Skill
Instructor pydantic extractor
Wrap any local Ollama or cloud LLM in Instructor to extract Pydantic-schema-conformant JSON with context-aware reask on ValidationError — 95%+ first-retry self-correction
Primitives inside (12)
cot-fields-before-answer-fieldsdisciplineOrder schema fields evidence -> reasoning -> answer: models fill schemas in token order, so a reasoning field placed before the answer forces deliberation before commitment.
When: Designing an extraction/classification schema where answer quality depends on reasoning (complex judgment, or a low-capability model).
extra-forbid-blocks-hallucinated-keysdisciplineSet ConfigDict(extra='forbid') on extraction schemas so hallucinated extra fields become validation errors instead of silently accepted junk.
When: Defining the Pydantic model that an LLM will fill.
from-provider-cache-paramcalibrationfrom_provider (1.15.4) exposes a `cache` parameter — a response-caching hook (signature: model, async_client=False, cache=None, mode=None, **kwargs) — available for dedup/cost control though undocumented in most recipes.
When: Repeated identical extractions where response caching could cut calls.
instructor-exception-surfacecalibrationinstructor 1.15.4's exception surface spans instructor.core.exceptions (ValidationError, ProviderError, ConfigurationError, ModeError, ResponseParsingError, InstructorError, ClientError) plus InstructorRetryException from v2 core on retry exhaustion — catch broadly at the pipeline boundary and return a telemetry dict, not a crash.
When: Wrapping instructor extraction inside a pipeline step that must degrade gracefully.
instructor-reask-looptool-sequenceContext-aware reask: on Pydantic ValidationError, Instructor appends the broken model response AND the literal validator error text to the message history and re-calls — the model sees its own mistake and self-corrects, unlike retry-from-zero.
When: Structured extraction where semantic validators (field_validator, cross-field constraints) must hold on the output.
inverted-regression-canarydisciplinePin a known UPSTREAM defect with an assertion that the bug still EXISTS ('if this ever stops failing, upstream fixed it -> update the doc') — the selftest then detects the upstream fix the day it lands instead of shipping stale workaround docs forever.
When: A skill/doc teaches a workaround for a third-party library defect that upstream may silently fix.
llm-validator-client-requiredgotcha-fixinstructor.llm_validator's real 1.15.4 signature is llm_validator(statement, client, allow_override=False, model='gpt-3.5-turbo', temperature=0) — the client positional is REQUIRED and there is no allow_reask parameter (older examples showing it are stale; closest is allow_override).
When: Delegating semantic field validation to an LLM inside a Pydantic validator.
local-retries-free-money-not-timecalibrationAgainst local Ollama, retries cost zero money but real wall-clock (~36s per qwen3:32b call incl. model load) — retry aggressively only when time is not the constraint; for cloud, 3 retries on a 2K-token call can hit ~6x base cost.
When: Setting max_retries and designing test suites around local vs cloud LLM calls.
max-retries-create-onlygotcha-fixIn instructor 1.15.x, passing max_retries to from_provider() poisons the client: EVERY subsequent create() raises TypeError 'got multiple values for keyword argument max_retries' — max_retries belongs on create() ONLY.
When: Building instructor clients and wondering why every extraction call TypeErrors.
provider-mode-autoselect-and-overridecalibrationInstructor auto-selects TOOLS mode for function-calling-aware Ollama models (llama3.1, qwen2.5, gemma3) and JSON mode for the rest — override explicitly (mode=Mode.JSON) when auto-detection misfits the model.
When: Structured extraction misbehaves on a particular local model (tool-call errors or malformed JSON).
removed-helper-import-guardgotcha-fixdisable_pydantic_error_url no longer exists in instructor 1.15.4 (it was a real 1.x helper) — importing or calling it crashes; the docs may MENTION the symbol historically but must never teach importing it, enforced by a doc-guard assertion.
When: Porting older instructor recipes (token-saving helpers) onto current versions.
retry-on-quality-predicatetool-sequenceRetry not only on exceptions but on result-quality predicates — e.g. wrap the extraction with tenacity retry_if_result(confidence below threshold) so a schema-valid but low-confidence result gets another bounded attempt.
When: A structured extraction validates fine but carries a machine-readable quality signal (e.g. a confidence score) that can be too low to accept.
Get the whole skill
All 12 primitives of this skill as one package, with the order to apply them.
Buy only the primitives you need
Each primitive is 1 credit (≈ €0.10). Pick them from the list above — the button is next to each one.
Upgrade your own skill
Paste your skill; we pick the 5 primitives from the shelf that fit it best, as one bundle for 5 credits (≈ €0.50).
Upgrade my skillNeighbour skills
Skills whose primitives are closest to this one (bge-m3 similarity):