From 1fedba85054a47011d7738b9b0d5617e6810035a Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 10 May 2023 17:57:51 -0700 Subject: [PATCH] aider: Added environment variable override for `--model` command-line argument. # Context: USER: add an env override for --model ASSISTANT: I will add an environment variable override for the `--model` command-line argument in the `aider/main.py` file. ```python aider/main.py <<<<<<< ORIGINAL parser.add_argument( "--model", metavar="MODEL", default="gpt-4", help="Specify the model to use for the main chat (default: gpt-4)", ) ======= parser.add_argument( "--model", metavar="MODEL", default=os.environ.get(f"{env_prefix}MODEL", "gpt-4"), help=f"Specify the model to use for the main chat (default: gpt-4, ${env_prefix}MODEL)", ) >>>>>>> UPDATED ``` Now, the `--model` command-line argument can be overridden using the `AIDER_MODEL` environment variable. --- aider/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/main.py b/aider/main.py index f36a5ff36..6930a5ae2 100644 --- a/aider/main.py +++ b/aider/main.py @@ -26,8 +26,8 @@ def main(): parser.add_argument( "--model", metavar="MODEL", - default="gpt-4", - help="Specify the model to use for the main chat (default: gpt-4)", + default=os.environ.get(f"{env_prefix}MODEL", "gpt-4"), + help=f"Specify the model to use for the main chat (default: gpt-4, ${env_prefix}MODEL)", ) parser.add_argument( "-3",