From bfba56c5f1e328c9237986d401c03ea921daee96 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 13 May 2024 10:57:26 -0700 Subject: [PATCH] added 4o as default --- aider/args.py | 13 ++++++++++++- aider/models.py | 18 ++++++++++++++++-- docs/llms.md | 2 +- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/aider/args.py b/aider/args.py index 9f9c3067f..a8f4601d3 100644 --- a/aider/args.py +++ b/aider/args.py @@ -67,6 +67,14 @@ def get_parser(default_config_files, git_root): const=gpt_4_model, help=f"Use {gpt_4_model} model for the main chat", ) + gpt_4o_model = "openai/gpt-4o" + group.add_argument( + "--4o", + action="store_const", + dest="model", + const=gpt_4o_model, + help=f"Use {gpt_4o_model} model for the main chat", + ) gpt_4_turbo_model = "gpt-4-turbo" group.add_argument( "--4-turbo-vision", @@ -155,7 +163,10 @@ def get_parser(default_config_files, git_root): "--max-chat-history-tokens", type=int, default=None, - help="Maximum number of tokens to use for chat history. If not specified, uses the model's max_chat_history_tokens.", + help=( + "Maximum number of tokens to use for chat history. If not specified, uses the model's" + " max_chat_history_tokens." + ), ) default_env_file = os.path.join(git_root, ".env") if git_root else ".env" group.add_argument( diff --git a/aider/models.py b/aider/models.py index b15ba2214..975367061 100644 --- a/aider/models.py +++ b/aider/models.py @@ -11,7 +11,7 @@ from PIL import Image from aider.dump import dump # noqa: F401 from aider.litellm import litellm -DEFAULT_MODEL_NAME = "gpt-4-1106-preview" +DEFAULT_MODEL_NAME = "openai/gpt-4o" @dataclass @@ -86,7 +86,7 @@ MODEL_SETTINGS = [ ), ModelSettings( "openai/gpt-4o", - "udiff", + "diff", weak_model_name="gpt-3.5-turbo", use_repo_map=True, send_undo_reply=True, @@ -249,6 +249,20 @@ class Model: except Exception: self.info = dict() + if not self.info and "gpt-4o" in self.name: + self.info = { + "max_tokens": 4096, + "max_input_tokens": 128000, + "max_output_tokens": 4096, + "input_cost_per_token": 5e-06, + "output_cost_per_token": 1.5e-5, + "litellm_provider": "openai", + "mode": "chat", + "supports_function_calling": True, + "supports_parallel_function_calling": True, + "supports_vision": True, + } + # Are all needed keys/params available? res = self.validate_environment() self.missing_keys = res.get("missing_keys") diff --git a/docs/llms.md b/docs/llms.md index dfb382ac5..e94032e3f 100644 --- a/docs/llms.md +++ b/docs/llms.md @@ -76,7 +76,7 @@ pip install aider-chat export OPENAI_API_KEY= # Mac/Linux setx OPENAI_API_KEY # Windows -# GPT-4 Turbo is used by default +# GPT-4o is used by default aider # GPT-4 Turbo with Vision