mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
refactor: Change timeout handling to use float type and global request_timeout
This commit is contained in:
parent
ae6fc41ca9
commit
39855f4d2b
3 changed files with 5 additions and 4 deletions
|
@ -216,7 +216,7 @@ def get_parser(default_config_files, git_root):
|
|||
)
|
||||
group.add_argument(
|
||||
"--timeout",
|
||||
type=int,
|
||||
type=float,
|
||||
default=None,
|
||||
help="Timeout in seconds for API calls (default: None)",
|
||||
)
|
||||
|
|
|
@ -509,8 +509,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
|||
litellm._lazy_module.aclient_session = httpx.AsyncClient(verify=False)
|
||||
|
||||
if args.timeout:
|
||||
litellm._load_litellm()
|
||||
litellm._lazy_module.request_timeout = args.timeout
|
||||
models.request_timeout = args.timeout
|
||||
|
||||
if args.dark_mode:
|
||||
args.user_input_color = "#32FF32"
|
||||
|
|
|
@ -22,6 +22,8 @@ from aider.sendchat import ensure_alternating_roles, sanity_check_messages
|
|||
|
||||
RETRY_TIMEOUT = 60
|
||||
|
||||
request_timeout = 600
|
||||
|
||||
DEFAULT_MODEL_NAME = "gpt-4o"
|
||||
ANTHROPIC_BETA_HEADER = "prompt-caching-2024-07-31,pdfs-2024-09-25"
|
||||
|
||||
|
@ -599,7 +601,7 @@ class Model(ModelSettings):
|
|||
# dump(kwargs)
|
||||
|
||||
hash_object = hashlib.sha1(key)
|
||||
res = litellm.completion(**kwargs)
|
||||
res = litellm.completion(timeout=request_timeout, **kwargs)
|
||||
return hash_object, res
|
||||
|
||||
def remove_reasoning_content(self, res):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue