-
Notifications
You must be signed in to change notification settings - Fork 1k
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 Open AI request need a version query parameter #169
Comments
@ksolo when we are planning to add the solution of this? |
when is the next release planned for? |
when is the next release planned for? We are also waiting for this update. thanks |
@ksolo any updates on this issue? |
@ksolo is there any updates when this will be fixed |
@ksolo unfortunately due to the lack of response we are moving away from aisuite. |
Vote for this issue as well |
I have added a Pull Request for solving this issue. #186 |
Incorrect URL Construction in Azure Open AI Client Chat Creation Results in 404 Error Description: def chat_completions_create(self, model, messages, **kwargs):
url = f"https://{model}.westus3.models.ai.azure.com/v1/chat/completions"
url = f"https://{self.base_url}/chat/completions"
if self.base_url:
url = f"{self.base_url}/chat/completions"
This code results in a request with the URL:
https://openai-[region].openai.azure.com/openai/deployments/[deployment name]/chat/completions
which leads to a 404 resources not found error because it lacks the necessary api-version parameter.
Expected URL: The correct URL should include the api-version parameter, as shown below:
https://openai-[region].openai.azure.com/openai/deployments/[deployment name]/chat/completions?api-version=[version]
**Proposed Solution**: Update the URL construction to include the api-version parameter to avoid the 404 error. Here is the revised code:
def chat_completions_create(self, model, messages, **kwargs):
api_version = kwargs.get('api_version', 'YOUR_API_VERSION_HERE') # Ensure to replace 'YOUR_API_VERSION_HERE' with the actual version
base_url = f"https://{model}.westus3.models.ai.azure.com/v1/chat/completions"
if self.base_url:
base_url = f"{self.base_url}/chat/completions"
url = f"{base_url}?api-version={api_version}"
# The rest of the code to send the request and handle the response
By including the api-version parameter in the URL, the request will be properly routed, resolving the 404 error.
Additional Notes: The Azure Open AI client library is notably faster than LiteLLM and, as others have mentioned, cleaner. Implementing this fix will enhance its usability even further.
Labels: bug, enhancement, Azure, AI, client, URL |
In the current code of Azure Open AI client chat creation:
This would result in a request with url:
https://openai-[region].openai.azure.com/openai/deployments/[deployment name]/chat/completions
and it would then result in a 404 resources not found error
The actual observed url should be
https://openai-[region].openai.azure.com/openai/deployments/[deployment name]/chat/completions?api-version=[version]
And last but not least, I like this library, it's faster than LiteLLM and as other mentioned, cleaner.
The text was updated successfully, but these errors were encountered: