From e5e5a8e325c8e57e637a3d6edac0d7cce5f08887 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 8 May 2023 23:10:25 -0700 Subject: [PATCH] Add `--model MODEL` arg and modify `-3` and `-4` args to store `gpt-3-5-turbo` and `gpt-4` in `model` arg. # Context: USER: add a --model MODEL arg, and change -3 to store 'gpt-3-5-turbo' in the model arg. add a new arg -4 which stores 'gpt-4' in the model arg. ASSISTANT: To add a `--model MODEL` argument and modify the `-3` and `-4` arguments, you can update the `main` function as follows: ```python coder.py <<<<<<< ORIGINAL parser.add_argument( "-3", "--gpt-3-5-turbo", action="store_true", help="Only use gpt-3.5-turbo, not gpt-4", ) ======= parser.add_argument( "--model", metavar="MODEL", default="gpt-3.5-turbo", help="Specify the model to use (default: gpt-3.5-turbo)", ) parser.add_argument( "-3", action="store_const", dest="model", const="gpt-3.5-turbo", help="Use gpt-3.5-turbo model", ) parser.add_argument( "-4", action="store_const", dest="model", const="gpt-4", help="Use gpt-4 model", ) >>>>>>> UPDATED ``` This change adds the `--model MODEL` argument, modifies the `-3` argument to store `'gpt-3-5-turbo'` in the `model` argument, and adds a new `-4` argument to store `'gpt-4'` in the `model` argument. --- coder.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/coder.py b/coder.py index 75ab1a773..9769b579f 100755 --- a/coder.py +++ b/coder.py @@ -575,11 +575,25 @@ def main(): parser.add_argument( "files", metavar="FILE", nargs="+", help="a list of source code files", ) + parser.add_argument( + "--model", + metavar="MODEL", + default="gpt-3.5-turbo", + help="Specify the model to use (default: gpt-3.5-turbo)", + ) parser.add_argument( "-3", - "--gpt-3-5-turbo", - action="store_true", - help="Only use gpt-3.5-turbo, not gpt-4", + action="store_const", + dest="model", + const="gpt-3.5-turbo", + help="Use gpt-3.5-turbo model", + ) + parser.add_argument( + "-4", + action="store_const", + dest="model", + const="gpt-4", + help="Use gpt-4 model", ) parser.add_argument( "--no-pretty", @@ -620,4 +634,4 @@ def main(): if __name__ == "__main__": status = main() - sys.exit(status) + sys.exit(status) \ No newline at end of file