This project is a retrieval-augmented generation (RAG) chatbot that leverages Qdrant for vector storage and retrieval, Ollama for language model interactions, and SentenceTransformers for generating embeddings. The chatbot can store user inputs, retrieve relevant documents, and generate contextually appropriate responses.
-
Create a virtual environment:
python -m venv venv #or python3 -m venv venv source venv/bin/activate
-
Install the required packages:
pip install -r requirements.txt
-
From the root directory, run Docker Compose:
docker-compose up --build
-
Run Ollama:
ollama run llama2
-
Start the Flask app:
python app.py
-
Access the chatbot at:
http://localhost:3003
To create the rag-chatbot
collection in Qdrant, use the following Python script:
from qdrant_client import QdrantClient
client = QdrantClient(host='db', port=6333)
# Define the schema for the collection
schema = {
"vectors": {
"size": 384, # Size of the vectors from the embedding model
"distance": "Cosine" # Distance metric for vector similarity
}
}
# Create the collection
client.create_collection(
collection_name="rag-chatbot",
vectors_config=schema
)