From 5c1094405452cd4faef776ab79bf6b8caba2787d Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 11 Apr 2024 06:42:38 -0700 Subject: [PATCH] Abstract the default model name so it applies to scripting #537 --- aider/coders/base_coder.py | 2 +- aider/main.py | 2 +- aider/models/__init__.py | 2 ++ docs/faq.md | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index 557cc83ad..1285cb99c 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -69,7 +69,7 @@ class Coder: from . import EditBlockCoder, UnifiedDiffCoder, WholeFileCoder if not main_model: - main_model = models.GPT4 + main_model = models.Model.create(models.DEFAULT_MODEL_NAME) if not skip_model_availabily_check and not main_model.always_available: if not check_model_availability(io, client, main_model): diff --git a/aider/main.py b/aider/main.py index 0dd6394bf..27efbf7a3 100644 --- a/aider/main.py +++ b/aider/main.py @@ -159,7 +159,7 @@ def main(argv=None, input=None, output=None, force_git_root=None): env_var="OPENAI_API_KEY", help="Specify the OpenAI API key", ) - default_model = "gpt-4-1106-preview" + default_model = models.DEFAULT_MODEL_NAME core_group.add_argument( "--model", metavar="MODEL", diff --git a/aider/models/__init__.py b/aider/models/__init__.py index a07fdb0f2..2b8a335f2 100644 --- a/aider/models/__init__.py +++ b/aider/models/__init__.py @@ -6,6 +6,8 @@ GPT4 = Model.create("gpt-4") GPT35 = Model.create("gpt-3.5-turbo") GPT35_0125 = Model.create("gpt-3.5-turbo-0125") +DEFAULT_MODEL_NAME = "gpt-4-1106-preview" + __all__ = [ OpenAIModel, OpenRouterModel, diff --git a/docs/faq.md b/docs/faq.md index ee0e5d76f..a041f6e3a 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -258,6 +258,7 @@ User `aider --help` to see all the command line options, but these are useful fo You can also script aider from python: ```python +import os import openai from aider.coders import Coder