function calling & viewable CoT

This commit is contained in:
Xory 2025-08-06 18:39:20 +03:00
parent bbb6581c74
commit 5d121ab700

12
main.py
View file

@ -26,6 +26,7 @@ while True:
tools=tools, stream=True)
ran_tool = False
saw_content = False
for chunk in stream:
msg = chunk.message
@ -42,9 +43,14 @@ while True:
})
ran_tool = True
# 2⃣ normal user-visible text
elif msg.content:
print(msg.content, end="", flush=True)
if msg.thinking:
print(f"\033[90m{msg.thinking}", end="", flush=True)
if msg.content:
if not saw_content:
print("")
saw_content = True
print(f"\033[97m{msg.content}", end="", flush=True)
# loop again if we just satisfied a tool call
if not ran_tool: