feat(genai): OllamaClient structured-output /api/chat backend (spec 6) #24

Merged
goldstein merged 1 commit from feat/ollama-client into main 2026-04-18 09:58:39 +00:00
Owner

Real GenAIClient implementation wrapping Ollama /api/chat structured output.

Summary

  • OllamaClient(base_url, per_call_timeout_s) with invoke() and selfcheck() methods
  • Sends format=, stream=false, maps temperature, drops reasoning_effort
  • Content-parts lists joined since MVP models don't speak native parts
  • Error mapping: connection/timeout/5xx -> IX_002_000; schema violations -> IX_002_001
  • selfcheck() -> ok/degraded/fail for /healthz (spec 5)

Test plan

  • 10 hermetic unit tests (pytest-httpx) covering happy path + every error path + selfcheck states
  • 2 live tests gated on IX_TEST_OLLAMA=1 never run in CI
  • Full unit + integration suite green (219 passed)
  • Ruff check clean
Real GenAIClient implementation wrapping Ollama /api/chat structured output. ## Summary - OllamaClient(base_url, per_call_timeout_s) with invoke() and selfcheck() methods - Sends format=<pydantic schema>, stream=false, maps temperature, drops reasoning_effort - Content-parts lists joined since MVP models don't speak native parts - Error mapping: connection/timeout/5xx -> IX_002_000; schema violations -> IX_002_001 - selfcheck() -> ok/degraded/fail for /healthz (spec 5) ## Test plan - [x] 10 hermetic unit tests (pytest-httpx) covering happy path + every error path + selfcheck states - [x] 2 live tests gated on IX_TEST_OLLAMA=1 never run in CI - [x] Full unit + integration suite green (219 passed) - [x] Ruff check clean
goldstein added 1 commit 2026-04-18 09:58:35 +00:00
feat(genai): OllamaClient — structured-output /api/chat backend (spec §6)
All checks were successful
tests / test (push) Successful in 1m10s
tests / test (pull_request) Successful in 1m5s
90e46b707d
Real GenAIClient for the production pipeline. Sends `format=<pydantic JSON
schema>`, `stream=false`, and mapped options (`temperature`; drops
`reasoning_effort`). Content-parts lists joined to a single string since
MVP models don't speak native content-parts. Error mapping per spec:
connection/timeout/5xx → IX_002_000, schema violations → IX_002_001.
`selfcheck()` probes /api/tags with a fixed 5 s timeout for /healthz.

Tests: 10 hermetic pytest-httpx unit tests; 2 live tests gated on
IX_TEST_OLLAMA=1 (never run in CI).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
goldstein merged commit 0f045f814a into main 2026-04-18 09:58: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#24
No description provided.