DEV Community

Cover image for Chat with your documents using ChatGPT 🦾

Chat with your documents using ChatGPT 🦾

Adheeban Manoharan on May 06, 2023

Ever since OpenAI announced their language model ChatGPT, it has been making headlines in the AI world on a daily basis. ChatGPT is being used as t...
Collapse
 
assassin990123 profile image
Assassin •

I installed all dependencies followed the steps.
When I try to run, that occurs these errors.

Image description

How can I fix this error?

Collapse
 
iamadhee profile image
Adheeban Manoharan •

Please use llama_index instead of gpt_index. gpt_index is slowly being deprecated, this error is fixed in llama_index

Collapse
 
assassin990123 profile image
Assassin • • Edited

I updated the code and the demo.pdf is in the same directory with main.py

Image description

But now I had another issue.
How can I fix that?

Collapse
 
securigy profile image
Leon •

I followed the steps you outlined, exactly, and when I run:
python3 c:\projects\ChatWithTheDoc\main.py

I am getting:
ImportError: cannot import name 'BaseLanguageModel' from 'langchain.schema' (C:\Users\Dev\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\langchain\schema.py)

Can you please explain why it does not work?

Collapse
 
iamadhee profile image
Adheeban Manoharan •

Hi @securigy, can you please try upgrading your version of langchain. Try pip3 install -U langchain

Collapse
 
securigy profile image
Leon •

I just did and got at the end:
Successfully installed langchain-0.0.178

However, when trying to run main.py again, I am still getting this:

*ImportError: cannot import name 'BaseLanguageModel' from 'langchain.schema' (C:\Users\Dev\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\langchain\schema.py)
*

Thread Thread
 
iamadhee profile image
Adheeban Manoharan •

Bump your version of llama_index as well. Uninstall gpt_index and use llama_index alone

Thread Thread
 
securigy profile image
Leon •

I did:
pip uninstall gpt_index
then:
pip install --upgrade llama_index
and then:
python3 c:\projects\ChatWithTheDoc\main.py
and got this:

C:\Windows\System32>python3 c:\projects\ChatWithTheDoc\main.py
Traceback (most recent call last):
File "c:\projects\ChatWithTheDoc\main.py", line 1, in
from gpt_index import download_loader, SimpleDirectoryReader, GPTSimpleVectorIndex, LLMPredictor, PromptHelper
ImportError: cannot import name 'download_loader' from 'gpt_index' (unknown location)

Collapse
 
venkatramesh6 profile image
Venkat Ramesh •

Intriguing

Collapse
 
assassin990123 profile image
Assassin •

Help me!!!

Image description

Collapse
 
dariob profile image
Dario Barilà •

thanks! Waiting for the next one!

Collapse
 
iamadhee profile image
Adheeban Manoharan • • Edited

Hi, Thanks for your kind comment. The next one is up. Please give it a read here and share your thoughts.