1- from argparse import _SubParsersAction , ArgumentParser
1+ def set_openai_help_str (is_parent = False ):
2+ return f"{ 'in your config' if is_parent else 'as the OPENAI_API_KEY environment variable' } "
23
34
4- def setup_model_list (model_subcommand ):
5+ def set_bot_key_help_str (is_parent = False ):
6+ return f"{ 'in your config' if is_parent else 'as the DISCORD_BOT_TOKEN environment variable' } "
7+
8+
9+ def setup_model_list (model_subcommand , is_parent = False ):
510 model_list = model_subcommand .add_parser (
6- "list" , description = "List your openAi customized models"
11+ "list" , help = "List your openAi customized models"
712 )
813 model_list_required_named = model_list .add_argument_group (
914 "required named arguments"
@@ -17,7 +22,7 @@ def setup_model_list(model_subcommand):
1722 "--openai-key" ,
1823 type = str ,
1924 dest = "openai_key" ,
20- help = "The openAI API key to list the models for. Must either be passed in as an argument or set as an environment variable " ,
25+ help = f "The openAI API key to list the models for. Must either be passed in as an argument or set { set_openai_help_str ( is_parent ) } " ,
2126 )
2227 model_list_optional_named .add_argument (
2328 "--full" ,
@@ -28,10 +33,10 @@ def setup_model_list(model_subcommand):
2833 )
2934
3035
31- def setup_model_create (model_subcommand ):
36+ def setup_model_create (model_subcommand , is_parent = False ):
3237 model_create = model_subcommand .add_parser (
3338 "create" ,
34- description = "Create a new openAI customized model by downloading the specified chat logs, parsing them into a usable dataset, and then training a customized model using openai" ,
39+ help = "Create a new openAI customized model by downloading the specified chat logs, parsing them into a usable dataset, and then training a customized model using openai" ,
3540 )
3641 model_create_required_named = model_create .add_argument_group (
3742 "required named arguments"
@@ -45,14 +50,14 @@ def setup_model_create(model_subcommand):
4550 "--discord-token" ,
4651 type = str ,
4752 dest = "discord_token" ,
48- help = "The discord token for your bot. Must either be passed in as an argument or set as an environment variable " ,
53+ help = f "The discord token for your bot. Must either be passed in as an argument or set { set_bot_key_help_str ( is_parent ) } " ,
4954 )
5055 model_create_required_named .add_argument (
5156 "-o" ,
5257 "--openai-key" ,
5358 type = str ,
5459 dest = "openai_key" ,
55- help = "The openAI API key to use to create the model. Must either be passed in as an argument or set as an environment variable " ,
60+ help = f "The openAI API key to use to create the model. Must either be passed in as an argument or set { set_openai_help_str ( is_parent ) } " ,
5661 )
5762 model_create_required_named .add_argument (
5863 "-c" ,
@@ -164,10 +169,10 @@ def setup_model_create(model_subcommand):
164169 )
165170
166171
167- def setup_model_delete (model_subcommand ):
172+ def setup_model_delete (model_subcommand , is_parent = False ):
168173 model_delete = model_subcommand .add_parser (
169174 "delete" ,
170- description = "Delete an openAI customized model" ,
175+ help = "Delete an openAI customized model" ,
171176 )
172177 model_delete_required_named = model_delete .add_argument_group (
173178 "required named arguments"
@@ -178,7 +183,7 @@ def setup_model_delete(model_subcommand):
178183 "--openai-key" ,
179184 type = str ,
180185 dest = "openai_key" ,
181- help = "The openAI API key associated with the model to delete. Must either be passed in as an argument or set as an environment variable " ,
186+ help = f "The openAI API key associated with the model to delete. Must either be passed in as an argument or set { set_openai_help_str ( is_parent ) } " ,
182187 )
183188 model_delete_required_named .add_argument (
184189 "-m" ,
@@ -190,9 +195,9 @@ def setup_model_delete(model_subcommand):
190195 )
191196
192197
193- def setup_job_list (job_subcommand ):
198+ def setup_job_list (job_subcommand , is_parent = False ):
194199 job_list = job_subcommand .add_parser (
195- "list" , description = "List your openAI customization jobs"
200+ "list" , help = "List your openAI customization jobs"
196201 )
197202 job_list_required_named = job_list .add_argument_group ("required named arguments" )
198203 job_list_optional_named = job_list .add_argument_group ("optional named arguments" )
@@ -202,7 +207,7 @@ def setup_job_list(job_subcommand):
202207 "--openai-key" ,
203208 type = str ,
204209 dest = "openai_key" ,
205- help = "The openAI API key to list the jobs for. Must either be passed in as an argument or set as an environment variable " ,
210+ help = f "The openAI API key to list the jobs for. Must either be passed in as an argument or set { set_openai_help_str ( is_parent ) } " ,
206211 )
207212 job_list_optional_named .add_argument (
208213 "--full" ,
@@ -213,9 +218,9 @@ def setup_job_list(job_subcommand):
213218 )
214219
215220
216- def setup_job_info (job_subcommand ):
221+ def setup_job_info (job_subcommand , is_parent = False ):
217222 job_info = job_subcommand .add_parser (
218- "info" , description = "Get an openAI customization job's info"
223+ "info" , help = "Get an openAI customization job's info"
219224 )
220225 job_info_required_named = job_info .add_argument_group ("required named arguments" )
221226
@@ -224,7 +229,7 @@ def setup_job_info(job_subcommand):
224229 "--openai-key" ,
225230 type = str ,
226231 dest = "openai_key" ,
227- help = "The openAI API key associated with the job to see the info for. Must either be passed in as an argument or set as an environment variable " ,
232+ help = f "The openAI API key associated with the job to see the info for. Must either be passed in as an argument or set { set_openai_help_str ( is_parent ) } " ,
228233 )
229234 job_info_required_named .add_argument (
230235 "-j" ,
@@ -236,9 +241,9 @@ def setup_job_info(job_subcommand):
236241 )
237242
238243
239- def setup_job_events (job_subcommand ):
244+ def setup_job_events (job_subcommand , is_parent = False ):
240245 job_events = job_subcommand .add_parser (
241- "events" , description = "Get an openAI customization job's events"
246+ "events" , help = "Get an openAI customization job's events"
242247 )
243248 job_events_required_named = job_events .add_argument_group (
244249 "required named arguments"
@@ -249,7 +254,7 @@ def setup_job_events(job_subcommand):
249254 "--openai-key" ,
250255 type = str ,
251256 dest = "openai_key" ,
252- help = "The openAI API key associated with the job to see the events for. Must either be passed in as an argument or set as an environment variable " ,
257+ help = f "The openAI API key associated with the job to see the events for. Must either be passed in as an argument or set { set_openai_help_str ( is_parent ) } " ,
253258 )
254259 job_events_required_named .add_argument (
255260 "-j" ,
@@ -261,9 +266,9 @@ def setup_job_events(job_subcommand):
261266 )
262267
263268
264- def setup_job_cancel (job_subcommand ):
269+ def setup_job_cancel (job_subcommand , is_parent = False ):
265270 job_cancel = job_subcommand .add_parser (
266- "cancel" , description = "Cancel an openAI customization job"
271+ "cancel" , help = "Cancel an openAI customization job"
267272 )
268273 job_cancel_required_named = job_cancel .add_argument_group (
269274 "required named arguments"
@@ -274,7 +279,7 @@ def setup_job_cancel(job_subcommand):
274279 "--openai-key" ,
275280 type = str ,
276281 dest = "openai_key" ,
277- help = "The openAI API key associated with the job to cancel. Must either be passed in as an argument or set as an environment variable " ,
282+ help = f "The openAI API key associated with the job to cancel. Must either be passed in as an argument or set { set_openai_help_str ( is_parent ) } " ,
278283 )
279284 job_cancel_required_named .add_argument (
280285 "-j" ,
0 commit comments