mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
refactor: split error and retry messages in simple_send_with_retries
This commit is contained in:
parent
3baad86afd
commit
907c1dbe2b
2 changed files with 2 additions and 4 deletions
|
@ -118,10 +118,11 @@ def simple_send_with_retries(model_name, messages, extra_params=None):
|
||||||
_hash, response = send_completion(**kwargs)
|
_hash, response = send_completion(**kwargs)
|
||||||
return response.choices[0].message.content
|
return response.choices[0].message.content
|
||||||
except retry_exceptions() as err:
|
except retry_exceptions() as err:
|
||||||
|
print(str(err))
|
||||||
retry_delay *= 2
|
retry_delay *= 2
|
||||||
if retry_delay > RETRY_TIMEOUT:
|
if retry_delay > RETRY_TIMEOUT:
|
||||||
break
|
break
|
||||||
print(f"{str(err)}\nRetrying in {retry_delay:.1f} seconds...")
|
print(f"Retrying in {retry_delay:.1f} seconds...")
|
||||||
time.sleep(retry_delay)
|
time.sleep(retry_delay)
|
||||||
continue
|
continue
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|
|
@ -6,9 +6,6 @@ import httpx
|
||||||
from aider.llm import litellm
|
from aider.llm import litellm
|
||||||
from aider.sendchat import retry_exceptions, simple_send_with_retries
|
from aider.sendchat import retry_exceptions, simple_send_with_retries
|
||||||
|
|
||||||
# ai: fix these test errors! it should not test for 2 print() calls!
|
|
||||||
FAILED tests/basic/test_sendchat.py::TestSendChat::test_simple_send_with_retries_connection_error - AssertionError: Expected 'print' to have been called once. Called 2 times.
|
|
||||||
FAILED tests/basic/test_sendchat.py::TestSendChat::test_simple_send_with_retries_rate_limit_error - AssertionError: Expected 'print' to have been called once. Called 2 times.
|
|
||||||
|
|
||||||
class PrintCalled(Exception):
|
class PrintCalled(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue