infoxtractor/tests
Dirk Riemann 9cb62d69af
All checks were successful
tests / test (push) Successful in 1m33s
tests / test (pull_request) Successful in 4m29s
fix(genai): strip null branches from anyOf before sending to Ollama
Ollama 0.11.8's llama.cpp structured-output implementation segfaults on
Pydantic v2's standard Optional pattern:

    {"anyOf": [{"type": "string"}, {"type": "null"}]}

Confirmed on the deploy host: /api/chat request with the MVP's
ProvenanceWrappedResponse schema crashed Ollama with SIGSEGV; the client
saw httpx RemoteProtocolError → IX_002_000.

New _sanitise_schema_for_ollama walks the schema recursively and drops
"type: null" branches from every anyOf. Single-branch unions are
inlined so sibling keys (default, title) survive. This only narrows
what the LLM is *told* it may emit; Pydantic still validates the real
response body against the original schema and accepts None for
Optional fields if they were absent or explicitly null.

Existing unit tests updated: the "happy path" test no longer pins the
format to `_Schema.model_json_schema()` verbatim — instead it asserts
the sanitisation effect on a known-Optional field.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 13:48:26 +02:00
..
fixtures test(pipeline): end-to-end hermetic test with fakes + synthetic fixture 2026-04-18 11:24:29 +02:00
integration feat(pg-queue): LISTEN ix_jobs_new + 10s fallback poll (spec §4) 2026-04-18 11:52:26 +02:00
live chore(model): switch default IX_DEFAULT_MODEL to qwen3:14b (already on host) 2026-04-18 12:20:23 +02:00
unit fix(genai): strip null branches from anyOf before sending to Ollama 2026-04-18 13:48:26 +02:00
__init__.py feat(scaffold): project skeleton with uv + pytest + forgejo CI 2026-04-18 10:36:43 +02:00
conftest.py feat(scaffold): project skeleton with uv + pytest + forgejo CI 2026-04-18 10:36:43 +02:00