mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
treat litellm.exceptions.BadRequestError as a 400 error and do not retry
This commit is contained in:
parent
3469e04eb8
commit
a3a4d87a0c
2 changed files with 6 additions and 8 deletions
|
@ -11,6 +11,7 @@ from json.decoder import JSONDecodeError
|
|||
from pathlib import Path
|
||||
|
||||
import git
|
||||
import litellm
|
||||
import openai
|
||||
from jsonschema import Draft7Validator
|
||||
from rich.console import Console, Text
|
||||
|
@ -28,6 +29,8 @@ from aider.utils import is_image_file
|
|||
|
||||
from ..dump import dump # noqa: F401
|
||||
|
||||
litellm.suppress_debug_info = True
|
||||
|
||||
|
||||
class MissingAPIKeyError(ValueError):
|
||||
pass
|
||||
|
@ -572,6 +575,9 @@ class Coder:
|
|||
interrupted = True
|
||||
except ExhaustedContextWindow:
|
||||
exhausted = True
|
||||
except litellm.exceptions.BadRequestError as err:
|
||||
self.io.tool_error(f"BadRequestError: {err}")
|
||||
return
|
||||
except openai.BadRequestError as err:
|
||||
if "maximum context length" in str(err):
|
||||
exhausted = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue