feat: enable retries for OpenRouter choices errors

This commit is contained in:
Paul Gauthier (aider) 2025-03-27 07:01:10 -10:00
parent fd180ebff5
commit 673acf4308
2 changed files with 2 additions and 2 deletions

View file

@ -85,6 +85,6 @@ class LiteLLMExceptions:
return ExInfo("APIConnectionError", False, "You need to: pip install boto3")
if "OpenrouterException" in str(ex) and "'choices'" in str(ex):
return ExInfo(
"APIConnectionError", False, "The OpenRouter API provider is down or offline"
"APIConnectionError", True, "The OpenRouter API provider is down or offline"
)
return self.exceptions.get(ex.__class__, ExInfo(None, None, None))

View file

@ -78,5 +78,5 @@ def test_openrouter_error():
)
ex_info = ex.get_ex_info(openrouter_error)
assert ex_info.retry is False
assert ex_info.retry is True
assert "OpenRouter API provider is down" in ex_info.description