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: Empty streaming chuncks with GPT-4 Turbo

Clémence Lesnée5f4af9292dc
diff --git a/helpers/llm.py b/helpers/llm.py
index 5cd096f..b2e9f1e 100644
--- a/helpers/llm.py
+++ b/helpers/llm.py
@@ -99,7 +99,8 @@ async def completion_stream(
**extra,
)
async for chunck in stream:
- yield chunck.choices[0].delta
+ if chunck.choices: # Skip empty chunks, happens with GPT-4 Turbo
+ yield chunck.choices[0].delta
@retry(