|
|
@ -1188,9 +1188,15 @@ class Agent:
|
|
|
|
f"[Structured Output] [Time: {time.strftime('%H:%M:%S')}] \n\n {json.dumps(response, indent=4)}",
|
|
|
|
f"[Structured Output] [Time: {time.strftime('%H:%M:%S')}] \n\n {json.dumps(response, indent=4)}",
|
|
|
|
loop_count,
|
|
|
|
loop_count,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
elif self.streaming_on:
|
|
|
|
elif self.streaming_on and isinstance(response, dict) and response.get("choices"):
|
|
|
|
pass
|
|
|
|
# Handle streaming tool calls structured output
|
|
|
|
else:
|
|
|
|
tool_calls = response.get("choices", [{}])[0].get("message", {}).get("tool_calls", [])
|
|
|
|
|
|
|
|
if tool_calls:
|
|
|
|
|
|
|
|
self.pretty_print(
|
|
|
|
|
|
|
|
f"[Structured Output] [Time: {time.strftime('%H:%M:%S')}] \n\n {json.dumps(tool_calls, indent=4)}",
|
|
|
|
|
|
|
|
loop_count,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
elif not self.streaming_on:
|
|
|
|
self.pretty_print(
|
|
|
|
self.pretty_print(
|
|
|
|
response, loop_count
|
|
|
|
response, loop_count
|
|
|
|
)
|
|
|
|
)
|
|
|
|