Replace Anthropic SDK with Ollama and add purpose-built read-only tools #29
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
Supersedes #27 (read-only SQL tool — decided against direct SQL, using REST via basketball-api instead). Related to Nemo being dead since 2026-03-31 due to Anthropic credit exhaustion.
Repo
forgejo_admin/westside-ai-assistantUser Story
As an admin (Marcus)
I want to ask Nemo questions about players, rosters, and payments in GroupMe and get accurate answers
So that I can manage the program without logging into the admin dashboard or asking Lucas
Context
Nemo currently uses the Anthropic SDK with a generic
api_gettool that lets the model pick any basketball-api endpoint. This is too open-ended for qwen3.5:4b — a 4B model needs purpose-built tools with simple inputs and pre-formatted string outputs.The current architecture:
app/ai.py— Anthropic SDK, 1 generic read tool + 7 write tools, system prompt with endpoint listapp/basketball.py— Keycloak-authed HTTP client for basketball-api (KEEP THIS)app/groupme.py— GroupMe webhook handler (KEEP THIS)app/confirmation.py— Write confirmation state machine (REMOVE — V1 is read-only)The new architecture:
anthropic.messages.create()with Ollama HTTP API (POST /api/chatwith tools)api_getwith 4 purpose-built toolsFile Targets
Files to modify:
app/ai.py— replace Anthropic SDK with Ollama HTTP calls, replace TOOLS list with 4 purpose-built tools, update SYSTEM_PROMPT, update process_message to use Ollama chat formatapp/config.py— addollama_base_urlandollama_modelsettings, removeanthropic_api_keyandanthropic_modelrequirements.txt— removeanthropicdependency, addollama(or use raw httpx)Files to create:
app/tools.py— 4 tool handler functions, each calls BasketballClient and returns formatted string:search_player(name: str) -> str— search players by name, return player + parent contact infolist_roster(team_name: str) -> str— list all players on a team with positions and parent namespayment_status(name: str | None) -> str— check payment/subscription status, optionally filtered by nameprogram_stats() -> str— dashboard numbers (registered, active, overdue, team counts)Files to delete:
app/confirmation.py— write confirmation state machine not needed for V1 read-only modeFiles NOT to touch:
app/basketball.py— Keycloak client stays as-isapp/groupme.py— webhook handler stays as-is (it calls process_message which we're changing internally)Tool Schemas
search_player:
list_roster:
payment_status:
program_stats:
Acceptance Criteria
Test Expectations
pytest tests/Constraints
Checklist
Related
project-westside-ai-assistantScope Review: NEEDS_REFINEMENT
Review note:
review-749-2026-04-03Template complete but scope is borderline oversized.
app/confirmation.pyto File Targets as "File to delete"Re-review: APPROVED (review note:
review-749-2026-04-03-r2)Fixes applied to issue body:
app/confirmation.pyto File Targets as "Files to delete" — was only in Context beforerequirements.txt / pyproject.toml→requirements.txt(no pyproject.toml in this repo)Decomposition decision: keeping as one ticket — 8 AC are all testable, tool schemas are pre-defined, and splitting would force a second ticket to re-modify ai.py. One logical feature, one agent pass.
Remaining discovered scope: arch-A2 note missing (tracked separately, not a blocker).
Ticket is ready for dispatch.