Footwear companies often face high volumes of customer complaints related to returns, repairs, replacements, or refunds. Managing these requests manually is time-consuming, error-prone, and inconsistent across outlets. STRIDE requires a policy-aware, automated complaint handling system that can enforce warranty rules, detect eligibility, and assist staff in decision-making while maintaining complete auditability.
This project implements a Retrieval-Augmented Generation (RAG) pipeline for STRIDE’s complaint management, combining:
The system ensures strict adherence to company policy, automates repetitive checks, and provides staff with clear next steps.
policies/stride_customer_complaint_policies.md).ingest/ingest_policies.py.Logs/llama.log, Logs/error.log).db/staff_audit.py.Services/prompt_builder.py. +-------------------+
| Customer Message |
+---------+---------+
|
v
+-------------------+
| Semantic Analyzer | <--- INTENT Detection
+---------+---------+
|
v
+--------------------+
| Policy Retriever | <--- Fetch relevant policy chunk
+---------+----------+
|
v
+--------------------+
| Decision Engine | <--- Enforce policy rules
+---------+----------+
|
+-----------+-----------+
| |
v v
+----------------+ +------------------+
| APPROVED / REJECT | | MANUAL REVIEW |
+--------+---------+ +--------+---------+
| |
v v
Staff Notification Ticket Created
| |
+-----------+------------+
v
Customer Response
./
├── api/ # FastAPI routers (chat, staff, admin)
├── db/ # PostgreSQL interactions, staff audit, tickets
├── ingest/ # Policy ingestion scripts
├── Logs/ # General and error logs
├── main.py # FastAPI entry point
├── Models/ # LLM models
├── policies/ # Policy documents
├── rag/ # RAG pipeline components
├── Scripts/ # Model initialization, utilities
├── Services/ # Prompt builder, embedder, pipeline, logger config
└── Web/ # Placeholder for frontend if needed
db/..env with:# --- Environment Variables for Model Configuration ---
MODEL_PATH=PATH_TO_LLM_MODEL.gguf
# --- MODEL Setup ---
CONTEXT_SIZE=CONTEXT_SIZE
BATCH_SIZE=BATCH_SIZE
UPDATE_BATCH_SIZE=UPDATE_BATCH_SIZE
VERBOSE=TRUE/FALSE
# --- Connection Parameters ---
DB_NAME=<DB_NAME>
DB_USER=<DB_USER>
DB_PASSWORD=<DB_PASSWORD>
DB_HOST=<DB_HOST>
DB_PORT=<DB_PORT>
# ----------------JWT KEY----------------------------
JWT_SECRET_KEY=YOUR_JWT_SECRET_KEY
Tables:
sales_schema.ticketsstaff_schema.staffstaff_schema.staff_action_logRecommendation: Use Alembic for production migrations.
# Clone repository
git clone <repo_url>
cd stride_complaint_system
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Place LLM model
Models/LLM_MODEL.gguf
# Run FastAPI
uvicorn main:app --reload
# Health check
curl http://localhost:8000/
Logs/llama.logLogs/error.logdb/staff_audit.pyServices/logger_config.py for consistent formatting and levelsapp.state for shared access; consider request queues..env files and secrets management.The application can be containerized using Docker for consistent local development and deployment environments.
docker build -t stride-complaint-system .
docker run -d \
--name stride-api \
-p 8000:8000 \
--env-file .env \
-v $(pwd)/Models:/app/Models \
stride-complaint-system
Notes:
.gguf) is mounted as a volume to avoid baking large files into the image.Logs/ directory inside the container.FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
Multi-Model Ensemble for Better Decision-Making
Enhanced Analytics & Insights
Automated Policy Updates
Proactive Complaint Prevention
Scalable Model Hosting
Intelligent Ticket Prioritization
Contributions, issues, and feature requests are welcome. Feel free to open an issue or submit a pull request.