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

chore: Remove dead code

Clémence Lesné5657cc20d8cd
diff --git a/helpers/call_llm.py b/helpers/call_llm.py
index 26877f0..8335928 100644
--- a/helpers/call_llm.py
+++ b/helpers/call_llm.py
@@ -19,7 +19,6 @@ from helpers.call_utils import (
handle_recognize_text,
tts_sentence_split,
)
-from httpx import ReadError
from fastapi import BackgroundTasks
from helpers.llm_tools import LlmPlugins
import asyncio
@@ -60,8 +59,6 @@ async def llm_completion(text: Optional[str], call: CallModel) -> Optional[str]:
messages=call.messages,
system=system,
)
- except ReadError:
- _logger.warning("Network error", exc_info=True)
except APIError as e:
_logger.warning(f"OpenAI API call error: {e}")
except SafetyCheckError as e:
@@ -93,8 +90,6 @@ async def llm_model(
model=model,
system=system,
)
- except ReadError:
- _logger.warning("Network error", exc_info=True)
except APIError as e:
_logger.warning(f"OpenAI API call error: {e}")
@@ -399,9 +394,6 @@ async def _execute_llm_chat(
):
content_buffer_pointer += len(sentence)
plugins.style = await _content_callback(sentence, plugins.style)
- except ReadError:
- _logger.warning("Network error", exc_info=True)
- return True, True, should_user_answer, call
except APIError as e:
_logger.warning(f"OpenAI API call error: {e}")
return True, True, should_user_answer, call
diff --git a/helpers/llm_worker.py b/helpers/llm_worker.py
index 3b70c3d..9ba95b2 100644
--- a/helpers/llm_worker.py
+++ b/helpers/llm_worker.py
@@ -29,7 +29,6 @@ from tenacity import (
retry_if_exception_type,
)
from typing import AsyncGenerator, Optional, Tuple, Type, TypeVar, Union
-from httpx import ReadError
from models.message import MessageModel
import tiktoken
import json
@@ -122,7 +121,6 @@ async def completion_stream(
retry_if_exception_type(SafetyCheckError)
| retry_if_exception_type(APIError)
| retry_if_exception_type(RateLimitError)
- | retry_if_exception_type(ReadError)
),
stop=stop_after_attempt(3),
wait=wait_random_exponential(multiplier=0.5, max=30),