You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to connect to Azure OpenAI deployment model but I keep getting the following error.
return {
57 | responseHeaders,
58 | value: new APICallError({
| ^
59 | message: errorToMessage(parsedError),
60 | url,
61 | requestBodyValues, {
cause: undefined,
url: 'https://my-resource-name-goes-here.openai.azure.com/openai/deployments/gpt-4o-mini/chat/completions?api-version=2024-02-15-preview',
requestBodyValues: [Object],
statusCode: 401,
responseHeaders: [Object],
responseBody: '{"error":{"code":"Unauthorized","message": "Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."}}',
isRetryable: false,
data: [Object]
}
Following is the code that I am using to configure Azure OpenAI
import { createAzure } from '@ai-sdk/azure';
//import { azure } from '@ai-sdk/azure';
import { experimental_wrapLanguageModel as wrapLanguageModel } from 'ai';
import { customMiddleware } from './custom-middleware';
const azure = createAzure({
apiKey: process.env.AZURE_API_KEY, // Azure API key
resourceName: process.env.AZURE_RESOURCE_NAME, // Azure resource name
apiVersion: process.env.AZURE_API_VERSION, // Azure API version
});
export const customModel = (apiIdentifier: string) => {
return wrapLanguageModel({
model: azure(apiIdentifier),
middleware: customMiddleware,
});
};
As per documentation this should work.
I am able to use the API from my FastAPI Python code. So I know that the endpoints, api-key, api-version, resource name parameters are correct and I do have valid subscription.
The text was updated successfully, but these errors were encountered:
I-Amarjeet
changed the title
Azure OpenAI Provider is not fully supported
Azure OpenAI Provider is not working as expected
Dec 4, 2024
Thanks for reporting! From the error message it looks like the API calls are reported as unauthorized so it may be an issue with the provider not being able to read the correct API keys from the environment.
Can you confirm if you've specified the azure environment variables in env.local?
Hi, I am trying to connect to Azure OpenAI deployment model but I keep getting the following error.
Following is the code that I am using to configure Azure OpenAI
As per documentation this should work.
I am able to use the API from my FastAPI Python code. So I know that the endpoints, api-key, api-version, resource name parameters are correct and I do have valid subscription.
The text was updated successfully, but these errors were encountered: