mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
aider: Add --openai-api-type, --openai-api-version, and openai-api-deployment-id args, pass them into coder.create.
# Aider chat conversation: USER: add --openai-api-type --openai-api-version and openai-api-deployment-id args. pass them into coder.create ASSISTANT: To add the `--openai-api-type`, `--openai-api-version`, and `--openai-api-deployment-id` arguments and pass them into `coder.create`, we need to modify the `aider/main.py` file. Here are the steps: 1. Add the new arguments to the argument parser in the `main` function. 2. Pass these arguments to the `coder.create` function. Here are the changes: ```python aider/main.py <<<<<<< ORIGINAL ########## model_group = parser.add_argument_group("Advanced Model Settings") model_group.add_argument( "--openai-api-base", metavar="OPENAI_API_BASE", default="https://api.openai.com/v1", help="Specify the OpenAI API base endpoint (default: https://api.openai.com/v1)", ) ======= ########## model_group = parser.add_argument_group("Advanced Model Settings") model_group.add_argument( "--openai-api-base", metavar="OPENAI_API_BASE", default="https://api.openai.com/v1", help="Specify the OpenAI API base endpoint (default: https://api.openai.com/v1)", ) model_group.add_argument( "--openai-api-type", metavar="OPENAI_API_TYPE", help="Specify the OpenAI API type", ) model_group.add_argument( "--openai-api-version", metavar="OPENAI_API_VERSION", help="Specify the OpenAI API version", ) model_group.add_argument( "--openai-api-deployment-id", metavar="OPENAI_API_DEPLOYMENT_ID", help="Specify the OpenAI API deployment ID", ) >>>>>>> UPDATED ``` ```python aider/main.py <<<<<<< ORIGINAL coder = Coder.create( main_model, args.edit_format, io, args.openai_api_key, args.openai_api_base, ## fnames=args.files, pretty=args.pretty, show_diffs=args.show_diffs, auto_commits=args.auto_commits, dirty_commits=args.dirty_commits, dry_run=args.dry_run, map_tokens=args.map_tokens, verbose=args.verbose, assistant_output_color=args.assistant_output_color, code_theme=args.code_theme, stream=args.stream, use_git=args.git, ) ======= coder = Coder.create( main_model, args.edit_format, io, args.openai_api_key, args.openai_api_base, ## fnames=args.files, pretty=args.pretty, show_diffs=args.show_diffs, auto_commits=args.auto_commits, dirty_commits=args.dirty_commits, dry_run=args.dry_run, map_tokens=args.map_tokens, verbose=args.verbose, assistant_output_color=args.assistant_output_color, code_theme=args.code_theme, stream=args.stream, use_git=args.git, openai_api_type=args.openai_api_type, openai_api_version=args.openai_api_version, openai_api_deployment_id=args.openai_api_deployment_id, ) >>>>>>> UPDATED ``` Please note that these changes assume that the `Coder.create` method and the `Coder` class are prepared to receive and handle these new arguments. If they are not, additional changes will be needed in the `Coder` class and its subclasses.
This commit is contained in:
parent
967cb1bd8d
commit
fa3283802a
1 changed files with 18 additions and 0 deletions
|
@ -78,6 +78,21 @@ def main(args=None, input=None, output=None):
|
|||
default="https://api.openai.com/v1",
|
||||
help="Specify the OpenAI API base endpoint (default: https://api.openai.com/v1)",
|
||||
)
|
||||
model_group.add_argument(
|
||||
"--openai-api-type",
|
||||
metavar="OPENAI_API_TYPE",
|
||||
help="Specify the OpenAI API type",
|
||||
)
|
||||
model_group.add_argument(
|
||||
"--openai-api-version",
|
||||
metavar="OPENAI_API_VERSION",
|
||||
help="Specify the OpenAI API version",
|
||||
)
|
||||
model_group.add_argument(
|
||||
"--openai-api-deployment-id",
|
||||
metavar="OPENAI_API_DEPLOYMENT_ID",
|
||||
help="Specify the OpenAI API deployment ID",
|
||||
)
|
||||
model_group.add_argument(
|
||||
"--edit-format",
|
||||
metavar="EDIT_FORMAT",
|
||||
|
@ -351,6 +366,9 @@ def main(args=None, input=None, output=None):
|
|||
code_theme=args.code_theme,
|
||||
stream=args.stream,
|
||||
use_git=args.git,
|
||||
openai_api_type=args.openai_api_type,
|
||||
openai_api_version=args.openai_api_version,
|
||||
openai_api_deployment_id=args.openai_api_deployment_id,
|
||||
)
|
||||
|
||||
if args.dirty_commits:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue