catch 404s from azure on models.list

This commit is contained in:
Paul Gauthier 2023-12-07 07:44:21 -08:00
parent ad092152d0
commit cab7460f94
2 changed files with 9 additions and 2 deletions

View file

@ -953,7 +953,14 @@ class Coder:
def check_model_availability(io, client, main_model):
try:
available_models = client.models.list()
except openai.NotFoundError:
# Azure sometimes returns 404?
# https://discord.com/channels/1131200896827654144/1182327371232186459
io.tool_error("Unable to list available models, proceeding with {main_model.name}")
return True
model_ids = sorted(model.id for model in available_models)
if main_model.name in model_ids:
return True

View file

@ -30,7 +30,7 @@ from aider.coders import Coder
from aider.dump import dump # noqa: F401
from aider.io import InputOutput
BENCHMARK_DNAME = Path(os.environ["AIDER_BENCHMARK_DIR"])
BENCHMARK_DNAME = Path(os.environ.get("AIDER_BENCHMARK_DIR", "tmp.benchmarks"))
ORIGINAL_DNAME = BENCHMARK_DNAME / "exercism-python"