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: Frequent speech cutoff during chat

Clémence Lesné91b583ebbc33
diff --git a/helpers/call_llm.py b/helpers/call_llm.py
index a5364e9..ac5c29c 100644
--- a/helpers/call_llm.py
+++ b/helpers/call_llm.py
@@ -301,7 +301,7 @@ async def _execute_llm_chat(
tool_calls_buffer: dict[int, MessageToolModel] = {}
try:
async for delta in completion_stream(
- max_tokens=133, # Lowest possible value for 90% of the cases, if not sufficient, retry will be triggered, 100 tokens ~= 75 words, 20 words ~= 1 sentence, 5 sentences ~= 133 tokens
+ max_tokens=160, # Lowest possible value for 90% of the cases, if not sufficient, retry will be triggered, 100 tokens ~= 75 words, 20 words ~= 1 sentence, 6 sentences ~= 160 tokens
messages=call.messages,
system=system,
tools=tools,