-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_tools.py
More file actions
24 lines (20 loc) · 905 Bytes
/
Copy pathdebug_tools.py
File metadata and controls
24 lines (20 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Run one MTSamples record through the coder and print every chunk type."""
import csv
import daimon_client as daimon
with open("data/mtsamples.csv", encoding="utf-8") as f:
row = next(r for r in csv.DictReader(f) if (r.get("transcription") or "").strip())
text = row["transcription"].strip()[:2000] # truncate for speed
print(f"Sample: {row.get('sample_name', '').strip()}\n{'─'*60}")
with daimon.Client(base_url="http://localhost:3500") as client:
for chunk in client.llm("coder").converse(
messages=[{"role": "user", "content": text}]
):
if chunk.type == "tool_call":
tc = chunk.tool_call
print(f"\n→ TOOL: {tc.name}")
print(f" input: {tc.input}")
elif chunk.type == "text":
print(chunk.text, end="", flush=True)
elif chunk.type == "error":
print(f"\n[ERROR] {chunk.error}")
print("\n")