Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

fix: Multi-tools are not took from stream LLM

Clémence Lesnéd093932d6ceb
diff --git a/main.py b/main.py
index d83c1b9..0326318 100644
--- a/main.py
+++ b/main.py
@@ -800,8 +800,7 @@ async def gpt_chat(
tools=tools,
):
if delta.content is None:
- if delta.tool_calls:
- piece = delta.tool_calls[0]
+ for piece in delta.tool_calls or []:
tool_calls[piece.index] = tool_calls.get(
piece.index,
{
@@ -823,7 +822,6 @@ async def gpt_chat(
else:
# Store whole content
full_content += delta.content
- # Batch user return by sentence
buffer_content += delta.content
# Remove tool calls from buffer content, if any
buffer_content = _remove_message_actions(buffer_content)