Skip to content

Commit 7ea97b0

Browse files
committed
Initial commit: EcomIntelligence Real-Time Product Assistant
- Product assistant with RAG and multi-channel processing - MCP servers for real-time product search - Agentic workflow with web search capabilities - ETL pipeline for data ingestion and scraping - RAGAS evaluation framework - Docker and Kubernetes deployment configs - GitHub Actions CI/CD workflows
0 parents  commit 7ea97b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3364
-0
lines changed

.dockerignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Python cache
2+
__pycache__/
3+
*.pyc
4+
*.pyo
5+
*.pyd
6+
*.pdb
7+
*.egg-info/
8+
*.eggs/
9+
*.manifest
10+
*.spec
11+
12+
# Virtual environments
13+
venv/
14+
15+
# Jupyter notebooks checkpoints
16+
.ipynb_checkpoints
17+
notebook/.ipynb_checkpoints
18+
19+
# Logs & temp
20+
logs/
21+
*.log
22+
*.out
23+
*.tmp
24+
*.bak
25+
26+
# OS / Editor junk
27+
.DS_Store
28+
Thumbs.db
29+
.vscode/
30+
.idea/
31+
*.swp
32+
33+
# Build / Dist
34+
build/
35+
dist/
36+
*.egg-info/
37+
.eggs/

.env.copy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
GROQ_API_KEY
2+
GOOGLE_API_KEY
3+
OPENAI_API_KEY
4+
ASTRA_DB_API_ENDPOINT
5+
ASTRA_DB_APPLICATION_TOKEN
6+
ASTRA_DB_KEYSPACE="default_keyspace"

.github/workflows/deploy.yml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Deploy App to EKS
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
# Configure AWS credentials
18+
- name: Configure AWS credentials
19+
uses: aws-actions/configure-aws-credentials@v2
20+
with:
21+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
22+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
23+
aws-region: ${{ secrets.AWS_REGION }}
24+
25+
# Check if EKS Cluster exists
26+
- name: Check if EKS Cluster exists
27+
run: |
28+
if ! aws eks describe-cluster --name ${{ secrets.EKS_CLUSTER_NAME }} --region ${{ secrets.AWS_REGION }}; then
29+
echo "EKS Cluster not found! Run infra.yml workflow first."
30+
exit 1
31+
fi
32+
33+
# Login to ECR
34+
- name: Login to Amazon ECR
35+
id: login-ecr
36+
uses: aws-actions/amazon-ecr-login@v1
37+
38+
- name: Set Image Tag
39+
id: image-tag
40+
run: |
41+
echo "IMAGE_TAG=$(date +%s)" >> $GITHUB_ENV
42+
echo "::set-output name=tag::$(date +%s)"
43+
44+
# Build, tag and push Docker image to ECR
45+
- name: Build and Push Docker image
46+
env:
47+
REGISTRY: ${{ secrets.ECR_REGISTRY }}
48+
REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
49+
IMAGE_TAG: ${{ steps.image-tag.outputs.tag }}
50+
run: |
51+
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG -t $REGISTRY/$REPOSITORY:latest .
52+
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
53+
docker push $REGISTRY/$REPOSITORY:latest
54+
55+
# Setup kubectl
56+
- name: Setup kubectl
57+
uses: azure/setup-kubectl@v3
58+
with:
59+
version: 'latest'
60+
61+
# Ensure AWS CLI is installed
62+
- name: Install AWS CLI
63+
run: |
64+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
65+
unzip -q awscliv2.zip
66+
sudo ./aws/install --update
67+
aws --version
68+
69+
- name: Print Env Vars
70+
run: |
71+
echo "Region: ${{ secrets.AWS_REGION }}"
72+
echo "Cluster: ${{ secrets.EKS_CLUSTER_NAME }}"
73+
74+
# Update kubeconfig
75+
- name: Update kubeconfig with debug
76+
run: |
77+
aws eks update-kubeconfig \
78+
--name $EKS_CLUSTER_NAME \
79+
--region $AWS_REGION \
80+
--debug
81+
env:
82+
AWS_REGION: ${{ secrets.AWS_REGION }}
83+
EKS_CLUSTER_NAME: ${{ secrets.EKS_CLUSTER_NAME }}
84+
85+
# Debug: Show kubeconfig file
86+
- name: Show kubeconfig
87+
run: |
88+
ls -la ~/.kube || true
89+
cat ~/.kube/config || true
90+
91+
# Create/Update Kubernetes Secret (for API keys)
92+
- name: Create Kubernetes secret for API keys
93+
run: |
94+
kubectl create secret generic product-assistant-secrets \
95+
--from-literal=OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} \
96+
--from-literal=GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }} \
97+
--from-literal=ASTRA_DB_API_ENDPOINT=${{ secrets.ASTRA_DB_API_ENDPOINT }} \
98+
--from-literal=ASTRA_DB_APPLICATION_TOKEN=${{ secrets.ASTRA_DB_APPLICATION_TOKEN }} \
99+
--from-literal=ASTRA_DB_KEYSPACE=${{ secrets.ASTRA_DB_KEYSPACE }} \
100+
--dry-run=client -o yaml | kubectl apply -f -
101+
102+
# Deploy manifests
103+
- name: Apply Kubernetes manifests
104+
run: |
105+
kubectl apply -f k8/deployment.yaml
106+
kubectl apply -f k8/service.yaml
107+
108+
- name: Patch deployment with new image tag
109+
env:
110+
REGISTRY: ${{ secrets.ECR_REGISTRY }}
111+
REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
112+
IMAGE_TAG: ${{ steps.image-tag.outputs.tag }}
113+
run: |
114+
kubectl set image deployment/product-assistant product-assistant=$REGISTRY/$REPOSITORY:$IMAGE_TAG
115+
116+
117+
# Verify rollout
118+
- name: Verify Deployment
119+
run: |
120+
set -e
121+
if ! kubectl rollout status deployment/product-assistant --timeout=120s; then
122+
echo "Rollout failed, collecting debug info..."
123+
kubectl describe deployment product-assistant || true
124+
kubectl get pods -o wide || true
125+
for pod in $(kubectl get pods -l app=product-assistant -o jsonpath='{.items[*].metadata.name}'); do
126+
echo "--- Logs for pod: $pod ---"
127+
kubectl logs $pod --all-containers --tail=100 || true
128+
done
129+
exit 1
130+
fi
131+
132+
# Show Service details
133+
- name: Get Service Info
134+
run: kubectl get svc product-assistant-service -o wide

.github/workflows/infra.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Provision Infra (EKS + ECR)
2+
3+
on:
4+
workflow_dispatch: # manual trigger only
5+
6+
jobs:
7+
provision:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v3
13+
14+
# Configure AWS credentials
15+
- name: Configure AWS credentials
16+
uses: aws-actions/configure-aws-credentials@v2
17+
with:
18+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
19+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
20+
aws-region: ${{ secrets.AWS_REGION }}
21+
22+
# Deploy CloudFormation Stack
23+
- name: Deploy CloudFormation Stack
24+
run: |
25+
aws cloudformation deploy \
26+
--stack-name product-assistant-cluster \
27+
--template-file infra/eks-with-ecr.yaml \
28+
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM \
29+
--region ${{ secrets.AWS_REGION }}

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Python-generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# Virtual environments
10+
.venv
11+
# Virtual environment
12+
env/
13+
venv/
14+
15+
# IDE/editor settings
16+
.vscode/
17+
.idea/
18+
19+
# Environment files
20+
.env
21+
*.env
22+
23+
# Logs
24+
*.log
25+
26+
# Jupyter Notebook checkpoints
27+
.ipynb_checkpoints/
28+
29+
archive/
30+
31+
.vscode/

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM python:3.11-slim
2+
3+
WORKDIR /app
4+
5+
# install git
6+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
7+
8+
COPY requirements.txt pyproject.toml ./
9+
COPY prod_assistant ./prod_assistant
10+
11+
RUN pip install --no-cache-dir -r requirements.txt
12+
13+
COPY . .
14+
15+
EXPOSE 8000
16+
17+
# run uvicorn properly on 0.0.0.0:8000
18+
CMD ["bash", "-c", "python prod_assistant/mcp_servers/product_search_server.py & uvicorn prod_assistant.router.main:app --host 0.0.0.0 --port 8000 --workers 2"]

data/product_reviews.csv

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
product_id,product_title,rating,total_reviews,price,top_reviews
2+
itmb102b8a51100e,"Apple iPhone 16 Pro Max (Desert Titanium, 256 GB)",4.6,95,"₹1,37,900","5 Excellent iPhone 16 Pro Max | Desert Titanium | So powerful like a mini supercomputer ❤️ READ MORE Saransh Goswami Certified Buyer , Noida 11 months ago 1924 804 Permalink Report Abuse || 5 Terrific purchase Awesome READ MORE Eliyas Khan Certified Buyer , Betul 7 months ago 152 52 Permalink Report Abuse || 5 Best in the market! This is a mini supercomputer. Speed just wow !!! READ MORE SHUBHANKAR KARMAKAR Certified Buyer , North 24 Parganas 10 months ago 1260 544 Permalink Report Abuse"
3+
itm7e75db4f27bd5,"Apple iPhone 16 Pro Max (Black Titanium, 256 GB)",4.6,95,"₹1,37,900","5 Excellent iPhone 16 Pro Max | Desert Titanium | So powerful like a mini supercomputer ❤️ READ MORE Saransh Goswami Certified Buyer , Noida 11 months ago 1924 804 Permalink Report Abuse || 5 Terrific purchase Awesome READ MORE Eliyas Khan Certified Buyer , Betul 7 months ago 152 52 Permalink Report Abuse || 5 Best in the market! This is a mini supercomputer. Speed just wow !!! READ MORE SHUBHANKAR KARMAKAR Certified Buyer , North 24 Parganas 10 months ago 1260 544 Permalink Report Abuse"
4+
itmd7440318746d1,"Apple iPhone 16 Pro Max (Natural Titanium, 512 GB)",4.6,95,"₹1,57,900","5 Excellent iPhone 16 Pro Max | Desert Titanium | So powerful like a mini supercomputer ❤️ READ MORE Saransh Goswami Certified Buyer , Noida 11 months ago 1924 804 Permalink Report Abuse || 5 Terrific purchase Awesome READ MORE Eliyas Khan Certified Buyer , Betul 7 months ago 152 52 Permalink Report Abuse || 5 Best in the market! This is a mini supercomputer. Speed just wow !!! READ MORE SHUBHANKAR KARMAKAR Certified Buyer , North 24 Parganas 10 months ago 1260 544 Permalink Report Abuse"
5+
itm78c52ab1c6488,"Apple iPhone 16 Pro Max (White Titanium, 256 GB)",4.6,95,"₹1,37,900","5 Excellent iPhone 16 Pro Max | Desert Titanium | So powerful like a mini supercomputer ❤️ READ MORE Saransh Goswami Certified Buyer , Noida 11 months ago 1924 804 Permalink Report Abuse || 5 Terrific purchase Awesome READ MORE Eliyas Khan Certified Buyer , Betul 7 months ago 152 52 Permalink Report Abuse || 5 Best in the market! This is a mini supercomputer. Speed just wow !!! READ MORE SHUBHANKAR KARMAKAR Certified Buyer , North 24 Parganas 10 months ago 1260 544 Permalink Report Abuse"
6+
itmff24c14e68d14,"Apple iPhone 13 Pro Max (Silver, 256 GB)",4.6,193,"₹1,39,900","5 Perfect product! This is it, I am in love with my Oh.So.Pro🥰😍 READ MORE Nimisha yadav Certified Buyer , Bengaluru Nov, 2021 11643 1284 Permalink Report Abuse || 5 Worth every penny Truly the best pro max. Worth the upgrade..Awesome build quality READ MORE Chandan Hazarika Certified Buyer , North Lakhimpur Feb, 2022 5558 824 Permalink Report Abuse || 5 Fabulous! Best in class READ MORE Sumrendra Singh Certified Buyer , Lucknow Oct, 2021 1925 271 Permalink Report Abuse"
7+
itmdbb23fa63b708,"Apple iPhone 13 Pro Max (Graphite, 1 TB)",4.6,193,"₹1,79,900","5 Perfect product! This is it, I am in love with my Oh.So.Pro🥰😍 READ MORE Nimisha yadav Certified Buyer , Bengaluru Nov, 2021 11643 1284 Permalink Report Abuse || 5 Worth every penny Truly the best pro max. Worth the upgrade..Awesome build quality READ MORE Chandan Hazarika Certified Buyer , North Lakhimpur Feb, 2022 5558 824 Permalink Report Abuse || 5 Fabulous! Best in class READ MORE Sumrendra Singh Certified Buyer , Lucknow Oct, 2021 1925 271 Permalink Report Abuse"
8+
itmcb824a3301158,"Apple iPhone 13 Pro Max (Sierra Blue, 256 GB)",4.6,193,"₹1,39,900","5 Perfect product! This is it, I am in love with my Oh.So.Pro🥰😍 READ MORE Nimisha yadav Certified Buyer , Bengaluru Nov, 2021 11643 1284 Permalink Report Abuse || 5 Worth every penny Truly the best pro max. Worth the upgrade..Awesome build quality READ MORE Chandan Hazarika Certified Buyer , North Lakhimpur Feb, 2022 5558 824 Permalink Report Abuse || 5 Fabulous! Best in class READ MORE Sumrendra Singh Certified Buyer , Lucknow Oct, 2021 1925 271 Permalink Report Abuse"
9+
itm282cb973542f0,"Apple iPhone 13 Pro Max (Silver, 512 GB)",4.6,193,"₹1,59,900","5 Perfect product! This is it, I am in love with my Oh.So.Pro🥰😍 READ MORE Nimisha yadav Certified Buyer , Bengaluru Nov, 2021 11643 1284 Permalink Report Abuse || 5 Worth every penny Truly the best pro max. Worth the upgrade..Awesome build quality READ MORE Chandan Hazarika Certified Buyer , North Lakhimpur Feb, 2022 5558 824 Permalink Report Abuse || 5 Fabulous! Best in class READ MORE Sumrendra Singh Certified Buyer , Lucknow Oct, 2021 1925 271 Permalink Report Abuse"
10+
itmbadc894a42a39,"IQOO NEO9 PRO (Fiery Red, 128 GB)",4.5,47,"₹32,449","5 Mind-blowing purchase Good ausom READ MORE Chetu Runwal Certified Buyer , Kinwat Mar, 2024 324 92 Permalink Report Abuse || 5 Wonderful Phone is good gaming and all normal use READ MORE Sooraj Appu Certified Buyer , Palakkad District Mar, 2024 291 82 Permalink Report Abuse || 5 Great product Value for money mobile READ MORE Sanjay Haldar Certified Buyer , Noida Mar, 2024 406 120 Permalink Report Abuse"
11+
itmbadc894a42a39,"IQOO Neo9 Pro (Fiery Red, 256 GB)",4.5,47,"₹38,900","5 Mind-blowing purchase Good ausom READ MORE Chetu Runwal Certified Buyer , Kinwat Mar, 2024 324 92 Permalink Report Abuse || 5 Wonderful Phone is good gaming and all normal use READ MORE Sooraj Appu Certified Buyer , Palakkad District Mar, 2024 291 82 Permalink Report Abuse || 5 Great product Value for money mobile READ MORE Sanjay Haldar Certified Buyer , Noida Mar, 2024 406 120 Permalink Report Abuse"
12+
itmb395142fd7c8b,"IQOO Neo 9 Pro (Fiery Red, 256 GB)",4.5,16,"₹37,490","5 Classy product Vlue for money 💰 READ MORE AKASH R Certified Buyer , Cuddalore Apr, 2024 641 185 Permalink Report Abuse || 5 Brilliant Good READ MORE Sreenu Vakada Certified Buyer , East Godavari District Apr, 2024 230 67 Permalink Report Abuse || 5 Great product Beast pho READ MORE Mukesh Chohan Certified Buyer , New Delhi Aug, 2024 81 23 Permalink Report Abuse"
13+
itmb395142fd7c8b,"IQOO Neo 9 Pro (Conqueror Black, 256 GB)",4.5,16,"₹38,989","5 Classy product Vlue for money 💰 READ MORE AKASH R Certified Buyer , Cuddalore Apr, 2024 641 185 Permalink Report Abuse || 5 Brilliant Good READ MORE Sreenu Vakada Certified Buyer , East Godavari District Apr, 2024 230 67 Permalink Report Abuse || 5 Great product Beast pho READ MORE Mukesh Chohan Certified Buyer , New Delhi Aug, 2024 81 23 Permalink Report Abuse"

get_lib_versions.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import importlib.metadata
2+
packages = [
3+
"ragas",
4+
"langchain-mcp-adapters",
5+
"mcp",
6+
"ddgs",
7+
"langchain-openai"
8+
]
9+
for pkg in packages:
10+
try:
11+
version = importlib.metadata.version(pkg)
12+
print(f"{pkg}=={version}")
13+
except importlib.metadata.PackageNotFoundError:
14+
print(f"{pkg} (not installed)")

0 commit comments

Comments
 (0)