Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!
Python
fix: Try to retry when LLM answer nothing
Clémence Lesné2bea55b69ad7
diff --git a/main.py b/main.pyindex 2ceb4c2..0c4f173 100644--- a/main.py+++ b/main.py@@ -943,6 +943,15 @@ async def llm_chat(_logger.debug(f"Chat response: {full_content}")_logger.debug(f"Tool calls: {tool_calls}")+ # OpenAI GPT-4 Turbo tends to return empty content, in that case, retry within limits+ if not full_content:+ _logger.debug(f"Empty content, retrying")+ if _retry_attempt > 3:+ _logger.warn(f'LLM send back empty content, retry limit reached')+ return await _error_response()+ _logger.warn(f'LLM send back empty content, retrying')+ return await llm_chat(background_tasks, call, user_callback, _retry_attempt + 1)+# OpenAI GPT-4 Turbo sometimes return wrong tools schema, in that case, retry within limits# TODO: Tries to detect this error earlier# See: https://community.openai.com/t/model-tries-to-call-unknown-function-multi-tool-use-parallel/490653