This tool allows you to ask questions about your PDF documents. It uses AI to understand your PDFs and provide relevant answers based on their content.
- Create a folder named
knowledge_base
in the same location as the program - Put all your PDF files that you want to ask questions about into the
knowledge_base
folder
Open your Terminal (Command Prompt on Windows) and run these commands:
ollama pull nomic-embed-text
ollama pull gemma3:1b
Wait for each command to complete before running the next one. This might take a few minutes depending on your internet speed.
- Open the file named
rag.py
in a text editor - Find this section at the bottom of the file:
def main(): config = RAGConfig() rag_system = RAGSystem(config) response = rag_system.query("what is mcp-solver") # Change this line print(response)
- Replace
"what is mcp-solver"
with your own question in quotes - Save the file
- Run the program
Your folder structure should look like this:
your_folder/
│
├── knowledge_base/
│ ├── document1.pdf
│ ├── document2.pdf
│ └── ...
│
├── rag.py
└── embeddings/ (this will be created automatically)
- Make sure your PDFs are readable (not scanned images)
- The first time you run a query, it might take longer as the system needs to process the PDFs
- Subsequent queries will be faster as the system saves its processed data
- Keep your questions clear and specific for better results
Instead of:
response = rag_system.query("what is mcp-solver")
You can try:
response = rag_system.query("What are the main points in Chapter 1?")
# or
response = rag_system.query("What does the document say about project management?")
# or
response = rag_system.query("Can you summarize the conclusion?")
- The system works best with clear, specific questions
- If you get unclear answers, try rephrasing your question
- Add new PDFs anytime by putting them in the
knowledge_base
folder - The system will automatically process new PDFs when you ask questions
If you encounter issues:
- Make sure all your PDFs are in the
knowledge_base
folder - Verify that you've installed the AI models correctly
- Check that your question is properly formatted with quotes
- Ensure your PDFs are text-based and not scanned images