Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Azure] CLI: Add support for azure openai chat completion API #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions openai/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def create(cls, args):
resp = openai.ChatCompletion.create(
# Required
model=args.model,
engine=args.engine,
messages=messages,
# Optional
n=args.n,
Expand Down Expand Up @@ -714,12 +715,6 @@ def help(args):
req = sub.add_argument_group("required arguments")
opt = sub.add_argument_group("optional arguments")

req.add_argument(
"-m",
"--model",
help="The model to use.",
required=True,
)
req.add_argument(
"-g",
"--message",
Expand All @@ -729,6 +724,19 @@ def help(args):
help="A message in `{role} {content}` format. Use this argument multiple times to add multiple messages.",
required=True,
)

group = opt.add_mutually_exclusive_group()
group.add_argument(
"-e",
"--engine",
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.",
)
group.add_argument(
"-m",
"--model",
help="The model to use.",
)

opt.add_argument(
"-n",
"--n",
Expand Down