A local AI assistant that retrieves and chats over website content using a Retrieval-Augmented Generation (RAG) pipeline.
Built with Ollama, LangChain, and ChromaDB for private, on-device knowledge-based conversations.
The project is broken down into three main stages:
-
Crawl (
scraper.py): An automated script starts at a specified URL and crawls through the website, extracting all the clean, textual content from each page. -
Ingest (
ingest.py): The scraped text is broken down into smaller chunks, converted into numerical vector embeddings, and stored in a local vector database (ChromaDB). This database acts as the AI's "brain." -
Chat (
app.py): A Streamlit web application provides a user-friendly chat interface. When a user asks a question, the app retrieves the most relevant information from the database and uses an AI language model to generate a context-aware answer.
-
Ollama: Make sure Ollama is installed and running. You can get it from https://ollama.com/.
-
AI Models: Pull the necessary models by running the following commands in your terminal:
ollama pull nomic-embed-text ollama pull phi3
-
Python: Ensure you have Python 3.9 or newer.
-
Clone the Repository: Get the project files onto your local machine.
-
Create a Virtual Environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
Open the config.py file. This is the only file you need to edit.
-
Set the
START_URLto the homepage of the website you want the bot to learn from. -
Customize the
APP_TITLE,SUBJECT_NAME,ASSISTANT_NAME, etc., to define your bot's identity.
Run the data processing scripts in order. This only needs to be done once for each new website.
-
Run the Scraper: This will crawl the website defined in your config and create
scraped_content.json.python scraper.py
-
Run the Ingestion Script: This will process the JSON file and create the
chroma_dbvector store.python ingest.py
Now you can start the web application.
streamlit run app.py