MIS 752 · Lab 6 · garrec2
Order the Lab: a tool-calling trace, and what the model said with no tools
One Python function handed to qwen2.5:3b-instruct over ollama. All drug data is synthetic.
The 30-second read
THE MODEL
backend : ollama
model : qwen2.5:3b-instruct
ollama version : 0.34.4
endpoint : http://localhost:11434/v1
knobs : max_tokens 2000 · temperature 0.0 · max_turns 3
total spend : $0.000000
THE DELIVERABLE - drug_tier
question : What is the formulary tier for zephadril, and does it require prior authorisation?
tools ON : path native->prompt-json · 3 call(s) · 99.0 s · 1285 in / 73 out tokens
tools called : get_drug_info
tools OFF : path tools-disabled · 1 call(s) · 0.0 s
grounding ON/OFF : 0.50 / 0.00 (delta +0.50)
claims made OFF : none
WHICH PATH DID THE WORK
traces recorded : 3 (2 with tools on)
paths seen : native->prompt-json, prompt-json
native succeeded : 0 of 2 tools-on traces
model calls : 8 live + 9 replayed from lab06_cache.json + 0 failed
runs w/o answer : 0 of 3 · truncated turns: 0 · hidden reasoning tokens: 0
tools available : 2 (forecast_ed_arrivals, get_drug_info)
The deliverable: the trace
Exactly what the notebook printed, in order: the prompt that was sent, the tool call the model emitted (name and arguments), the JSON the Python function returned, and the final answer built from it. Each stage carries its own latency and token count. The last block states which tool-calling path actually did the work.
============================================================================
TRACE · drug_tier
tools ON · path used: native->prompt-json
model - via - · 3 model call(s) (0 from cache) · 99.0 s · 1285 in / 73 out tokens · $0.000000
============================================================================
[1] PROMPT (turn 0) the question you asked
system : You are a hospital formulary assistant used in a graduate analytics class (MIS 752, Lab 6). You know NOTHING about the drugs or the arrival forecasts in this conversation except what your tools return. Rules: (1) if a tool can answer, call it instead of guessing; (2) never invent a drug fact, a formulary tier, a drug class or a number; (3) if a tool says there is no record, say plainly that there is no record; (4) answer in at most four sentences and name the tool result you are relying on.
user : What is the formulary tier for zephadril, and does it require prior authorisation?
[2] MODEL_TURN (turn 1) model response, turn 1 [0.00 s · 400 in / 25 out tok · native]
[3] PATH_SWITCH (turn 1) native had no usable calls; switching to prompt [native->prompt-json]
[4] MODEL_TURN (turn 2) model response, turn 2 [0.00 s · 319 in / 22 out tok · prompt]
{"tool": "get_drug_info", "arguments": {"name": "zephadril"}}
[5] TOOL_CALL (turn 2) model called: get_drug_info
name : get_drug_info
arguments : {"name": "zephadril"}
raw : {"tool": "get_drug_info", "arguments": {"name": "zephadril"}}
[6] TOOL_RESULT (turn 2) tool executed: get_drug_info [0.00 s]
your function returned, in 0.08 ms:
["{\"drug\": \"zephadril\", \"found\": true, \"synthetic\": true, \"warning\": \"SYNTHETIC TEACHING STUB -- these drug names are fictional and every value this stub returns was invented for MIS 752 Lab 6. Inside this lab the stub's answer is authoritative; outside it, nothing here is real. Never use for a clinical decision.\", \"source\": \"MIS 752 Lab 6 invented formulary v1\", \"drug_class\": \"invented class 7A (teaching placeholder)\", \"route\": \"oral\", \"formulary_tier\": 3, \"prior_auth_required\": true, \"supply_days_per_fill\": 30, \"monitoring\": \"stub-monitor-1 (invented label)\", \"interaction_flags\": [\"renavex\", \"cardiomyst\"]}", 5.8210999668517616e-05]
[7] MODEL_TURN (turn 3) model response, turn 3 [98.98 s · 566 in / 26 out tok · prompt]
{"final_answer": "The formulary tier for zephadril is 3 and it requires prior authorisation."}
[8] ANSWER (turn 3) model's final answer
The formulary tier for zephadril is 3 and it requires prior authorisation.
----------------------------------------------------------------------------
PATH PROVENANCE: native->prompt-json
The NATIVE path produced no usable tool call, so the loop retried the same
question on the prompt-based JSON protocol -- and that is what worked.
This is common on small local models and is exactly why Step 2 exists.
TOOLS CALLED: get_drug_info
============================================================================
With no way to look it up, the model stayed vague
The same question, the same model, with tools switched off.
============================================================================
TRACE · drug_tier
tools OFF · path used: tools-disabled
model - via - · 1 model call(s) (0 from cache) · 0.0 s · 319 in / 22 out tokens · $0.000000
============================================================================
[1] PROMPT (turn 0) the question you asked
system : You are a hospital formulary assistant used in a graduate analytics class (MIS 752, Lab 6). You know NOTHING about the drugs or the arrival forecasts in this conversation except what your tools return. Rules: (1) if a tool can answer, call it instead of guessing; (2) never invent a drug fact, a formulary tier, a drug class or a number; (3) if a tool says there is no record, say plainly that there is no record; (4) answer in at most four sentences and name the tool result you are relying on.
TOOL PROTOCOL. You may call these tools:
- get_drug_info(name: string)
Look up one drug in the MIS ...[+538 chars]
user : What is the formulary tier for zephadril, and does it require prior authorisation?
[2] MODEL_TURN (turn 1) model response, turn 1 [0.00 s · 319 in / 22 out tok · prompt]
{"tool": "get_drug_info", "arguments": {"name": "zephadril"}}
[3] ANSWER (turn 1) model's final answer (tools disabled)
{"tool": "get_drug_info", "arguments": {"name": "zephadril"}}
----------------------------------------------------------------------------
PATH PROVENANCE: tools-disabled
Tools were OFF. The model had no way to look anything up, so whatever it
said came from its weights alone. Step 4 scores that against the tools-ON run.
============================================================================
No sweep was run, so there is no grounding comparison
The tools you exposed
The model saw the name, description, and JSON Schema of arguments.
tool arguments description
get_drug_info name Look up one drug in the MIS 752 Lab 6 SYNTHETIC formulary and return its record.
forecast_ed_arrivals shift_date, horizon_days Forecast daily emergency-department arrivals from a start date, N days ahead.
The sweep
the sweep did not run