mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
Auto fallback to 3.5
This commit is contained in:
parent
1b046e8111
commit
1f2aa1a6c8
1 changed files with 9 additions and 5 deletions
|
@ -31,9 +31,8 @@ class Coder:
|
|||
|
||||
def check_model_availability(self, main_model):
|
||||
available_models = openai.Model.list()
|
||||
model_ids = [model.id for model in available_models['data']]
|
||||
if main_model not in model_ids:
|
||||
raise ValueError(f"Model {main_model} is not available. Please choose from the available models: {model_ids}")
|
||||
model_ids = [model.id for model in available_models["data"]]
|
||||
return main_model in model_ids
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -70,11 +69,16 @@ class Coder:
|
|||
self.console = Console(force_terminal=True, no_color=True)
|
||||
|
||||
self.commands = Commands(self.io, self)
|
||||
self.check_model_availability(main_model)
|
||||
if not self.check_model_availability(main_model):
|
||||
self.io.tool_error(
|
||||
f"Your openai key does not support {main_model}, using gpt-3.5-turbo."
|
||||
)
|
||||
main_model = "gpt-3.5-turbo"
|
||||
|
||||
self.main_model = main_model
|
||||
if main_model == "gpt-3.5-turbo":
|
||||
self.io.tool_error(
|
||||
f"aider doesn't work well with {main_model}, use gpt-4 for best results."
|
||||
f"Aider doesn't work well with {main_model}, use gpt-4 for best results."
|
||||
)
|
||||
|
||||
self.set_repo(fnames)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue