Uh oh!
There was an error while loading. Please reload this page.
(FEAT) allow setting base url for openai v1.0.0+ - #32
(FEAT) allow setting base url for openai v1.0.0+ #32Ishaan Jaff (ishaan-jaff) wants to merge 2 commits into
Conversation
| 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
Ishaan Jaff (ishaan-jaff)
commented
Nov 14, 2023
can i get a review on this Ankur Goyal (@ankrgyl) |
Ankur Goyal (ankrgyl)
commented
Nov 14, 2023
If I'm researching correctly, |
Ishaan Jaff (ishaan-jaff)
commented
Nov 14, 2023
updated this to pass |
Ankur Goyal (ankrgyl)
left a comment
There was a problem hiding this comment.
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.
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?
Ankur Goyal (ankrgyl)
commented
Nov 28, 2023
Ishaan Jaff (@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