langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
92.26k stars 14.73k forks source link

Getting an error InvalidRequestError: Resource not found in VectorDBQA #1923

Closed srivatsanv1 closed 11 months ago

srivatsanv1 commented 1 year ago

HI, I am getting an error "InvalidRequestError: Resource not found" while using Chat model using VectorDBQA chain. This issue is coming up after v0.0.120 release and I was not getting this in the previous version which I used which was v0.0.118. I am using Chatmodel from Azure through AzureChatOpenAI and embeddings through Azure`s model.

Fanchouille commented 1 year ago

Hi, same here ("InvalidRequestError: Resource not found"), it's working when using v0.0.119 but not with next versions (0.0.120 & 0.0121). Not using gpt 35 though, but davinci003.

happyPydog commented 1 year ago

I have the same problem

srivatsanv1 commented 1 year ago

Getting the same error with ConversationalRetrievalChain also. Is this some issue with AzureOpenAI?

stefanoscotta commented 1 year ago

Getting the same error with ConversationalRetrievalChain also. Is this some issue with AzureOpenAI?

I also have the same problem, not found a solution up to now

devmart10 commented 1 year ago

What worked for me was removing the import of openai when using the langchain.llms.AzureOpenAI module.

Try removing import openai even if none of your code appears to be using it.

I'm using version 2022-12-01.

domalbert commented 1 year ago

You should put in the deployment name into AzureOpenAI:

llm = AzureOpenAI(model_name=deployment_name, deployment_id=deployment_name,deployment_name=deployment_name)

However for me this depends a lot if I take chatGPTs gpt35-turbo or gpt-4 version.

Here are the versions of my dependencies.

langchain: 0.0.118 openai: 0.27.4

nickwong64 commented 1 year ago

I have this "Resource Not Found" error using Azure OpenAI, OpenAIEmbeddings and ConversationalRetrievalChain. I found that when using OpenAIEmbeddings the api_version would be changed to "2022-12-01" and after that, using ConversationalRetrievalChain, the api_version will keep as "2022-12-01" and cause the "Resource Not Found" error. The workaround is to set the api_version back to "2023-03-15-preview" after calling OpenAIEmbeddings but before calling ConversationalRetrievalChain.

Enable the openai.log = "debug" so that you can trace all the endpoints and parameters to help you debugging.

vahidzangenehc commented 1 year ago

I have same issue and none of the solutions works for me! In the debug logs, I see the api_version is None although I have already set os.environ["OPENAI_API_VERSION"] = "2023-03-15-preview". The OpenAIEmbeddings works well but ConversationalRetrievalChain raises the "Resource Not Found" error. The settings: os.environ["OPENAI_API_TYPE"] = "azure" os.environ["OPENAI_API_BASE"] = "https://my_be.openai.azure.com" os.environ["OPENAI_API_KEY"] = "my_key" os.environ["OPENAI_API_VERSION"] = "2023-03-15-preview"

langchain==0.0.200

dosubot[bot] commented 11 months ago

Hi, @srivatsanv1! I'm Dosu, and I'm here to help the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

Based on my understanding, you are experiencing an "InvalidRequestError: Resource not found" error when using the Chat model with VectorDBQA chain. It seems that other users have also reported the same issue, and it may be related to the AzureOpenAI module. Some potential solutions have been suggested, such as removing the import of openai and setting the api_version back to "2023-03-15-preview" after calling OpenAIEmbeddings but before calling ConversationalRetrievalChain. However, it appears that these solutions have not worked for some users.

Before we proceed, we would like to confirm if this issue is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on this issue. Otherwise, feel free to close the issue yourself, or the issue will be automatically closed in 7 days.

Thank you for your understanding and cooperation. We look forward to hearing from you soon.

truedat101 commented 10 months ago

commenting on this issue, yes, I verified this is still a problem.