Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat interface created #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ombhojane
Copy link

I have created a chat interface in Streamlit.
I've connected with our model.

Preview :
image
image

Please help to resolve this issue: I am unable to setup this project locally. the 4.7 GB model get installed, when I run main file. config.py also worked. But Builder.py not worked. Heence chormaDB not loaded and unable to run main.py
Since I've chat interface with main.py, It can work in your local system!

Improvements : this is first version of chat interface. we can add voice/enter arrow and make UI better of this.

@Priyamakeshwari
Copy link
Owner

Can you send what error do you get when you run the builder.py file

@ombhojane
Copy link
Author

load INSTRUCTOR_Transformer
max_seq_length 512
Traceback (most recent call last):
File "c:\Users\Om\Desktop\Hactoberfest\TeachGPT\builder.py", line 49, in
builder()
File "c:\Users\Om\Desktop\Hactoberfest\TeachGPT\builder.py", line 37, in builder
db = Chroma.from_documents(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Om\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\vectorstores\chroma.py", line 646, in from_documents
return cls.from_texts(
^^^^^^^^^^^^^^^
File "C:\Users\Om\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\vectorstores\chroma.py", line 610, in from_texts
chroma_collection.add_texts(texts=texts, metadatas=metadatas, ids=ids)
File "C:\Users\Om\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\vectorstores\chroma.py", line 188, in add_texts
embeddings = self._embedding_function.embed_documents(texts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Om\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\embeddings\huggingface.py", line 171, in embed_documents
embeddings = self.client.encode(instruction_pairs, **self.encode_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Om\AppData\Local\Programs\Python\Python311\Lib\site-packages\InstructorEmbedding\instructor.py", line 524, in encode
if isinstance(sentences[0],list):
~~~~~~~~~^^^
IndexError: list index out of range

@Priyamakeshwari
Copy link
Owner

Priyamakeshwari commented Oct 5, 2023

Try installing this library pip install instructorembedding and then run builder.py so vector store is formed and we can use RAG by running the main.py file. I'll update the requirements.txt file soon!

@Priyamakeshwari
Copy link
Owner

Priyamakeshwari commented Oct 6, 2023

@ombhojane I was also facing the issue this morning. You can try this code as a temporary fix for avoiding that error.
Fix 1 : delete the db folder and then builder.py
Fix 2:

from chromadb.errors import InvalidDimensionException
try:
    docsearch = Chroma.from_documents(documents=..., embedding=...)
except InvalidDimensionException:
    Chroma().delete_collection()
    docsearch = Chroma.from_documents(documents=..., embedding=...)

@Priyamakeshwari
Copy link
Owner

@ombhojane Any updates on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants