-
Notifications
You must be signed in to change notification settings - Fork 184
Open
Description
Description
The Azure OpenAI integration in the Go SDK fails to authenticate properly because it constructs incorrect API URLs that don't match the Azure OpenAI REST API specification.
Expected Behavior
Azure OpenAI API calls should use the correct URL format:
https://{endpoint}/openai/deployments/{deployment-id}/{operation}?api-version={version}
Actual Behavior
The current implementation incorrectly adds /openai/
prefix to the base endpoint and fails to properly construct deployment URLs, resulting in authentication errors.
POST https://{resource-name}.openai.azure.com/openai/chat/completions?api-version={api-version}
leads to:
404 Not found
{
"code": "404",
"message": "Resource not found"
}
Even when the deployment exists and is configured correctly in Azure.
Steps to Reproduce
- Configure Azure OpenAI client with
azure.WithEndpoint()
andazure.WithAPIKey()
- Make any API call (e.g., chat completions)
- Observe authentication failure due to malformed URLs
Environment
- Go SDK version: Latest
- Azure OpenAI API version: 2024-10-21
- Authentication method: API Key or Token Credential
Root Cause
The issue is in azure/azure.go
where:
- Base URL incorrectly includes
/openai/
prefix - Path construction logic doesn't properly format deployment URLs
- Route mappings include incorrect path prefixes
Impact
This prevents the Azure OpenAI integration from working correctly, blocking users from connecting to Azure OpenAI services.
Reference
Metadata
Metadata
Assignees
Labels
No labels