mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
refactor initialization of openai into main
This commit is contained in:
parent
fa3283802a
commit
084132a5f8
2 changed files with 12 additions and 11 deletions
|
@ -53,8 +53,6 @@ class Coder:
|
|||
main_model,
|
||||
edit_format,
|
||||
io,
|
||||
openai_api_key,
|
||||
openai_api_base="https://api.openai.com/v1",
|
||||
**kwargs,
|
||||
):
|
||||
from . import (
|
||||
|
@ -65,9 +63,6 @@ class Coder:
|
|||
WholeFileFunctionCoder,
|
||||
)
|
||||
|
||||
openai.api_key = openai_api_key
|
||||
openai.api_base = openai_api_base
|
||||
|
||||
if not main_model:
|
||||
main_model = models.GPT35_16k
|
||||
|
||||
|
@ -629,6 +624,8 @@ class Coder:
|
|||
)
|
||||
if functions is not None:
|
||||
kwargs["functions"] = self.functions
|
||||
if hasattr(openai, "api_deployment_id"):
|
||||
kwargs["deployment_id"] = openai.api_deployment_id
|
||||
|
||||
# Generate SHA1 hash of kwargs and append it to chat_completion_call_hashes
|
||||
hash_object = hashlib.sha1(json.dumps(kwargs, sort_keys=True).encode())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue