Skip to content

Commit c822964

Browse files
authored
Merge pull request #50 from fizakhan90/main
Adding PerplexiCart to cookbook
2 parents fd5fc04 + 9e1c9f9 commit c822964

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

docs/showcase/perplexicart.mdx

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
title: PerplexiCart | AI-Powered Value-Aligned Shopping Assistant
3+
description: An AI shopping assistant that uses Perplexity Sonar to deliver structured research, value-aligned recommendations, and transparent citations across the web
4+
sidebar_position: 24
5+
keywords: [PerplexiCart, shopping, e-commerce, recommendations, value alignment, Sonar, Perplexity, Next.js, FastAPI]
6+
---
7+
8+
**PerplexiCart** helps users make informed, value-aligned purchasing decisions. Powered by the **Perplexity Sonar API**, it analyzes products across the web and returns structured insights with prioritized recommendations, pros/cons, trade‑off analysis, and user sentiment — tailored to preferences like Eco‑Friendly, Durability, Ethical, and region‑specific needs.
9+
10+
<iframe
11+
className="w-full aspect-video rounded-xl"
12+
src="https://www.youtube.com/embed/5qzbRas0rxc"
13+
title="YouTube video player"
14+
frameBorder="0"
15+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
16+
allowFullScreen
17+
></iframe>
18+
19+
## Features
20+
21+
* **Intelligent Product Recommendations** beyond simple spec comparison
22+
* **Priority-Based Value Alignment** (Best Value, Eco‑Friendly, Ethical, Durability, Made in India)
23+
* **Contextual Personalization** (skin type, usage patterns, region, etc.)
24+
* **Structured Research Output** with:
25+
- Research summary and top recommendations
26+
- Value alignment with reasoning
27+
- Pros/Cons and key specifications
28+
- User sentiment and community insights (Reddit, Quora)
29+
- Trade‑off analysis and buying tips
30+
* **Transparent Sources** with citations for verification
31+
32+
## Prerequisites
33+
34+
* Node.js 18+ and npm/yarn
35+
* Python 3.10+ and pip
36+
* Perplexity API key
37+
38+
## Installation
39+
40+
```bash
41+
# Clone the repository
42+
git clone https://github.com/fizakhan90/perplexicart.git
43+
cd perplexicart
44+
45+
# Backend (FastAPI) setup
46+
cd backend
47+
python -m venv .venv
48+
source .venv/bin/activate # Windows: .venv\Scripts\activate
49+
pip install -r requirements.txt
50+
51+
# Frontend (Next.js) setup
52+
cd ../frontend
53+
npm install
54+
```
55+
56+
## Configuration
57+
58+
Create a `.env` file in the backend directory:
59+
```ini
60+
PERPLEXITY_API_KEY=your_perplexity_api_key
61+
```
62+
63+
(Optional) Add any app‑specific settings as needed (cache, region defaults, etc.).
64+
65+
## Usage
66+
67+
1. **Start Backend (FastAPI)**:
68+
```bash
69+
cd backend
70+
uvicorn main:app --reload # adapt module:app if your entrypoint differs
71+
```
72+
73+
2. **Start Frontend (Next.js)**:
74+
```bash
75+
cd frontend
76+
npm run dev
77+
```
78+
79+
3. **Open the App**: Visit `http://localhost:3000` and search for a product. Select your priority (e.g., Eco‑Friendly) and add optional context (skin type, region).
80+
81+
## Code Explanation
82+
83+
* **Backend (FastAPI)**: Orchestrates Sonar calls with dynamic prompt engineering based on query, selected priority, and context
84+
* **Structured Outputs**: Enforces a strict JSON schema via `response_format` to ensure consistent UI rendering
85+
* **Live Web Research**: Directs Sonar to search e‑commerce platforms, forums, review blogs, and sustainability reports
86+
* **Semantic Analysis**: Extracts value alignment, pros/cons, sentiment, and cites sources for transparency
87+
* **Frontend (Next.js/React)**: Presents a clear, user‑friendly view of recommendations, trade‑offs, and citations
88+
89+
## How the Sonar API Is Used
90+
91+
PerplexiCart leverages the **Perplexity Sonar API** as its intelligence core, dynamically generating customized prompts based on user inputs like search queries, priorities and context. The API performs comprehensive web research across e-commerce sites, forums, and review platforms, with responses structured in a consistent JSON format. Through semantic analysis, it extracts key product insights including alignment with user priorities, pros/cons, and sentiment - all backed by cited sources. The FastAPI backend processes these structured responses before serving them to the Next.js frontend for a polished user experience.
92+
93+
## Links
94+
95+
- **Live Demo**: https://perplexicart.vercel.app/
96+
- **GitHub Repository**: https://github.com/fizakhan90/perplexicart

0 commit comments

Comments
 (0)