You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Feature]: Give the assistant a tool registry, per-call records and an eval script
Background
The assistant answers prescribers' questions from medical literature, but we couldn't see which tools it called, whether they failed, or what each answer cost. A failed search could quietly become a confident, unsupported answer.
Existing Behavior
server/api/views/assistant/ has one hard-wired search tool, and run_assistant returns only (text, response_id). The eval script records just the answer text.
Acceptance Criteria
Tools are registered in one list and dispatched by name. Each call is recorded with its arguments, output, and OK / FAILED / UNREGISTERED status.
Token usage is recorded for each OpenAI call, and the eval CSV has per-question totals and tool error counts.
Tests cover the riskiest loop behaviour, and the API's response shape is unchanged.
Approach
Split the loop into agentic_loop.py, with typed records in assistant_types.py. Make search failures raise so they're recorded as FAILED, and build the eval CSV from the new records.
References
PR #524, OpenAI Responses API function calling, and the PR's "Future work" section for what was deferred.
Risks and Rollback
Low: the endpoint's request and response are unchanged, and ask_database is not registered. To roll back, revert the merge commit.
Activity
Merge pull request #524 from sahilds1/521-research-agent-tools