-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Error: error: { code: '404', message: 'Resource not found' }, #5550
Comments
To resolve the "Azure OpenAI API instance name not found" error, ensure that you are using the Here is an example of how to correctly initialize an Azure OpenAI instance: import { AzureOpenAI } from "@langchain/openai";
const model = new AzureOpenAI({
azureOpenAIApiKey: process.env.AZURE_OPENAI_API_KEY,
azureOpenAIApiDeploymentName: process.env.AZURE_DEPLOYMENT_NAME,
azureOpenAIApiInstanceName: process.env.AZURE_API_INSTANCE,
azureOpenAIApiVersion: process.env.AZURE_API_VERSION,
temperature: 0.9,
}); Ensure that the environment variables
|
Can you try the Dosu comment above? Docs here: https://js.langchain.com/v0.2/docs/integrations/chat/azure |
@jacoblee93 Please check below code which i am trying with and getting error Error: Azure OpenAI API deployment name not found |
How are you importing the module? Are you using the AD provider? And can you share your I wonder if this is related to #5521 |
The issue is i am not using the same key name which langchain provide in docs in .env file . |
I'm so confused. Can you answer my questions above? |
package.json |
Your issue is related to #5521 , but you can easily resolve it by changing the environment variable names to those conventionally used within
And use like this. const model = new OpenAI({
temperature: 0.9,
}); |
Hi @jeasonnow "I changed the environment variable to fix the issue, but now I'm getting an error: { code: '404', message: 'Resource not found' }. When I try to access the Azure URL directly, it works, but when I use the langchain module, it throws a 404 resource not found error. I've attached my code file and package.json file. Can you take a look and see what mistake I'm making?" |
Okay, I understand. Could you please provide the specific details of the request you made through the
|
@jeasonnow I am using langchain npm module const model = new AzureOpenAI({ |
Did you use |
Yes i used , it is in my .env file |
langchainjs/libs/langchain-openai/src/utils/azure.ts Lines 32 to 65 in ed1f3fb
If you used |
@jeasonnow |
Please check the source code I sent. If you declare |
@jeasonnow Thanks you so much it is working now Thanks a lot @jeasonnow |
You're the best @jeasonnow! |
I confirm that appending the postfix '/openai/deployments' to the AZURE_OPENAI_BASE_PATH resolves the issue. However, I am wondering if the Python version is more resilient when this postfix is omitted. from langchain_openai import AzureChatOpenAI
llm = AzureChatOpenAI(
...
azure_endpoint="NOTE THAT THIS DOES NOT NEED THE 'openai/deployments' POSTFIX"
...
) |
Checked other resources
Example Code
const model = new OpenAI({
temperature: 0.9,
apiKey: process.env.AZURE_OPENAI_API_KEY,
azureOpenAIApiVersion: process.env.OPENAI_API_VERSION,
azureOpenAIApiInstanceName: process.env.AZURE_API_INSTANCE,
azureOpenAIApiDeploymentName: process.env.AZURE_DEPOYMENT_NAME,
});
Error Message and Stack Trace (if applicable)
Error: Azure OpenAI API instance name not found
at new OpenAIEmbeddings (/Users/abhijeet/Workspace/Node/UserBackend/node_modules/@langchain/openai/dist/embeddings.cjs:162:23)
at new AzureOpenAIEmbeddings (/Users/abhijeet/Workspace/Node/UserBackend/node_modules/@langchain/openai/dist/azure/embeddings.cjs:16:9)
at Object.getAns (/Users/abhijeet/Workspace/Node/UserBackend/lib/modules/v3/chatbot/facade.js:52:7)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Error: Azure OpenAI API instance name not found
at new OpenAIEmbeddings (/Users/abhijeet/Workspace/Node/UserBackend/node_modules/@langchain/openai/dist/embeddings.cjs:162:23)
at new AzureOpenAIEmbeddings (/Users/abhijeet/Workspace/Node/UserBackend/node_modules/@langchain/openai/dist/azure/embeddings.cjs:16:9)
at Object.getAns (/Users/abhijeet/Workspace/Node/UserBackend/lib/modules/v3/chatbot/facade.js:52:7)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Description
When I am trying initialization the azure open instance it throws error
Error: Azure OpenAI API instance name not found
at new OpenAIEmbeddings (/Users/abhijeet/Workspace/Node/UserBackend/node_modules/@langchain/openai/dist/embeddings.cjs:162:23)
at new AzureOpenAIEmbeddings (/Users/abhijeet/Workspace/Node/UserBackend/node_modules/@langchain/openai/dist/azure/embeddings.cjs:16:9)
at Object.getAns (/Users/abhijeet/Workspace/Node/UserBackend/lib/modules/v3/chatbot/facade.js:52:7)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Error: Azure OpenAI API instance name not found
at new OpenAIEmbeddings (/Users/abhijeet/Workspace/Node/UserBackend/node_modules/@langchain/openai/dist/embeddings.cjs:162:23)
at new AzureOpenAIEmbeddings (/Users/abhijeet/Workspace/Node/UserBackend/node_modules/@langchain/openai/dist/azure/embeddings.cjs:16:9)
at Object.getAns (/Users/abhijeet/Workspace/Node/UserBackend/lib/modules/v3/chatbot/facade.js:52:7)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
System Info
"@langchain/openai": "^0.0.33",
The text was updated successfully, but these errors were encountered: