mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
benchmark work with openrouter
This commit is contained in:
parent
48c680ffb6
commit
d4e663f7bc
1 changed files with 16 additions and 3 deletions
|
@ -782,7 +782,22 @@ def run_test(
|
||||||
chat_history_file=history_fname,
|
chat_history_file=history_fname,
|
||||||
)
|
)
|
||||||
|
|
||||||
main_model = models.Model.create(model_name)
|
# Check if AIDER_DOCKER environment variable is set and create client accordingly
|
||||||
|
if "OPENAI_API_BASE" in os.environ and "openrouter.ai" in os.environ["OPENAI_API_BASE"]:
|
||||||
|
client = openai.OpenAI(
|
||||||
|
api_key=os.environ["OPENAI_API_KEY"],
|
||||||
|
base_url=os.environ.get("OPENAI_API_BASE", "https://api.openai.com"),
|
||||||
|
default_headers={
|
||||||
|
"HTTP-Referer": "http://aider.chat",
|
||||||
|
"X-Title": "Aider",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
client = openai.OpenAI(
|
||||||
|
api_key=os.environ["OPENAI_API_KEY"],
|
||||||
|
)
|
||||||
|
|
||||||
|
main_model = models.Model.create(model_name, client)
|
||||||
edit_format = edit_format or main_model.edit_format
|
edit_format = edit_format or main_model.edit_format
|
||||||
|
|
||||||
dump(main_model)
|
dump(main_model)
|
||||||
|
@ -790,8 +805,6 @@ def run_test(
|
||||||
show_fnames = ",".join(map(str, fnames))
|
show_fnames = ",".join(map(str, fnames))
|
||||||
print("fnames:", show_fnames)
|
print("fnames:", show_fnames)
|
||||||
|
|
||||||
client = openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"])
|
|
||||||
|
|
||||||
coder = Coder.create(
|
coder = Coder.create(
|
||||||
main_model,
|
main_model,
|
||||||
edit_format,
|
edit_format,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue