Skip to content

Commit ed821c8

Browse files
authored
add support for azure openai api (#359)
1 parent 39cdc66 commit ed821c8

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

openai/cli.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def create(cls, args):
123123
resp = openai.ChatCompletion.create(
124124
# Required
125125
model=args.model,
126+
engine=args.engine,
126127
messages=messages,
127128
# Optional
128129
n=args.n,
@@ -714,12 +715,6 @@ def help(args):
714715
req = sub.add_argument_group("required arguments")
715716
opt = sub.add_argument_group("optional arguments")
716717

717-
req.add_argument(
718-
"-m",
719-
"--model",
720-
help="The model to use.",
721-
required=True,
722-
)
723718
req.add_argument(
724719
"-g",
725720
"--message",
@@ -729,6 +724,19 @@ def help(args):
729724
help="A message in `{role} {content}` format. Use this argument multiple times to add multiple messages.",
730725
required=True,
731726
)
727+
728+
group = opt.add_mutually_exclusive_group()
729+
group.add_argument(
730+
"-e",
731+
"--engine",
732+
help="The engine to use. See https://learn.microsoft.com/en-us/azure/cognitive-services/openai/chatgpt-quickstart?pivots=programming-language-python for more about what engines are available.",
733+
)
734+
group.add_argument(
735+
"-m",
736+
"--model",
737+
help="The model to use.",
738+
)
739+
732740
opt.add_argument(
733741
"-n",
734742
"--n",

0 commit comments

Comments
 (0)