Reading a book can be a fulfilling experience, transporting you to new worlds, introducing you to new characters, and exposing you to new concepts and ideas. However, once you’ve finished reading, you might find yourself with a lot of questions that you’d like to discuss. Perhaps you don’t have anyone nearby who has read the book or is interested in discussing it, or maybe you simply want to explore the book on your own terms. In this situation, you might be left wondering how long it will take to fully digest the book and answer your own questions. Without a tutor or friends around to provide guidance and discussion, you may need to take a more thoughtful and introspective approach to your reading.
Imagine that we are having a non-judgmental AI tutor to assist in the question and answer process can be incredibly helpful, especially when it comes to exploring and applying the ideas presented in a book. An AI can provide unbiased and objective insights into the book’s themes and concepts, and help you to understand the author’s perspective on the subject matter. With an AI’s assistance, you can ask deeper and more meaningful questions, and receive thoughtful and informative responses that can help you to connect the ideas in the book to your own experiences and beliefs. This can lead to a more enriching before and after the reading experience.
In this repository, we take the practical approach of building a question and answering system using OpenAI, LangChain, and FAISS - a library for efficient similarity search and clustering of dense vectors. The book is broken down into smaller documents, and OpenAI embeddings are used to convert them into vectors, which are then stored externally using FAISS.
Here is the general workflow for our application:
- Extract the Book Content
- Split Book into Smaller Chunks
- Build Semantic Index
- Ask a Book Questions
pip install -r requirements.txt
GPU:
pip install faiss
CPU:
pip install faiss-cpu
With streamlit:
streamlit run app.py
With gradio:
pip install -r gr-requirements.txt
gradio run gr-app.py