-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
In src/openai/lib/azure.py, there are four cases where the endpoint URL is simply concatenated like:
f"{azure_endpoint}/openai/deployments/{azure_deployment}"
or
f"{azure_endpoint}/openai"
If azure_endpoint
has a trailing forward slash (which many comments in the code suggest is allowed, as well as an example in the repository), it will have //
in the URL, which is wrong.
To make it agnostic, it should be:
f"{azure_endpoint.rstrip("/")}/openai/deployments/{azure_deployment}"
and
f"{azure_endpoint.rstrip("/")}/openai"
This would be sufficient to fix it: #1893 673a496
To Reproduce
- Initialize an AsyncAzureOpenAI client.
- Await on client.chat.completions.with_raw_response.create(**model_args).
- The error code will be 404 Resource not found because the URL is not properly formatted.
Code snippets
No response
OS
Windows 10
Python version
Python 3.12.4
Library version
openai v1.6.1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working