mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 18:54:59 +00:00
fixed benchmark
This commit is contained in:
parent
d92a93221c
commit
bf03f43b44
4 changed files with 18 additions and 11 deletions
|
@ -480,7 +480,6 @@ class Coder:
|
|||
except ExhaustedContextWindow:
|
||||
exhausted = True
|
||||
except openai.BadRequestError as err:
|
||||
dump(err)
|
||||
if "maximum context length" in str(err):
|
||||
exhausted = True
|
||||
else:
|
||||
|
@ -955,7 +954,6 @@ class Coder:
|
|||
|
||||
def check_model_availability(io, client, main_model):
|
||||
available_models = client.models.list()
|
||||
dump(available_models)
|
||||
model_ids = sorted(model.id for model in available_models)
|
||||
if main_model.name in model_ids:
|
||||
return True
|
||||
|
|
|
@ -177,7 +177,7 @@ def main(argv=None, input=None, output=None, force_git_root=None):
|
|||
model_group.add_argument(
|
||||
"--openai-api-base",
|
||||
metavar="OPENAI_API_BASE",
|
||||
help="Specify the api_base (default: https://api.openai.com/v1)",
|
||||
help="Specify the api base url",
|
||||
)
|
||||
model_group.add_argument(
|
||||
"--openai-api-type",
|
||||
|
@ -497,14 +497,15 @@ def main(argv=None, input=None, output=None, force_git_root=None):
|
|||
)
|
||||
else:
|
||||
kwargs = dict()
|
||||
if args.openai_api_base and "openrouter.ai" in args.openai_api_base:
|
||||
kwargs["default_headers"] = {"HTTP-Referer": "http://aider.chat", "X-Title": "Aider"}
|
||||
if args.openai_api_base:
|
||||
kwargs["base_url"] = args.openai_api_base
|
||||
if "openrouter.ai" in args.openai_api_base:
|
||||
kwargs["default_headers"] = {
|
||||
"HTTP-Referer": "http://aider.chat",
|
||||
"X-Title": "Aider",
|
||||
}
|
||||
|
||||
client = openai.OpenAI(
|
||||
api_key=args.openai_api_key,
|
||||
base_url=args.openai_api_base,
|
||||
**kwargs,
|
||||
)
|
||||
client = openai.OpenAI(api_key=args.openai_api_key, **kwargs)
|
||||
|
||||
main_model = models.Model.create(args.model, client)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue