StoicStocks is a modern chatbot application that combines rule-based generation with a Retrieval-Augmented Generation (RAG) pipeline. It uses natural language processing to understand user intent and provides responses either from a predefined set or by querying a knowledge base.
- Rule-based intent recognition for common queries
- RAG pipeline for complex queries using Weaviate as a vector database
- Llama3:8b language model running on Ollama for generating responses
- Nomic-embed-text model for text embeddings
- Sleek, responsive UI with real-time streaming of bot responses
- Toggle for context-aware responses
- Python 3.7+
- Flask
- Docker (for running Weaviate)
- Ollama (for running Llama3:8b and nomic-embed-text)
-
Clone the repository:
git clone https://github.com/Hamhunter23/CDSAML-LLM-RAG.git cd stoicstocks
-
Install the required Python packages:
pip install flask weaviate-client ollama langchain
-
Install and set up Docker: Follow the instructions at Docker Installation Guide
-
Install and set up Weaviate using Docker:
docker run -d -p 8080:8080 --name weaviate \ -e AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true \ -e PERSISTENCE_DATA_PATH=/var/lib/weaviate \ semitechnologies/weaviate:latest
-
Install Ollama: Follow the instructions at Ollama Installation Guide
-
Download the required models for Ollama:
ollama pull llama3:8b ollama pull nomic-embed-text
-
Ensure the Weaviate Docker container is running:
docker start weaviate
-
Run the Flask application:
python app.py
-
Open a web browser and navigate to
http://localhost:5000
. -
Start chatting with StoicStocks!
To populate the Weaviate database with your custom data:
-
Ensure the Weaviate Docker container is running.
-
Run the data ingestion script:
python charcterSplitter.py
This script will chunk the text, generate embeddings using the nomic-embed-text model, and upload the data to Weaviate.
- Modify the
intents
andresponses
dictionaries inapp.py
to add or change rule-based responses. - Adjust the chunking parameters in
chunk_and_upload.py
to optimize for your specific use case. - Customize the UI by editing
templates/index.html
.
- If you encounter issues with Weaviate, ensure the Docker container is running and accessible on port 8080.
- For Ollama-related problems, check that the required models (llama3:8b and nomic-embed-text) are correctly installed.
- If you face memory issues when running the Llama3:8b model, consider using a smaller model or adjusting Ollama's resource allocation.