Hi Farzad. Hope you are doing good.
I'm encountering an issue while running the app.
I have created a .env file like this:
OPENAI_API_TYPE="azure"
OPENAI_API_BASE="https://hidden.openai.azure.com/"
OPENAI_API_VERSION="2024-02-15-preview"
OPENAI_API_KEY="hidden"
DEPLOYMENT_NAME_1="hidden-35turbo"
DEPLOYMENT_NAME_2="hidden-ada002embeddings"
I have made these following changes to load_config.py, I have just altered the def load_openai_cfg function:
def load_openai_cfg(self):
"""
Load OpenAI configuration settings.
This function sets the OpenAI API configuration settings, including the API type, base URL,
version, and API key. It is intended to be called at the beginning of the script or application
to configure OpenAI settings.
Note:
Replace "Your API TYPE," "Your API BASE," "Your API VERSION," and "Your API KEY" with your actual
OpenAI API credentials.
"""
openai.api_type = os.getenv("OPENAI_API_TYPE")
openai.api_base = os.getenv("OPENAI_API_BASE")
openai.api_version = os.getenv("OPENAI_API_VERSION")
openai.api_key = os.getenv("OPENAI_API_KEY")
deployment_name_1 = os.getenv("DEPLOYMENT_NAME_1")
deployment_name_2 = os.getenv("DEPLOYMENT_NAME_2")
When i run the upload_data_manually.py file, it creates the vector database and it chunks the documents and then throws this error:
PS C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT> python src/upload_data_manually.py
The directory 'C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\data\vectordb\uploaded\chroma' does not exist.
Loading documents manually...
Number of loaded documents: 4
Number of pages: 86
Chunking documents...
Number of chunks: 351
Preparing vectordb...
Traceback (most recent call last):
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\src\upload_data_manually.py", line 40, in
upload_data_manually()
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\src\upload_data_manually.py", line 33, in upload_data_manually
prepare_vectordb_instance.prepare_and_save_vectordb()
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\src\prepare_vectordb.py", line 110, in prepare_and_save_vectordb
vectordb = Chroma.from_documents(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\vectorstores\chroma.py", line 778, in from_documents
return cls.from_texts(
^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\vectorstores\chroma.py", line 736, in from_texts
chroma_collection.add_texts(
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\vectorstores\chroma.py", line 275, in add_texts
embeddings = self._embedding_function.embed_documents(texts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\embeddings\openai.py", line 662, in embed_documents
return self._get_len_safe_embeddings(texts, engine=engine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\embeddings\openai.py", line 488, in _get_len_safe_embeddings
response = embed_with_retry(
^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\embeddings\openai.py", line 123, in embed_with_retry
return _embed_with_retry(kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\tenacity__init.py", line 289, in wrapped_f
return self(f, *args, **kw)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\tenacity__init.py", line 379, in call
do = self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\tenacity\init__.py", line 314, in iter
return fut.result()
^^^^^^^^^^^^
File "C:\Users\ranaa\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures_base.py", line 449, in result
return self.get_result()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures_base.py", line 401, in get_result
raise self._exception
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\tenacity\init.py", line 382, in call__
result = fn(*args, kwargs)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\embeddings\openai.py", line 120, in _embed_with_retry
response = embeddings.client.create(*kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\openai\api_resources\embedding.py", line 33, in create
response = super().create(args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\openai\api_resources\abstract\engine_apiresource.py", line 153, in create
response, , api_key = requestor.request(
^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\openai\api_requestor.py", line 298, in request
resp, got_stream = self._interpret_response(result, stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\openai\api_requestor.py", line 700, in _interpret_response
self._interpret_response_line(
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\openai\api_requestor.py", line 765, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.
Both gpt3.5 turbo and adaembeddings 002 models are deployed on AzureOpen AI Studio and I have tested them in the playground to make sure they are working. I think this has something to do with the configurations in the .env file, maybe i need to pass deployment names in some other manner. Can you please tell me the format how you passed the .env file and any more changes you made in load_config file or app_config?
Please respond asap.
Hi Farzad. Hope you are doing good. I'm encountering an issue while running the app. I have created a .env file like this: OPENAI_API_TYPE="azure" OPENAI_API_BASE="https://hidden.openai.azure.com/" OPENAI_API_VERSION="2024-02-15-preview" OPENAI_API_KEY="hidden" DEPLOYMENT_NAME_1="hidden-35turbo" DEPLOYMENT_NAME_2="hidden-ada002embeddings"
I have made these following changes to load_config.py, I have just altered the def load_openai_cfg function: def load_openai_cfg(self): """ Load OpenAI configuration settings.
The directory 'C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\data\vectordb\uploaded\chroma' does not exist. Loading documents manually... Number of loaded documents: 4 Number of pages: 86
Chunking documents... Number of chunks: 351
Preparing vectordb... Traceback (most recent call last): File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\src\upload_data_manually.py", line 40, in
upload_data_manually()
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\src\upload_data_manually.py", line 33, in upload_data_manually
prepare_vectordb_instance.prepare_and_save_vectordb()
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\src\prepare_vectordb.py", line 110, in prepare_and_save_vectordb
vectordb = Chroma.from_documents(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\vectorstores\chroma.py", line 778, in from_documents
return cls.from_texts(
^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\vectorstores\chroma.py", line 736, in from_texts
chroma_collection.add_texts(
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\vectorstores\chroma.py", line 275, in add_texts
embeddings = self._embedding_function.embed_documents(texts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\embeddings\openai.py", line 662, in embed_documents
return self._get_len_safe_embeddings(texts, engine=engine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\embeddings\openai.py", line 488, in _get_len_safe_embeddings
response = embed_with_retry(
^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\embeddings\openai.py", line 123, in embed_with_retry
return _embed_with_retry(kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\tenacity__init.py", line 289, in wrapped_f
return self(f, *args, **kw)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\tenacity__init.py", line 379, in call
do = self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\tenacity\init__.py", line 314, in iter
return fut.result()
^^^^^^^^^^^^
File "C:\Users\ranaa\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures_base.py", line 449, in result
return self.get_result()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures_base.py", line 401, in get_result
raise self._exception
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\tenacity\init.py", line 382, in call__
result = fn(*args, kwargs)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\langchain_community\embeddings\openai.py", line 120, in _embed_with_retry
response = embeddings.client.create(*kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\openai\api_resources\embedding.py", line 33, in create
response = super().create(args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\openai\api_resources\abstract\engine_apiresource.py", line 153, in create
response, , api_key = requestor.request(
^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\openai\api_requestor.py", line 298, in request
resp, got_stream = self._interpret_response(result, stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\openai\api_requestor.py", line 700, in _interpret_response
self._interpret_response_line(
File "C:\Users\ranaa\Desktop\LLM-Zero-to-Hundred-master\RAG-GPT\venv\Lib\site-packages\openai\api_requestor.py", line 765, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.
Both gpt3.5 turbo and adaembeddings 002 models are deployed on AzureOpen AI Studio and I have tested them in the playground to make sure they are working. I think this has something to do with the configurations in the .env file, maybe i need to pass deployment names in some other manner. Can you please tell me the format how you passed the .env file and any more changes you made in load_config file or app_config? Please respond asap.