Description:
We need to enhance the PDF Bot application by integrating an interactive Q&A interface. This feature will allow users to ask questions about the uploaded PDF document and receive context-aware answers along with citations to the relevant pages.
Tasks:
Add a new tab labeled "🤖 Q&A" in the Streamlit app.
Create a helper function (answer_question) that:
Performs a simple keyword search on the PDF text to find relevant pages.
Concatenates text from those pages as context.
Sends the question and context to the OpenAI API to generate an answer that includes citations (e.g., [Page X]).
Display the answer and list the relevant page numbers in the Q&A tab.
Ensure that error handling is in place in case the OpenAI API fails or no relevant pages are found.
Update documentation and add any necessary tests.
Acceptance Criteria:
A new "🤖 Q&A" tab is available in the PDF Bot interface.
Users can input a question and receive a detailed answer with citations referencing the PDF pages.
The implementation leverages the existing PDF processing and OpenAI API integration.
Code is clean, well-documented, and error-handled.
@shreyash3087
@KushalZambare