The objective of this project is to create a simple and easy to use tool that allows users to ask questions about local data. It works by serving local LLM models and a RAG model to answer questions about the data.
The following diagram shows the architecture of the project:
The repository is structured as follows:
├── README.md <- The top-level README for developers using this project.
|
|
├── app.py <- Code to deploy a web app with Streamlit
│
├── *-environment.yaml <- Virtual environment configuration files for pro* and dev*
│
├── tmp <- Folder for temporary files (uploads)
│
├── configs <- Folder for app configuration files
│
├── notebooks <- Folder where jupyter notebooks are located. Development purposes
|
└── src <- Source code for use in this project.
├── processing <- Data processing code. Reading and chunking
├── database <- Database related code
├── embeddings <- Embedding related code
├── llm <- LLM related code
└── helpers <- Various helper functions
To ensure the reproducibility of the project, it is recommended to create a virtual environment. Conda is a package manager that allows you to create virtual environments with different Python versions and install the required dependencies.
The following commands can be used to create a virtual environment using conda:
conda env create -f dev-environment.yaml
The following tools were used in the development of the project:
- SuryaOCR: OCR tool used to extract text from scanned documents.
- Ollama: Get up and running with large language models locally. Used for embedding text data and LLMs serving.
- ChromaDB: Embedding database used to store and retrieve embeddings.
- Streamlit: Streamlit turns data scripts into shareable web apps in minutes. All in pure Python. No front‑end experience required.
We prepared a simple web app to interact with the models. To run the app, execute the following command:
streamlit run app.py
The following is a demo of the web app:
demo.mp4
- Add more models to the app: Hugging Face models, OpenAI models, etc.
- Prevent inserting the same document multiple times in the database.