Files
MealQuest/internal/ai/llm/ollama/testdata/chat_schema.json
T
dev_agentandClaude Opus 5.5 d5fe7548c5
CI / ci (push) Successful in 1m31s
Independent review Codex gpt-6-sol high: CHANGES_REQUIRED (1 medium)
CI / ci (pull_request) Successful in 1m28s
Ollama native adapter
internal/ai/llm/ollama implements llm.Provider over plain net/http:
POST {base}/api/chat with "stream": false, the request schema in
"format", and options.temperature / options.num_predict only when the
request sets them; GET {base}/api/tags for ListModels and Verify. No
Authorization header is sent and redirects are not followed.

Usage comes from prompt_eval_count/eval_count. A schema reply that is
not a JSON object is ErrBadOutput. HTTP 404 on /api/chat is an
ErrProvider naming the configured model, without quoting the body.
Refused connections and timeouts match ErrTimeout and say
"Ollama not reachable at {base}"; a cancelled context stays
context.Canceled. The base URL is required, absolute http or https
(LAN hosts allowed), and may not carry userinfo, a query or a fragment.

Contract tests replay sanitized fixtures adapted from Ollama's public
API docs against httptest servers: success, schema output, model
missing and unreachable host.

Maestro task: 51289131-5abf-48c3-b553-7e3809c09076

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 08:30:17 -04:00

17 lines
460 B
JSON

{
"model": "llama3.2",
"created_at": "2026-10-04T12:20:11.009132Z",
"message": {
"role": "assistant",
"content": "{\"dinners\": [{\"name\": \"Sheet-pan gnocchi\", \"why\": \"Like your Regular tray bake, but quicker.\"}]}"
},
"done_reason": "stop",
"done": true,
"total_duration": 1416823291,
"load_duration": 12309083,
"prompt_eval_count": 147,
"prompt_eval_duration": 271802000,
"eval_count": 41,
"eval_duration": 1130948000
}