Skip to content

Using Document to perform question answering task#11

Open
aaroosh-07 wants to merge 3 commits intomainfrom
document-qna
Open

Using Document to perform question answering task#11
aaroosh-07 wants to merge 3 commits intomainfrom
document-qna

Conversation

@aaroosh-07
Copy link
Copy Markdown
Owner

In this PR, we are adding a script to perform question answering task using document pdf file provided by the user. To achieve this we have implemented a RAG which breaks down document into multiple chunks and stores them in Chroma DB using hugging Face embedding model. and uses question to query for relevant chunks and perform QnA task on those chunks.

@aaroosh-07 aaroosh-07 linked an issue Sep 1, 2024 that may be closed by this pull request
3 tasks

Activate the python virtual environment

### hfQnA.py
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to give a hint to the reader what these two different scripts are used for?

import os
import sys

def load_and_split_doc(path: str):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be type hinting at the returns of each method too

return context

def run_rag():
choice = input("Do you want to load the document(y/n): ")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not - Do you want to upload a new document?

chunks = text_splitter.split_documents(docs)
return chunks

def load_chunks_to_vectorstore(chunks):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What type is chunks?

Copy link
Copy Markdown
Collaborator

@prattyushmangal prattyushmangal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, but almost all the functions in DocQnA are unit testable - so please add them along withsome other minor changes.

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.

Use of Document for Question Answering Task

2 participants