Skip to content

Commit 29ad6a4

Browse files
committed
docs: add Valetudo AI to Perplexity Cookbook showcase
1 parent 36b663d commit 29ad6a4

File tree

1 file changed

+203
-0
lines changed

1 file changed

+203
-0
lines changed

docs/showcase/valetudo-ai.mdx

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
---
2+
title: Valetudo AI — Trusted Medical Answer Assistant
3+
description: Perplexity Sonar-powered medical assistant that delivers science-backed answers with verified citations — featuring prompt templates, filters, and image upload.
4+
sidebar_position: 1
5+
keywords: [medical, AI assistant, Perplexity Sonar, healthcare, citations, trusted sources, image upload, prompt templates, health bot]
6+
---
7+
8+
# Project Title
9+
10+
**Valetudo AI** is a Perplexity Sonar-powered assistant that delivers fast, reliable, and well-cited answers to medical questions. Designed for parents, patients, and students — it cuts through misinformation with smart filters, visual input, and prompt-based queries.
11+
12+
## Features
13+
14+
- **Answers with Citations:** Provides numbered scientific citations from a curated list of **10** trusted medical **sources**.
15+
- **Advanced Filtering:** Allows users to filter results **by date and country** to get the most relevant information.
16+
- **Image Upload:** Supports visual context for queries (e.g., **photos** of medications or conditions).
17+
- **Prompt Templates:** Includes **7 categories** of pre-built prompts for common medical questions:
18+
- Symptom-based advice
19+
- Drug interaction checks
20+
- Safety timing
21+
- Safer treatments
22+
- Compare effectiveness
23+
- Recommended exercises
24+
- Latest research
25+
- **Clean & Simple UI:** Built with React and Tailwind CSS for a **user-friendly** experience.
26+
27+
## Prerequisites
28+
29+
Before installing and running Valetudo AI locally, ensure you have the following installed:
30+
31+
- **Node.js** (tested with v22.15.0) and **npm** – for running the frontend (React + Vite)
32+
- **Python** (tested with v3.13.4) and **pip** – for the Flask backend
33+
- **Git** – to clone the repository
34+
- A valid **Perplexity API key** – required to query the Sonar API ([how to generate one](https://docs.perplexity.ai/getting-started/quickstart))
35+
- (Optional) **Virtual environment support** (e.g., `venv`) – for isolating Python dependencies
36+
- (Optional) A modern web browser (e.g., Chrome) – to access the app
37+
38+
## Installation
39+
40+
### 1. Clone the repo
41+
42+
```bash
43+
git clone https://github.com/vero-code/valetudo-ai.git
44+
cd valetudo-ai
45+
```
46+
47+
### 2. Set environment variables
48+
49+
Create a `.env` file inside the `/backend` folder with the following content:
50+
51+
`PERPLEXITY_API_KEY=your_api_key_here`
52+
53+
> Refer to `/backend/.env.example` for guidance.
54+
> Never commit your `.env` file to version control.
55+
56+
### 3. Start the frontend
57+
58+
```bash
59+
npm install
60+
npm run dev
61+
```
62+
63+
### 4. Start the backend
64+
65+
```bash
66+
cd backend
67+
python -m venv venv
68+
69+
# Activate virtual environment
70+
# On Windows:
71+
venv\Scripts\activate
72+
73+
# On macOS/Linux:
74+
source venv/bin/activate
75+
76+
pip install -r requirements.txt
77+
python app.py
78+
```
79+
80+
The app will be available at [http://localhost:5173](http://localhost:5173)
81+
82+
## Usage
83+
84+
Here are some ways to use Valetudo AI effectively:
85+
86+
### 1. Ask a health question
87+
88+
- Type a question like:
89+
_"What to do if a 5-year-old has a fever?"_
90+
- Click **"Ask AI"**
91+
- Expand the full answer
92+
- Hover over citation numbers to preview and copy links
93+
94+
### 2. Use filters
95+
96+
- Click **"Show advanced options"**
97+
- Set a custom **date range**
98+
- Choose a **country** to localize results
99+
100+
### 3. Upload an image
101+
102+
- Drag and drop or manually upload a photo (e.g., medication or condition)
103+
- Ask: _"What is this medication?"_
104+
- The AI will use image context in its response
105+
106+
### 4. Try prompt templates
107+
108+
- Click **"Try Prompts"**
109+
- Select one of **7 categories**
110+
- Fill in the fields and generate a ready-to-send query
111+
- Use the **follow-up input** to refine or expand the conversation
112+
113+
## Code Explanation
114+
115+
### Perplexity API Integration
116+
117+
Valetudo AI leverages the Sonar API to its full potential. The core Q&A functionality is powered by [Perplexity Sonar Pro API](https://docs.perplexity.ai).
118+
119+
| Feature | API Field | Usage |
120+
|-----------------------|------------------------------------|------------------------------------------------------------------------|
121+
| Search Context Size | `search_context_size: medium` | Balances depth and speed of the response for concise medical answers. |
122+
| Domain Filtering | `search_domain_filter` | Limits answers to a curated list of trusted medical domains. |
123+
| Image Upload | `image_url` | Enables visual-based questions like identifying medications or rashes. |
124+
| Date Filtering | `search_after/before_date_filter` | Allows users to narrow results by recency — useful for evolving topics.|
125+
| User Location Filter | `user_location` | Prioritizes sources or context relevant to the user's country. |
126+
127+
> These parameters enable precise control over search quality, scope, and context — especially useful in the medical domain.
128+
129+
### Project Structure
130+
131+
```
132+
valetudo-ai/
133+
134+
├── backend/ # Flask backend API
135+
├── public/ # Static files
136+
├── screenshots/ # UI Images
137+
├── src/
138+
│ ├── assets/ # Media resources
139+
│ ├── components/ # React components
140+
│ ├── constants/ # Mock data and templates
141+
│ ├── hooks/ # Custom React hooks
142+
│ ├── utils/ # Helper functions
143+
│ ├── App.jsx # Routes
144+
│ ├── index.css # Styles
145+
│ └── main.jsx # App entry point
146+
├── index.html # Main HTML file
147+
├── LICENSE # License file
148+
├── package.json # Dependencies
149+
├── README.md # Documentation
150+
└── vite.config.js # Vite config
151+
```
152+
153+
### Key Components
154+
155+
- `HeroSection` — main landing interface with input, filters, and image upload
156+
- `AskPage` — prompt-driven question builder with follow-up form
157+
- `QuickAnswerBox` — renders Sonar response with Markdown and citation links
158+
159+
### Security
160+
161+
- No user data is stored or tracked
162+
- API key is managed securely via `.env`
163+
164+
## Links
165+
166+
- [GitHub Repository](https://github.com/vero-code/valetudo-ai)
167+
- [Devpost Submission](https://devpost.com/software/valetudo-ai)
168+
169+
## Limitations
170+
171+
- Valetudo AI is **not a medical tool** — for informational purposes only.
172+
- **Response time** may vary depending on filters or image upload size.
173+
- **Mobile layout** is simplified; optimized for desktop use.
174+
- **Disclaimer**: Always consult a doctor for any clinical decisions.
175+
176+
## Demo Video
177+
178+
Curious how Valetudo AI works in action?
179+
Watch a short walkthrough here:
180+
181+
[![Watch the demo](https://img.youtube.com/vi/AX3nOh9LbTc/0.jpg)](https://www.youtube.com/watch?v=AX3nOh9LbTc)
182+
183+
## Screenshots
184+
185+
### Home Interface
186+
187+
<img src="https://github.com/vero-code/valetudo-ai/blob/master/screenshots/1-home.png" alt="Home screen" width="800" />
188+
189+
### Prompt Templates
190+
191+
<img src="https://github.com/vero-code/valetudo-ai/blob/master/screenshots/10-prompts.png" alt="Prompt templates" width="800" />
192+
193+
### Image Upload
194+
195+
<img src="https://github.com/vero-code/valetudo-ai/blob/master/screenshots/8-image-upload.png" alt="Image upload" width="800" />
196+
197+
### Date & Location Filters
198+
199+
<img src="https://github.com/vero-code/valetudo-ai/blob/master/screenshots/7-date-filter.png" alt="Date filter" width="800" />
200+
201+
<img src="https://github.com/vero-code/valetudo-ai/blob/master/screenshots/9-location-filter.png" alt="Location filter" width="800" />
202+
203+
> View more screenshots in the [GitHub screenshots folder](https://github.com/vero-code/valetudo-ai/tree/master/screenshots)

0 commit comments

Comments
 (0)