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: Sync LLM generations returns something

Clémence Lesné602d9a1bffe4
diff --git a/helpers/llm_worker.py b/helpers/llm_worker.py
index a1cf4bb..f35aa0e 100644
--- a/helpers/llm_worker.py
+++ b/helpers/llm_worker.py
@@ -315,10 +315,9 @@ async def _completion_sync_worker(
)
if choice.finish_reason == "length":
raise MaximumTokensReachedError(f"Maximum tokens reached {max_tokens}")
- content = choice.message.content
- if not content:
- return None
+ content = choice.message.content
+ return content or None
@retry(