Skip to content
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

Azure Endpoint URL is not Trailing-Slash Agnostic #1894

Closed
1 task done
Jozef833 opened this issue Nov 26, 2024 · 1 comment · Fixed by #1935
Closed
1 task done

Azure Endpoint URL is not Trailing-Slash Agnostic #1894

Jozef833 opened this issue Nov 26, 2024 · 1 comment · Fixed by #1935
Labels
bug Something isn't working

Comments

@Jozef833
Copy link

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

  1. Initialize an AsyncAzureOpenAI client.
  2. Await on client.chat.completions.with_raw_response.create(**model_args).
  3. 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

@Jozef833 Jozef833 added the bug Something isn't working label Nov 26, 2024
@RobertCraigie
Copy link
Collaborator

Fixed in #1935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants