Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ContextCore

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:

  1. Upload PDFs in the UI.
  2. Extract text from each page with PyMuPDF.
  3. Fall back to OCR for scanned pages with PaddleOCR.
  4. Split the text into chunks and embed them with a sentence-transformer model.
  5. Persist the chunks in Chroma.
  6. Retrieve the most relevant chunks and generate an answer with Groq.

Prerequisites

  • 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.txt

Environment Variables

Create a .env file in the project root and set:

GROQ_API_KEY=your_groq_api_key_here

The app loads this value at startup and passes it to ChatGroq.

OCR / PDF Notes

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.

Usage

Run the app with Streamlit:

streamlit run app.py

Then:

  1. Upload one or more PDF files.
  2. Wait for the documents to be processed and indexed.
  3. Ask a question in the chat input.
  4. 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.

Configuration Details

  • GROQ_API_KEY is required for the chat model to work.
  • persist_dir controls where Chroma stores embeddings. In the app, it is placed under the temporary upload directory for the session.

Future Work

  • 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.

About

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.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages