-
Notifications
You must be signed in to change notification settings - Fork 50
(FEAT) allow setting base url for openai v1.0.0+ #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
ankrgyl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add in JS too?
|
|
||
|
|
||
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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