Model provider switch: Anthropic / Ollama feature flag #16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Standalone — scoped from session discussion. Anthropic is primary for now, Ollama (qwen2.5:7b) is the zero-cost fallback.
Repo
forgejo_admin/westside-ai-assistantUser Story
As Lucas (platform operator)
I want to switch between Anthropic and Ollama with an env var
So that I can use Anthropic when I have tokens and fall back to Ollama when I don't
Context
The AI engine was originally built with Anthropic SDK, then swapped to OpenAI SDK for Ollama. These are different SDKs with different request/response formats. This ticket adds a
AI_PROVIDERenv var ("anthropic" or "ollama") that selects which SDK and endpoint to use. Tool definitions, system prompt, conversation history, and confirmation flow stay the same — only the LLM client layer changes. Ollama uses OpenAI-compatible API at cluster-internal URL. qwen2.5:7b is already pulled into the Ollama pod.File Targets
Files the agent should modify:
app/ai.py— abstract LLM client behind a provider interface. Two implementations: AnthropicProvider (anthropic SDK) and OllamaProvider (openai SDK). Selected byAI_PROVIDERenv var.app/config.py— addai_provider: str = "anthropic", keep bothanthropic_api_key/anthropic_modelandollama_url/ollama_modelfieldsapp/health.py— readiness checks the configured provider's credentialsrequirements.txt— bothanthropicandopenaias dependenciestests/test_ai.py— test both provider pathsFiles the agent should NOT touch:
app/basketball.py,app/confirmation.py,app/groupme.pyAcceptance Criteria
AI_PROVIDER=anthropicuses Anthropic SDK withANTHROPIC_API_KEYandANTHROPIC_MODELAI_PROVIDER=ollamauses OpenAI SDK withOLLAMA_URLandOLLAMA_MODELTest Expectations
pytest tests/ -vConstraints
async def complete(messages, tools) -> ProviderResponseChecklist
Related
project-westside-ai-assistant— parent projectstory-westside-ai-assistant-read-ops— must work with both providersScope Review: NEEDS_REFINEMENT
Review note:
review-647-2026-03-28Issue body is well-scoped and template-complete. All 5 file targets verified against the repo. The sole blocker is missing backing notes in pal-e-docs for the traceability triangle:
story-westside-ai-assistant-read-ops(referenced on project page, does not exist)story-westside-ai-assistant-write-ops(referenced on project page, does not exist)arch-domain-westside-ai-assistant,arch-dataflow-westside-ai-assistant,arch-deployment-westside-ai-assistant) — project page links to them but none exist. Thearch:A2board label has no clear mapping to these named notes.These are project-level gaps affecting all items on
board-westside-ai-assistant. Once resolved, this ticket is READY.