Home Artists Posts Import Register

Downloads

Content


EDIT: if you get libmagic not found error then look into pip installing python-magic by reading this doc entirely:

https://pypi.org/project/python-magic/

pip install python-magic (first)

pip install python-magic-bin (second)

IF YOU RUN INTO PERSISTENT ERRORS:

Start over by making a new environment with python version 3.11 and pip install everything one by one leaving unstructured to the end. 

Make sure you are using the latest version of langchain as it currently is being updated every few days. At the time of this video was used 0.0.79 version 

files are for video: https://youtu.be/qUoybv7SadM

Chat-Your-Data Challenge blogpost: https://blog.langchain.dev/chat-your-data-challenge/

Tutorial: ChatGPT Over Your Data blogpost: https://blog.langchain.dev/tutorial-chatgpt-over-your-data/


chat your data github: https://github.com/hwchase17/chat-your-data

streamlit UI template github: https://github.com/hwchase17/langchain-streamlit-template/blob/master/requirements.txt

Comments

Mike W

I attempted to install faiss-cpu but now getting this error: ModuleNotFoundError: No module named 'faiss.swigfaiss_avx2'

echohive42

It is difficult for me to know why this error is happening your particular case but please follow the instructions carefuly and also read the other comments as well as other have posted solutions too. I hope this will help.

echohive42

Also do a search for the error in the discord channel to see if we talked about this error before. Also do a search for the error on google. And at langchain’s GitHub issues.

Mike W

Ok, thank you very much for the info!

Mike W

I reloaded a new environment and now getting this error. At least I got it to upload a document this time! lol. Any ideas if this might be a simple fix or not? The file I uploaded was a simple .txt file so not sure why it gave me this error. ValueError: Invalid file data\openai-cookbook\apps\file-q-and-a\nextjs\public\favicon.ico. The FileType.UNK file type is not supported in partition.

echohive42

Did you use openai cookbook document as your text file? I never saw this error.

Anonymous

Hi, I'm wondering if a file has been deleted from the github as the upload file part is no longer in any script?

echohive42

I am not sure but file uploader is still a par tof it. take a look at this link: https://python.langchain.com/en/latest/modules/document_loaders/examples/unstructured_file.html

Anonymous

thanks... I am getting the following error on run. RuntimeError: There is no current event loop in thread 'ScriptRunner.scriptThread'. Traceback: File "C:\ProgramData\Anaconda3\envs\ChatGPT\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script exec(code, module.__dict__) File "C:\Users\dtrute\Streamlit\chatdocument\app.py", line 98, in openai_api_key_textbox.change( File "C:\Users\dtrute\AppData\Roaming\Python\Python39\site-packages\gradio\blocks.py", line 1142, in __exit__ self.app = routes.App.create_app(self) File "C:\Users\dtrute\AppData\Roaming\Python\Python39\site-packages\gradio\routes.py", line 143, in create_app app = App(default_response_class=ORJSONResponse) File "C:\Users\dtrute\AppData\Roaming\Python\Python39\site-packages\gradio\routes.py", line 113, in __init__ self.lock = asyncio.Lock() File "C:\ProgramData\Anaconda3\envs\ChatGPT\lib\asyncio\locks.py", line 81, in __init__ self._loop = events.get_event_loop() File "C:\ProgramData\Anaconda3\envs\ChatGPT\lib\asyncio\events.py", line 642, in get_event_loop raise RuntimeError('There is no current event loop in thread %r.' Chatgtp comes back that this is related to The error message suggests that there is no event loop running in the current thread. This can happen when an asynchronous function is called outside an event loop, or when the event loop is not running. In your specific case, the error message is triggered by the asyncio.Lock() call in the gradio library. This lock is used to synchronize access to shared resources in the gradio application. To fix the error, you need to make sure that an event loop is running before the lock is created. One way to do this is to wrap your code in an asyncio.run() call, which creates a new event loop and runs the provided coroutine in that loop. Here's an example of how you can modify your code to use asyncio.run():

echohive42

so if we trust chatgpt, this error is resulting from how Gradio is trying to run. So you were then trying this with the gradio interface?

Anonymous

that is what is confusing me... this direct from the script in the github - whish is using gradio https://github.com/hwchase17/chat-your-data/blob/master/app.py

Anonymous

I got the message , where sure I modify ? ===== /Users/afuwang/Library/Python/3.9/lib/python/site-packages/langchain/chains/conversational_retrieval/base.py:161: UserWarning: `ChatVectorDBChain` is deprecated - please use `from langchain.chains import ConversationalRetrievalChain` warnings.warn

echohive42

You don’t have to absolutely modify your code. If you stick with your langchain version. Your code will work but when the old chain is entirely deprecated, you won’t be able to update to newer versions of langchain. Take a look at this documentation about the new retriever chain: https://python.langchain.com/en/latest/use_cases/code.html?highlight=conversational#conversational-retriever-chain

Anonymous

I saw the video and changed the data folder with my folder, but it keeps putting the __pychache__ folder inside the data folder, and im getting this error as a result: ValueError: Invalid file C:\Users\gsanr\PycharmProjects\pythonProject4\app_data\__pycache__\ingest_data.cpython-310.pyc. The FileType.UNK file type is not supported in partition. Your help would be much appreciated, thanks in advance!! (and keep up the good wok)

Dobma

Hi, if I can ask you... I downloaded all files and i am getting this error: NameError: name 'vectorstore' is not defined Traceback: File "D:\mk\python\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script exec(code, module.__dict__) File "D:\mk\python\ready cody\Zkoušení\CHAT_WITH_DATA\main.py", line 63, in docs = vectorstore(user_input) ^^^^^^^^^^^

echohive42

Make sure that vectorstore.pkl file is being created as a file. If not then you will get that error. You can put in print statements like print(“111”), 222, 333 in between lines of code where you think the problem might be happening and watch of those print statements print as a way to try and find where the issue might be arising.

echohive42

This is a rare error that happens. I never saw it myself and not sure what it is about. I tried doing a google search on it and there isn’t much information. One thing you can try is to install earlier versions of langchain like 0.0.90 give or take. If you can’t debug it, after a while just start from scratch in a new virtual environment would be my suggestion.

Dobma

Thanks, now the file is being created but new error showed up :O, it looks like this: TypeError: 'FAISS' object is not callable Traceback: File "D:\mk\python\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script exec(code, module.dict) File "D:\mk\python\ready cody\Zkoušení\CHAT_WITH_DATA\main.py", line 65, in docs = vectorstore(user_input) ^^^^^^^^^^^^^^^^^^^^^^^

echohive42

Please read the other comments to see if others ran into the same error. You can also search the issues section at langchain github. or do a general google search. I don't remember running into that error. If all else fails. start installing from scratch in a new virtual environment following the instructions carefully.

Anonymous

I am actually running into this issue as well. The app was working great for awhile and then I opened it again via Streamlit run and it throws NameError: name 'vectorstore' is not defined when it hits line 64 in the main.py file. Odd behavior given I didn't (intentionally) change anything that I am aware of. ingest_data.py file looks correct and I do see 333 printed after the vector store is created. The error shows up after you upload the txt file, seems to vectorize ok. But when you ask a question it throws the error above. I've even reinstalled everything in a new environment. Still doesn't work.

Pedram Abrari

Have you actually tried installing this into a virgin environment? There are a ton of libraries missing and you get one error after another. Thus far I've had to update requirements.txt to include the following: langchain openai unstructured faiss-cpu streamlit streamlit-chat pexpect pdfminer-six tiktoken Now I'm getting this error: File "/opt/homebrew/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script exec(code, module.__dict__) File "/Users/pedram/chat-your-data/main.py", line 43, in chain = get_chain(vectorstore) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/pedram/chat-your-data/query_data.py", line 28, in get_chain qa_chain = ChatVectorDBChain.from_llm( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/langchain/chains/conversational_retrieval/base.py", line 246, in from_llm return cls( ^^^^ File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__ pydantic.error_wrappers.ValidationError: 1 validation error for ChatVectorDBChain qa_prompt extra fields not permitted (type=value_error.extra)

echohive42

Yes and it took me half a dozen attempts to get it right. This is by no means an easy install. Also libraries have upgraded since this post so there might be some compatibility issues with packages and the code as well. I would suggest trying langchain version 0.0.9~ they’re about to see if that helps with any of the issues. You can also look at some of the newer videos which uses more up to date standards such as : Chat with and Summarize PDF documents with Langchain and OpenAI https://youtu.be/JJ6ATxp42cQ