I hope this helps! If you have any other questions, feel free to ask.
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
Based on the information you've provided and the similar issues I found in the LangChain repository, the NotFoundError
with code 404 indicating 'Resource not found' could be due to a few reasons:
Incorrect Azure Endpoint: The Azure endpoint you're using might be incorrect. The endpoint should be in the format https://example-resource.azure.openai.com/
. Make sure you're using the correct endpoint.
Incorrect Deployment Name: The deployment name you're using might be incorrect. The deployment name should be the same as the "Model deployment name" in the Azure portal. Make sure you're using the correct deployment name.
Incorrect API Version: The API version you're using might be incorrect. The API version should be in the format 2023-05-15
. Make sure you're using the correct API version.
Incorrect API Key: The API key you're using might be incorrect. The API key should be the same as the "AZURE_OPENAI_API_KEY" in the Azure portal. Make sure you're using the correct API key.
Incorrect Model Version: The model version you're using might be incorrect. The model version should be the same as the "model_version" in the Azure portal. Make sure you're using the correct model version.
If all the above parameters are correct, then the issue might be with the OpenAI Python package version. Make sure you're using the correct version of the OpenAI Python package.
In the code, the AzureChatOpenAI class is trying to create a client for the Azure OpenAI API using the provided parameters. If any of these parameters are incorrect, it will not be able to create the client and will throw a NotFoundError.
In the context shared, it's also important to note that the AzureChatOpenAI class requires the openai_api_version
and azure_deployment
parameters. If these are not provided or incorrect, it could also lead to a NotFoundError. Additionally, the model_version
parameter can be provided to the AzureChatOpenAI class to distinguish between different versions of the model. If the model_version
is incorrect, it could potentially lead to a NotFoundError.
I hope this helps! If you have any other questions, feel free to ask.
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
I'm currently using LangChain version 0.0.336 and OpenAI version 1.3.4. Instead of using the openai_api_base, I've opted for azure_endpoint, which seems to be functioning well. It's important to note that if your OpenAI version is 1.0.0 or higher, the AzureChatOpenAI class will automatically reformat your OpenAI API base. I believe this reformatting is the root of the issue.
azure_llm = AzureChatOpenAI(
deployment_name=deploy_name,
openai_api_type=os.getenv("AZURE_OPENAI_TYPE"),
openai_api_version=os.getenv("AZURE_OPENAI_API_VERSION"),
openai_api_key=self.openai_api_key,
azure_endpoint="https://{YOUR_ENDPOINT}.openai.azure.com/openai/deployments/{DEPLOYMENT_NAME}/chat/completions?api-version=2023-07-01-preview",
I am facing the same error. Can any one help me on this. I also tried using the Chromadb but facing the same error.
docsearch = FAISS.from_documents(texts, embeddings)
I am facing the same error. Can any one help me on this. I also tried using the Chromadb but facing the same error.
docsearch = FAISS.from_documents(texts, embeddings)
Make sure you're using AzureOpenAIEmbeddings
and not OpenAIEmbeddings
, and you include as a parameter for AzureOpenAIEmbeddings
: azure_deployment = ... # <- add your deployment name here
This answer helped me immensely with what I expect is a similar issue to yours (embeddings endpoint 404ing)
#14018 (comment)
youkaisteve, Songnianz, AmrinKareem, nick-reshaped, bingran-you, edious, dfauland, and Isydmr reacted with thumbs up emoji
v-nhandt21, alejandrapeidb, GMartin-dev, nick-reshaped, ahmedshafikk, thomasninane, and Isydmr reacted with heart emoji
All reactions
opendevin:INFO: agent_controller.py:135 OBSERVATION Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}
All-Hands-AI/OpenHands#1187
Hello, I have resolved this using api version 2024-02-15-preview
instead of Model version displayed in azure table 0613
it worked! Where did you get the api version?I check Azure document and cloud not find information about the version.
To address the NotFoundError
with error code 404 when using the AzureChatOpenAI
class from LangChain, here are specific steps to resolve the issue:
Verify Environment Variables: Ensure AZURE_OPENAI_ENDPOINT
and OPENAI_API_VERSION
are correctly set. The endpoint should match https://example-resource.azure.openai.com/
, and a supported API version is "2023-05-15"
.
Check Deployment Name: The deployment_name
in the AzureChatOpenAI
constructor must match the "Model deployment name" in the Azure portal.
API Key and Azure AD Token: Confirm that AZURE_OPENAI_API_KEY
and AZURE_OPENAI_AD_TOKEN
are correctly set for authentication.
OpenAI Package: Ensure the openai
Python package is installed, as it's required for API calls.
API Version: The openai_api_version
parameter should match a version supported by both the openai
package and Azure OpenAI service. For using 2024-02-15-preview
, verify its support in the official documentation.
Error Handling: Review the error message for additional details and check the Azure portal for deployment status or configuration issues.
Compatibility between openai==1.2.3
and langchain==0.0.335
is known to have issues. The langchain-openai
package requires a minimum openai
version of 1.10.0
.
The LLMChain
class is designed for running queries against Language Learning Models (LLMs), formatting prompts, and generating responses from language models.
For more detailed guidance, refer to the AzureChatOpenAI Documentation and the AzureChatOpenAI Source Code.
Details
Sources
Replication of a complex Azure OpenAI request in langchain
'DeploymentNotFound', The API deployment for this resource does not exist.
ElasticVectorSearch Error similarity_search openai.NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}
Resource not found error trying to use chromadb with Azure Open AI
openai.error.InvalidRequestError: Resource not found
AzureChatOpenAI raises The API deployment for this resource does not exist when used with ConversationalRetrievalChain
Agent Executor Error code: 404
Issue: AzureOpenAI connection with SQL Database
docs/docs/integrations/chat/azure_chat_openai.ipynb
libs/partners/openai/langchain_openai/chat_models/azure.py
libs/community/langchain_community/chat_models/azure_openai.py
libs/langchain/langchain/chains/llm.py
libs/partners/openai/pyproject.toml
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
Hello, I have resolved this using api version 2024-02-15-preview
instead of Model version displayed in azure table 0613
it worked! Where did you get the api version?I check Azure document and cloud not find information about the version.
From network inspector in https://oai.azure.com/portal chat
To resolve the NotFoundError
with error code 404 when using AzureChatOpenAI
from LangChain, ensure the following configurations are correct:
API Version: Use the correct API version, such as 2024-02-15-preview
, as mentioned by a user who found it effective. This version should be supported by Azure OpenAI service.
Azure Endpoint: Confirm your azure_endpoint
is correctly set. It should include your specific resource name and possibly the /openai
suffix as indicated by another user's successful attempt.
Deployment Name: The deployment_name
must exactly match the one in the Azure portal. This is a common source of the 404 error.
API Key and Environment Variables: Ensure your AZURE_OPENAI_API_KEY
and other environment variables like AZURE_OPENAI_ENDPOINT
are correctly set.
LangChain and OpenAI Package Versions: There are known compatibility issues with certain versions of LangChain and OpenAI. Ensure you're using compatible versions, with LangChain requiring openai
library version to be at least 1.10.0.
Model Invocation: Use the correct method and parameters for invoking the model as per LangChain documentation.
If after checking these configurations the issue persists, consider the API version 2024-02-15-preview
instead of the model version displayed in the Azure table, as this has resolved the issue for others. Additionally, inspect the network inspector in the Azure portal for the correct API version if necessary.
Details
Sources
Replication of a complex Azure OpenAI request in langchain
'DeploymentNotFound', The API deployment for this resource does not exist.
Resource not found error trying to use chromadb with Azure Open AI
Using AzureChatOpenAI
openai.error.InvalidRequestError: Resource not found
NotFoundError for OpenAI with gpt-3.5-turbo model
AzureChatOpenAI raises The API deployment for this resource does not exist when used with ConversationalRetrievalChain
langchain.document_loaders.generic GenericLoader not working on Azure OpenAI - InvalidRequestError: Resource Not Found, cannot detect declared resource
libs/community/langchain_community/chat_models/azure_openai.py
libs/community/langchain_community/embeddings/azure_openai.py
libs/partners/openai/langchain_openai/chat_models/azure.py
docs/docs/integrations/llms/azure_openai.ipynb
libs/cli/langchain_cli/namespaces/migrate/codemods/migrations/openai.json
libs/partners/openai/langchain_openai/llms/azure.py
libs/partners/openai/pyproject.toml
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
Hello, I have resolved this using api version 2024-02-15-preview
instead of Model version displayed in azure table 0613
it worked! Where did you get the api version?I check Azure document and cloud not find information about the version.
From network inspector in https://oai.azure.com/portal chat
Would you give me screenshot?I can't find your result,and I use the version as the following,langchain return Resource not found error
To address the "Resource not found" error when using AzureChatOpenAI
in LangChain, ensure you're using the correct API version. The recommended API version is 2023-06-01-preview
. Here's how to configure it:
Set the API Version: Make sure to set the AZURE_OPENAI_API_VERSION
environment variable to "2023-06-01-preview"
. You can do this directly in your code before initializing the AzureChatOpenAI
instance:
import os
os.environ["AZURE_OPENAI_API_VERSION"] = "2023-06-01-preview"
Initialize AzureChatOpenAI Correctly: When creating an instance of AzureChatOpenAI
, pass the openai_api_version
parameter with the value "2023-06-01-preview"
:
from langchain_openai import AzureChatOpenAI
model = AzureChatOpenAI(
openai_api_base=BASE_URL,
openai_api_version="2023-06-01-preview",
deployment_name=DEPLOYMENT_NAME,
openai_api_key=API_KEY,
openai_api_type="azure",
Verify API Version: It's crucial to use an API version supported by Azure OpenAI service. The 2023-06-01-preview
version is based on the latest LangChain documentation. For the most current information, refer to the Azure OpenAI Service documentation.
By following these steps, you should be able to resolve the "Resource not found" error. If issues persist, verifying your Azure endpoint, deployment name, and API key for accuracy is recommended.
Details
Sources
'DeploymentNotFound', The API deployment for this resource does not exist.
Issue:The completion operation does not work with the specified model for azure openai api
Using AzureChatOpenAI
openai.error.InvalidRequestError: Resource not found
KeyError: 'openai_api_version'
AzureChatOpenAI raises The API deployment for this resource does not exist when used with ConversationalRetrievalChain
langchain.document_loaders.generic GenericLoader not working on Azure OpenAI - InvalidRequestError: Resource Not Found, cannot detect declared resource
libs/partners/openai/langchain_openai/chat_models/azure.py
libs/community/langchain_community/chat_models/azure_openai.py
docs/docs/integrations/chat/azure_chat_openai.ipynb
libs/partners/openai/langchain_openai/llms/azure.py
libs/community/langchain_community/embeddings/azure_openai.py
libs/partners/openai/langchain_openai/embeddings/azure.py
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
Hello, I have resolved this using api version 2024-02-15-preview
instead of Model version displayed in azure table 0613
it worked! Where did you get the api version?I check Azure document and cloud not find information about the version.
From network inspector in https://oai.azure.com/portal chat
Would you give me screenshot?I can't find your result,and I use the version as the following,langchain return Resource not found error
To address the "Resource not found" error when using AzureChatOpenAI
in LangChain, it's essential to ensure your setup aligns with Azure's requirements and the expectations of the LangChain library. Here are some tailored steps and considerations:
API Version: Utilize a supported API version. While 2024-02-15-preview
has been mentioned as a workaround, it's crucial to use versions that are officially documented and supported for stability, such as 2023-06-01-preview
. Experimenting with versions found through tools like network inspectors can be insightful but may lead to unstable integrations.
Azure Endpoint Configuration: Your azure_endpoint
must be correctly configured. It should include your specific resource name and, if successful for others, the /openai
suffix. This detail is critical as the correct format of the endpoint URL is key to successful integration.
Deployment Name Accuracy: The deployment name in your code must exactly match what is specified in the Azure portal. Discrepancies here are a common source of 404 errors.
Environment Variables and API Key: Verify that your environment variables, such as AZURE_OPENAI_API_KEY
and AZURE_OPENAI_ENDPOINT
, are correctly set to match the values in the Azure portal.
LangChain and OpenAI Package Versions: Ensure compatibility between LangChain and OpenAI versions to avoid errors. Consult the LangChain documentation or community discussions for recommendations on which versions work best together.
Specifying API Version in Code: If encountering issues with the API version, directly specify it in your code when initializing the AzureChatOpenAI
instance. This ensures you're using the correct version for your setup.
Consult Azure Portal and Documentation: For accurate and up-to-date information regarding API versions and configurations, refer to the Azure OpenAI Service documentation and the Azure portal. While the network inspector tool can provide useful insights, be cautious with using features or versions that are not documented.
If you've followed these steps and continue to experience issues, sharing more specific details about your configuration, including exact error messages and code snippets, can help the community offer more targeted advice.
Details
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
Hello, I have resolved this using api version 2024-02-15-preview
instead of Model version displayed in azure table 0613
It works for me, tks
Hello, I have resolved this using api version 2024-02-15-preview
instead of Model version displayed in azure table 0613
This worked for me! Thank you :)
Hello, I have resolved this using api version 2024-02-15-preview
instead of Model version displayed in azure table 0613
thanks this solved the problem