Repository navigation
Conversation
|
Here is how to reproduce the problem. Following code would fail without the trailing openai.base_url = "https://api.openai.com/v1"
# Instead, you have to add the trailing /
#openai.base_url = "https://api.openai.com/v1/"
openai.api_key = "sk-xxxx"
chat_completion = openai.chat.completions.create() |
|
cc @RobertCraigie can you take a look at this on Monday? |
chrishalbert
left a comment
There was a problem hiding this comment.
Can you add tests to the test_client.py to address the possible scenarios? Otherwise, it looks good to me.
|
|
|
gentle ping @RobertCraigie |
|
Thank you for the contribution. Using The underlying bug remains tracked in #1373. For now, include a trailing |
Changes being requested
Use
self._base_urlto replaceself.base_urlin BaseClient class's_prepare_urlmethod.Additional context & links
It does not hurt OpenAI class client, because
self.base_urlis referred toself._base_urlbase on this lineBut this change would help the module_client cases, when we are setting
openai.base_url="an_endpoint_url_WITHOUT_training_/_at_the_end"Due to this line, the
base_urlwould directly return the URL WITHOUT trailing/and fail the requstThe workaround is always add training
/at the end of the module client base_url, but with this PR fix, this step is optional (_base_url is/padded already here)