ContextCore is a Streamlit-based document chat application for uploading PDFs, extracting their text, indexing the content in Chroma, and asking questions against the uploaded material with a Groq-backed LangChain retrieval chain.
The repository is intentionally small and organized around one pipeline:
- Upload PDFs in the UI.
- Extract text from each page with PyMuPDF.
- Fall back to OCR for scanned pages with PaddleOCR.
- Split the text into chunks and embed them with a sentence-transformer model.
- Persist the chunks in Chroma.
- Retrieve the most relevant chunks and generate an answer with Groq.
- Python 3.x
- A Groq API key
- System dependencies required by OCR and PDF rendering
The Python dependencies are listed in requirements.txt. Install them with:
pip install -r requirements.txtCreate a .env file in the project root and set:
GROQ_API_KEY=your_groq_api_key_hereThe app loads this value at startup and passes it to ChatGroq.
This project uses pdf2image and PaddleOCR for scanned documents. On Windows, you may need to install and configure the external binaries and runtime libraries those packages depend on before OCR works reliably.
Run the app with Streamlit:
streamlit run app.pyThen:
- Upload one or more PDF files.
- Wait for the documents to be processed and indexed.
- Ask a question in the chat input.
- Review the generated answer and the source snippets shown in the table.
Uploaded files are copied into a temporary session directory, indexed into a Chroma store inside that directory, and then queried from the same session.
GROQ_API_KEYis required for the chat model to work.persist_dircontrols where Chroma stores embeddings. In the app, it is placed under the temporary upload directory for the session.
- Remove the hardcoded path from
initialize_chatbot(). - Tighten the answer schema so the model output is easier to parse.
- Refactor session-state handling in the Streamlit app.
- Add tests for extraction, chunking, and retrieval.
- Add a deployment or launch script if the project needs repeatable startup steps.