How ridabayi/e-commerce_ia_agent_for_product_recommendation works
Project Type and Purpose
• This is a cloud-native, full-stack AI-driven recommendation system for e-commerce platforms.
• Core goal: deliver context-aware product recommendations using Retrieval-Augmented Generation (RAG) with LLMs and a vector database, wrapped in a Flask web app and deployed on Kubernetes with full observability and CI/CD.
File Structure
• Top level:
• app.py – Flask entry point and HTTP routes
• Ecommerce_agent/ – core modules:
– Data_ingestion.py, Data_converter.py – ETL into vector DB
– rag_chain.py – RAG orchestration (retrieval + LLM call)
– config.py – environment and secret management
• Data/ – sample/raw data (ebay_reviews.csv)
• static/, templates/ – UI assets (CSS, HTML)
• Dockerfile, flask-deploy.yml – container + K8s manifest for the Flask service
• Grafana/, Prometheus/ – monitoring manifests (deployments, ConfigMaps)
• .github/workflows – CI/CD pipelines (lint, test, security scans)
• utils/ – logging and custom exceptions
Extract Insights from README
• AI stack: Groq API, Hugging Face embeddings, Datastax Astra DB (vector store)
• Deployment target: Google Cloud (VM & Kubernetes)
• Observability: Prometheus metrics + Grafana dashboards
• CI/CD: GitHub Actions with code quality and security gates
Main Components & Their Relationships
a. User Interface (Browser)
→ Sends HTTP requests to the Flask service.
b. Flask Service (Kubernetes Deployment)
– Exposes REST endpoints (app.py + routes).
– Invokes Ecommerce_agent.rag_chain to handle “ask” requests.
– Reads configuration & secrets (config.py).
c. RAG Chain Module
– Queries the vector database (Datastax Astra) for context.
– Calls external LLM APIs (Groq, Hugging Face) to generate recommendations.
– Returns response to Flask.
d. Data Pipeline
– Batch or ad-hoc ingestion (Data_ingestion.py → Data_converter.py → vector DB).
e. Vector Database (Datastax Astra)
– Stores embeddings & metadata for retrieval.
f. External AI Services
– Groq API, Hugging Face embeddings endpoint.
g. Monitoring & Logging
– Flask and module logs (utils/logger → logs/).
– Prometheus scrapes metrics from the Flask service and K8s endpoints.
h. CI/CD & Quality Gates
– GitHub Actions workflows run linting, tests, SonarCloud scans.
– Deployment manifests applied via “flask-deploy.yml” and K8s manifests.
Architectural Patterns & Design Principles
• Microservice: Flask app encapsulates all backend logic.
• RAG Pattern: separation of retrieval (vector DB) and generation (LLM).
• Infrastructure as Code: Dockerfile, K8s YAML (flask-deploy.yml, Grafana-deploy.yml, Prometheus-deploy.yml).
• Observability: metrics + logs + dashboards.
• Secure-by-design: secret management in config maps, container best practices.