fix(genai): inject schema into Ollama system prompt #40

Merged
goldstein merged 1 commit from fix/ollama-schema-in-prompt into main 2026-04-18 12:02:39 +00:00
Owner

format=json needs the shape in the prompt.

format=json needs the shape in the prompt.
goldstein added 1 commit 2026-04-18 12:02:37 +00:00
fix(genai): inject JSON schema into Ollama system prompt
All checks were successful
tests / test (push) Successful in 1m8s
tests / test (pull_request) Successful in 1m18s
34f8268cd5
format=json loose mode gives valid JSON but no shape — models default
to emitting {} when the system prompt doesn't list fields. Prepend a
schema-guidance system message with the full Pydantic schema (after
the existing null-branch sanitiser) so the model sees exactly what
shape to produce. Pydantic still validates on parse.

Unit tests updated to check the schema message is prepended without
disturbing the caller's own messages.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
goldstein merged commit 763407ba1c into main 2026-04-18 12:02:39 +00:00
goldstein referenced this pull request from a commit 2026-04-18 12:02:39 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: goldstein/infoxtractor#40
No description provided.