function calling & viewable CoT
This commit is contained in:
parent
bbb6581c74
commit
5d121ab700
1 changed files with 9 additions and 3 deletions
12
main.py
12
main.py
|
|
@ -26,6 +26,7 @@ while True:
|
||||||
tools=tools, stream=True)
|
tools=tools, stream=True)
|
||||||
|
|
||||||
ran_tool = False
|
ran_tool = False
|
||||||
|
saw_content = False
|
||||||
for chunk in stream:
|
for chunk in stream:
|
||||||
msg = chunk.message
|
msg = chunk.message
|
||||||
|
|
||||||
|
|
@ -42,9 +43,14 @@ while True:
|
||||||
})
|
})
|
||||||
ran_tool = True
|
ran_tool = True
|
||||||
|
|
||||||
# 2️⃣ normal user-visible text
|
if msg.thinking:
|
||||||
elif msg.content:
|
print(f"\033[90m{msg.thinking}", end="", flush=True)
|
||||||
print(msg.content, 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
|
# loop again if we just satisfied a tool call
|
||||||
if not ran_tool:
|
if not ran_tool:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue