(FEAT) allow setting base url for openai v1.0.0+ #32
(FEAT) allow setting base url for openai v1.0.0+ #32ishaan-jaff wants to merge 2 commits intobraintrustdata:mainfrom
Conversation
py/autoevals/oai.py
Outdated
|
|
||
| openai_obj = openai | ||
| is_v1 = False | ||
| base_url = os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1") |
There was a problem hiding this comment.
defaults to https://api.openai.com/v1 if none specified
|
can i get a review on this @ankrgyl |
|
If I'm researching correctly, |
|
updated this to pass |
|
|
||
|
|
||
| def prepare_openai_complete(is_async=False, api_key=None): | ||
| def prepare_openai_complete(is_async=False, api_key=None, base_url="https://api.openai.com/v1"): |
There was a problem hiding this comment.
would rather not hardcode the API url here -- e.g. someone may monkey patch the library to override the default, and this would override that. Is there any issue with passing None into the OpenAI object by default?
|
@ishaan-jaff I think #33 supersedes this change (it allows you to optionally override the base url and supports JS). Feel free to take a look, and happy to either rebase/scope this PR or just close it out. |
this allows users to specify a custom
openai api baseI tried
export OPENAI_API_BASEbut it looks like the latest version of openai does not read the base url from the .env