mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
retry on Timeout
This commit is contained in:
parent
039adfd346
commit
bc7610cdda
2 changed files with 11 additions and 5 deletions
|
@ -12,7 +12,7 @@ import backoff
|
||||||
import git
|
import git
|
||||||
import openai
|
import openai
|
||||||
import requests
|
import requests
|
||||||
from openai.error import APIError, RateLimitError, ServiceUnavailableError
|
from openai.error import APIError, RateLimitError, ServiceUnavailableError, Timeout
|
||||||
from rich.console import Console, Text
|
from rich.console import Console, Text
|
||||||
from rich.live import Live
|
from rich.live import Live
|
||||||
from rich.markdown import Markdown
|
from rich.markdown import Markdown
|
||||||
|
@ -565,7 +565,13 @@ class Coder:
|
||||||
|
|
||||||
@backoff.on_exception(
|
@backoff.on_exception(
|
||||||
backoff.expo,
|
backoff.expo,
|
||||||
(APIError, ServiceUnavailableError, RateLimitError, requests.exceptions.ConnectionError),
|
(
|
||||||
|
Timeout,
|
||||||
|
APIError,
|
||||||
|
ServiceUnavailableError,
|
||||||
|
RateLimitError,
|
||||||
|
requests.exceptions.ConnectionError,
|
||||||
|
),
|
||||||
max_tries=5,
|
max_tries=5,
|
||||||
on_backoff=lambda details: print(f"Retry in {details['wait']} seconds."),
|
on_backoff=lambda details: print(f"Retry in {details['wait']} seconds."),
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,7 +9,7 @@ You can use aider to ask GPT to add features, write tests or make other changes
|
||||||
improvements to your code.
|
improvements to your code.
|
||||||
|
|
||||||
Having a reliable way for GPT to edit
|
Having a reliable way for GPT to edit
|
||||||
local source code files is a critical component of this functionality.
|
local source code files is a critical to providing this functionality.
|
||||||
Making code editing more reliable often
|
Making code editing more reliable often
|
||||||
involves changing and experimenting with
|
involves changing and experimenting with
|
||||||
the "edit format" that aider uses.
|
the "edit format" that aider uses.
|
||||||
|
@ -40,8 +40,8 @@ I ran this code editing benchmark
|
||||||
on almost all the ChatGPT models, using a variety of edit formats.
|
on almost all the ChatGPT models, using a variety of edit formats.
|
||||||
This produced some interesting results:
|
This produced some interesting results:
|
||||||
|
|
||||||
- Asking GPT to just return an updated copy of the whole file in a normal fenced code block is by far the most reliable and effective edit format. This is true across all GPT-3.5 and GPT-4 models.
|
- Asking GPT to return an updated copy of the whole file in a normal markdown fenced code block is by far the most reliable and effective edit format. This is true across all GPT-3.5 and GPT-4 models.
|
||||||
- Using the new function calling API is worse than the above whole file method, for all models. GPT writes worse code and frequently mangles this output format, even though OpenAI introduced the function calling API to make structured output formatting more reliable. This was a big surprise.
|
- Using the new function calling API is worse than the above whole file method, for all models. GPT writes worse code and frequently mangles this output format, even though the function calling API was introduced to make structured outputs more reliable. This was a big surprise.
|
||||||
- The new June (`0613`) versions of `gpt-3.5-turbo` are worse at code editing than the older February (`0301`) version. This was unexpected.
|
- The new June (`0613`) versions of `gpt-3.5-turbo` are worse at code editing than the older February (`0301`) version. This was unexpected.
|
||||||
- The GPT-4 models are much better at code editing than the GPT-3.5 models, as expected.
|
- The GPT-4 models are much better at code editing than the GPT-3.5 models, as expected.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue