Per-provider vision blocks; parser repairs local models' almost-JSON

config.toml now carries a [vision.<provider>] block per backend —
model/base_url/key_env — with vision_provider picking the active one,
so the committed file documents every recipe and switching is a
one-line flip. Only the active block applies; typo'd block names and
keys warn like every other config mistake.

First real Ollama run (qwen2.5vl:7b) surfaced what local models emit:
almost-JSON with trailing commas. parse_vision_response now makes one
cheap repair pass before declaring a response unusable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016jXZFSTZQKzAC8fqpWSz9g
This commit is contained in:
Eric Wagoner
2026-08-03 18:39:27 -04:00
co-authored by Claude Fable 5
parent 0358079da4
commit 118503e4e0
6 changed files with 99 additions and 12 deletions
+14 -7
View File
@@ -3,12 +3,19 @@
photos_dir = "photos"
data_dir = "data"
model = "claude-sonnet-5"
rate_limit_seconds = 2.0
# Vision backend. The default ("anthropic") reads ANTHROPIC_API_KEY.
# "openai-compatible" covers OpenAI, OpenRouter, and local runtimes:
# vision_provider = "openai-compatible"
# vision_base_url = "http://localhost:11434/v1" # e.g. Ollama
# model = "qwen2.5vl" # a vision-capable model
# vision_key_env = "" # local: no key needed
# Which vision backend reads your shelf photos. Both recipes below stay
# on file; this line picks one.
vision_provider = "anthropic"
[vision.anthropic]
# reads ANTHROPIC_API_KEY from the environment
model = "claude-sonnet-5"
[vision."openai-compatible"]
# OpenAI, OpenRouter, or a local runtime (Ollama, LM Studio, vLLM).
# key_env names the env var holding the key; "" = endpoint needs none.
base_url = "http://localhost:11434/v1"
model = "qwen2.5vl:7b"
key_env = ""