## ✨ Features
* **🌐 Web-Connected AI**: Uses Perplexity's Sonar API for up-to-date information
* **⚡ Slash Command**: Simple `/ask` command for questions
* **💬 Mention Support**: Ask questions by mentioning the bot
* **🔗 Source Citations**: Automatically formats and links to sources
* **🔒 Secure Setup**: Environment-based configuration for API keys
## 🛠️ Prerequisites
**Mention the Bot:**
```
@YourBot [your question here]
```
## 📊 Response Format
The bot provides clean, readable responses with:
* **AI Answer**: Direct response from Perplexity's Sonar API
* **Source Citations**: Clickable links to sources (when available)
* **Automatic Truncation**: Responses are trimmed to fit Discord's limits
## 🔧 Technical Details
This bot uses:
* **Model**: Perplexity's `sonar-pro` model
* **Response Limit**: 2000 tokens from API, truncated to fit Discord
* **Temperature**: 0.2 for consistent, factual responses
* **No Permissions**: Anyone in the server can use the bot
# Disease Information App
Source: https://docs.perplexity.ai/cookbook/examples/disease-qa/README
An interactive browser-based application that provides structured information about diseases using Perplexity's Sonar API
# Disease Information App
An interactive browser-based application that provides structured information about diseases using Perplexity's Sonar API. This app generates a standalone HTML interface that allows users to ask questions about various diseases and receive organized responses with citations.

## 🌟 Features
* **User-Friendly Interface**: Clean, responsive design that works across devices
* **AI-Powered Responses**: Leverages Perplexity's Sonar API for accurate medical information
* **Structured Knowledge Cards**: Organizes information into Overview, Causes, and Treatments
* **Citation Tracking**: Lists sources of information with clickable links
* **Client-Side Caching**: Prevents duplicate API calls for previously asked questions
* **Standalone Deployment**: Generate a single HTML file that can be used without a server
* **Comprehensive Error Handling**: User-friendly error messages and robust error management
## 📋 Requirements
* Python 3.6+
* Jupyter Notebook or JupyterLab (for development/generation)
* Required packages:
* requests
* pandas
* python-dotenv
* IPython
## 🚀 Setup & Installation
1. Clone this repository or download the notebook
2. Install the required packages:
```bash theme={null}
# Install from requirements file (recommended)
pip install -r requirements.txt
# Or install manually
pip install requests pandas python-dotenv ipython
```
3. Set up your Perplexity API key:
* Create a `.env` file in the same directory as the notebook
* Add your API key: `PERPLEXITY_API_KEY=your_api_key_here`
## 🔧 Usage
### Running the Notebook
1. Open the notebook in Jupyter:
```bash theme={null}
jupyter notebook Disease_Information_App.ipynb
```
2. Run all cells to generate and launch the browser-based application
3. The app will automatically open in your default web browser
### Using the Generated HTML
You can also directly use the generated `disease_qa.html` file:
1. Open it in any modern web browser
2. Enter a question about a disease (e.g., "What is diabetes?", "Tell me about Alzheimer's disease")
3. Click "Ask" to get structured information about the disease
### Deploying the App
For personal or educational use, simply share the generated HTML file.
For production use, consider:
1. Setting up a proper backend to secure your API key
2. Hosting the file on a web server
3. Adding analytics and user management as needed
## 🔍 How It Works
This application:
1. Uses a carefully crafted prompt to instruct the AI to output structured JSON
2. Processes this JSON to extract Overview, Causes, Treatments, and Citations
3. Presents the information in a clean knowledge card format
4. Implements client-side API calls with proper error handling
5. Provides a responsive design suitable for both desktop and mobile
## ⚙️ Technical Details
### API Structure
The app expects the AI to return a JSON object with this structure:
```json theme={null}
{
"overview": "A brief description of the disease.",
"causes": "The causes of the disease.",
"treatments": "Possible treatments for the disease.",
"citations": ["https://example.com/citation1", "https://example.com/citation2"]
}
```
### Files Generated
* `disease_qa.html` - The standalone application
* `disease_app.log` - Detailed application logs (when running the notebook)
### Customization Options
You can modify:
* The HTML/CSS styling in the `create_html_ui` function
* The AI model used (default is "sonar-pro")
* The structure of the prompt for different information fields
* Output file location and naming
## 🛠️ Extending the App
Potential extensions:
* Add a Flask/Django backend to secure the API key
* Implement user accounts and saved questions
* Add visualization of disease statistics
* Create a comparison view for multiple diseases
* Add natural language question reformatting
* Implement feedback mechanisms for answer quality
## ⚠️ Important Notes
* **API Key Security**: The current implementation embeds your API key in the HTML file. This is suitable for personal use but not for public deployment.
* **Not Medical Advice**: This app provides general information and should not be used for medical decisions. Always consult healthcare professionals for medical advice.
* **API Usage**: Be aware of Perplexity API rate limits and pricing for your account.
## 📜 License
[MIT License](https://github.com/ppl-ai/api-cookbook/blob/main/LICENSE)
## 🙏 Acknowledgements
* This project uses the [Perplexity AI Sonar API](https://docs.perplexity.ai/)
* Inspired by interactive knowledge bases and medical information platforms
# Fact Checker CLI
Source: https://docs.perplexity.ai/cookbook/examples/fact-checker-cli/README
A command-line tool that identifies false or misleading claims in articles or statements using Perplexity's Sonar API
# Fact Checker CLI
A command-line tool that identifies false or misleading claims in articles or statements using Perplexity's Sonar API for web research.
## Features
* Analyze claims or entire articles for factual accuracy
* Identify false, misleading, or unverifiable claims
* Provide explanations and corrections for inaccurate information
* Output results in human-readable format or structured JSON
* Cite reliable sources for fact-checking assessments
* Leverages Perplexity's structured outputs for reliable JSON parsing (for Tier 3+ users)
## Installation
### 1. Install required dependencies
```bash theme={null}
# Install from requirements file (recommended)
pip install -r requirements.txt
# Or install manually
pip install requests pydantic newspaper3k
```
### 2. Make the script executable
```bash theme={null}
chmod +x fact_checker.py
```
## API Key Setup
The tool requires a Perplexity API key to function. You can provide it in one of these ways:
### 1. As a command-line argument
```bash theme={null}
./fact_checker.py --api-key YOUR_API_KEY
```
### 2. As an environment variable
```bash theme={null}
export PPLX_API_KEY=YOUR_API_KEY
```
### 3. In a file
Create a file named `pplx_api_key` or `.pplx_api_key` in the same directory as the script:
```bash theme={null}
echo "YOUR_API_KEY" > .pplx_api_key
chmod 600 .pplx_api_key
```
**Note:** If you're using the structured outputs feature, you'll need a Perplexity API account with Tier 3 or higher access level.
## Quick Start
Run the following command immediately after setup:
```bash theme={null}
./fact_checker.py -t "The Earth is flat and NASA is hiding the truth."
```
This will analyze the claim, research it using Perplexity's Sonar API, and return a detailed fact check with ratings, explanations, and sources.
## Usage
### Check a claim
```bash theme={null}
./fact_checker.py --text "The Earth is flat and NASA is hiding the truth."
```
### Check an article from a file
```bash theme={null}
./fact_checker.py --file article.txt
```
### Check an article from a URL
```bash theme={null}
./fact_checker.py --url https://www.example.com/news/article-to-check
```
### Specify a different model
```bash theme={null}
./fact_checker.py --text "Global temperatures have decreased over the past century." --model "sonar-pro"
```
### Output results as JSON
```bash theme={null}
./fact_checker.py --text "Mars has a breathable atmosphere." --json
```
### Use a custom prompt file
```bash theme={null}
./fact_checker.py --text "The first human heart transplant was performed in the United States." --prompt-file custom_prompt.md
```
### Enable structured outputs (for Tier 3+ users)
Structured output is disabled by default. To enable it, pass the `--structured-output` flag:
```bash theme={null}
./fact_checker.py --text "Vaccines cause autism." --structured-output
```
### Get help
```bash theme={null}
./fact_checker.py --help
```
## Output Format
The tool provides output including:
* **Overall Rating**: MOSTLY\_TRUE, MIXED, or MOSTLY\_FALSE
* **Summary**: A brief overview of the fact-checking findings
* **Claims Analysis**: A list of specific claims with individual ratings:
* TRUE: Factually accurate and supported by evidence
* FALSE: Contradicted by evidence
* MISLEADING: Contains some truth but could lead to incorrect conclusions
* UNVERIFIABLE: Cannot be conclusively verified with available information
* **Explanations**: Detailed reasoning for each claim
* **Sources**: Citations and URLs used for verification
## Example
Run the following command:
```bash theme={null}
./fact_checker.py -t "The Great Wall of China is visible from the moon."
```
Example output:
```
Fact checking in progress...
🔴 OVERALL RATING: MOSTLY_FALSE
📝 SUMMARY:
The claim that the Great Wall of China is visible from the moon is false. This is a common misconception that has been debunked by NASA astronauts and scientific evidence.
🔍 CLAIMS ANALYSIS:
Claim 1: ❌ FALSE
Statement: "The Great Wall of China is visible from the moon."
Explanation: The Great Wall of China is not visible from the moon with the naked eye. NASA astronauts have confirmed this, including Neil Armstrong who stated he could not see the Wall from lunar orbit. The Wall is too narrow and is similar in color to its surroundings when viewed from such a distance.
Sources:
- NASA.gov
- Scientific American
- National Geographic
```
## Limitations
* The accuracy of fact-checking depends on the quality of information available through the Perplexity Sonar API.
* Like all language models, the underlying AI may have limitations in certain specialized domains.
* The structured outputs feature requires a Tier 3 or higher Perplexity API account.
* The tool does not replace professional fact-checking services for highly sensitive or complex content.
# Financial News Tracker
Source: https://docs.perplexity.ai/cookbook/examples/financial-news-tracker/README
A real-time financial news monitoring tool that fetches and analyzes market news using Perplexity's Sonar API
# Financial News Tracker
A command-line tool that fetches and analyzes real-time financial news using Perplexity's Sonar API. Get comprehensive market insights, news summaries, and investment analysis for any financial topic.
## Features
* Real-time financial news aggregation from multiple sources
* Market sentiment analysis (Bullish/Bearish/Neutral)
* Impact assessment for news items (High/Medium/Low)
* Sector and company-specific analysis
* Investment insights and recommendations
* Customizable time ranges (24h to 1 year)
* Structured JSON output support
* Beautiful emoji-enhanced CLI output
## Installation
### 1. Install required dependencies
```bash theme={null}
# Install from requirements file (recommended)
pip install -r requirements.txt
# Or install manually
pip install requests pydantic
```
### 2. Make the script executable
```bash theme={null}
chmod +x financial_news_tracker.py
```
## API Key Setup
The tool requires a Perplexity API key. You can provide it in one of these ways:
### 1. As an environment variable (recommended)
```bash theme={null}
export PPLX_API_KEY=YOUR_API_KEY
```
### 2. As a command-line argument
```bash theme={null}
./financial_news_tracker.py "tech stocks" --api-key YOUR_API_KEY
```
### 3. In a file
Create a file named `pplx_api_key` or `.pplx_api_key` in the same directory:
```bash theme={null}
echo "YOUR_API_KEY" > .pplx_api_key
chmod 600 .pplx_api_key
```
## Quick Start
Get the latest tech stock news:
```bash theme={null}
./financial_news_tracker.py "tech stocks"
```
This will fetch recent financial news about tech stocks, analyze market sentiment, and provide actionable insights.
## Usage Examples
### Basic usage - Get news for a specific topic
```bash theme={null}
./financial_news_tracker.py "S&P 500"
```
### Get cryptocurrency news from the past week
```bash theme={null}
./financial_news_tracker.py "cryptocurrency" --time-range 1w
```
### Track specific company news
```bash theme={null}
./financial_news_tracker.py "AAPL Apple stock"
```
### Get news about market sectors
```bash theme={null}
./financial_news_tracker.py "energy sector oil prices"
```
### Output as JSON for programmatic use
```bash theme={null}
./financial_news_tracker.py "inflation rates" --json
```
### Use a different model
```bash theme={null}
./financial_news_tracker.py "Federal Reserve interest rates" --model sonar
```
### Enable structured output (requires Tier 3+ API access)
```bash theme={null}
./financial_news_tracker.py "tech earnings" --structured-output
```
## Time Range Options
* `24h` - Last 24 hours (default)
* `1w` - Last week
* `1m` - Last month
* `3m` - Last 3 months
* `1y` - Last year
## Output Format
The tool provides comprehensive financial analysis including:
### 1. Executive Summary
A brief overview of the key financial developments
### 2. Market Analysis
* **Market Sentiment**: Overall market mood (🐂 Bullish, 🐻 Bearish, ⚖️ Neutral)
* **Key Drivers**: Factors influencing the market
* **Risks**: Current market risks and concerns
* **Opportunities**: Potential investment opportunities
### 3. News Items
Each news item includes:
* **Headline**: The main news title
* **Impact**: Market impact level (🔴 High, 🟡 Medium, 🟢 Low)
* **Summary**: Brief description of the news
* **Affected Sectors**: Industries or companies impacted
* **Source**: News source attribution
### 4. Investment Insights
Actionable recommendations and analysis based on the news
## Example Output
```
📊 FINANCIAL NEWS REPORT: tech stocks
📅 Period: Last 24 hours
📝 EXECUTIVE SUMMARY:
Tech stocks showed mixed performance today as AI-related companies surged while
semiconductor stocks faced pressure from supply chain concerns...
📈 MARKET ANALYSIS:
Sentiment: 🐂 BULLISH
Key Drivers:
• Strong Q4 earnings from major tech companies
• AI sector momentum continues
• Federal Reserve signals potential rate cuts
⚠️ Risks:
• Semiconductor supply chain disruptions
• Regulatory scrutiny on big tech
• Valuation concerns in AI sector
💡 Opportunities:
• Cloud computing growth
• AI infrastructure plays
• Cybersecurity demand surge
📰 KEY NEWS ITEMS:
1. Microsoft Hits All-Time High on AI Growth
Impact: 🔴 HIGH
Summary: Microsoft stock reached record levels following strong Azure AI revenue...
Sectors: Cloud Computing, AI, Software
Source: Bloomberg
💼 INSIGHTS & RECOMMENDATIONS:
• Consider diversifying within tech sector
• AI infrastructure companies show strong momentum
• Monitor semiconductor sector for buying opportunities
```
## Advanced Features
### Custom Queries
You can combine multiple topics for comprehensive analysis:
```bash theme={null}
# Get news about multiple related topics
./financial_news_tracker.py "NVIDIA AMD semiconductor AI chips"
# Track geopolitical impacts on markets
./financial_news_tracker.py "oil prices Middle East geopolitics"
# Monitor economic indicators
./financial_news_tracker.py "inflation CPI unemployment Federal Reserve"
```
### JSON Output
For integration with other tools or scripts:
```bash theme={null}
./financial_news_tracker.py "bitcoin" --json | jq '.market_analysis.market_sentiment'
```
## Tips for Best Results
1. **Be Specific**: Include company tickers, sector names, or specific events
2. **Combine Topics**: Mix company names with relevant themes (e.g., "TSLA electric vehicles")
3. **Use Time Ranges**: Match the time range to your investment horizon
4. **Regular Monitoring**: Set up cron jobs for daily market updates
## Limitations
* Results depend on available public information
* Not financial advice - always do your own research
* Historical data may be limited for very recent events
* Structured output requires Tier 3+ Perplexity API access
## Error Handling
The tool includes comprehensive error handling for:
* Invalid API keys
* Network connectivity issues
* API rate limits
* Invalid queries
* Parsing errors
## Integration Examples
### Daily Market Report
Create a script for daily updates:
```bash theme={null}
#!/bin/bash
# daily_market_report.sh
echo "=== Daily Market Report ===" > market_report.txt
echo "Date: $(date)" >> market_report.txt
echo "" >> market_report.txt
./financial_news_tracker.py "S&P 500 market overview" >> market_report.txt
./financial_news_tracker.py "top gaining stocks" >> market_report.txt
./financial_news_tracker.py "cryptocurrency bitcoin ethereum" >> market_report.txt
```
### Python Integration
```python theme={null}
import subprocess
import json
def get_financial_news(query, time_range="24h"):
result = subprocess.run(
["./financial_news_tracker.py", query, "--time-range", time_range, "--json"],
capture_output=True,
text=True
)
if result.returncode == 0:
return json.loads(result.stdout)
else:
raise Exception(f"Error fetching news: {result.stderr}")
# Example usage
news = get_financial_news("tech stocks", "1w")
print(f"Market sentiment: {news['market_analysis']['market_sentiment']}")
```
# Academic Research Finder CLI
Source: https://docs.perplexity.ai/cookbook/examples/research-finder/README
A command-line tool that uses Perplexity's Sonar API to find and summarize academic literature
# Academic Research Finder CLI
A command-line tool that uses Perplexity's Sonar API to find and summarize academic literature (research papers, articles, etc.) related to a given question or topic.
## Features
* Takes a natural language question or topic as input, ideally suited for academic inquiry.
* Leverages Perplexity Sonar API, guided by a specialized prompt to prioritize scholarly sources (e.g., journals, conference proceedings, academic databases).
* Outputs a concise summary based on the findings from academic literature.
* Lists the primary academic sources used, aiming to include details like authors, year, title, publication, and DOI/link when possible.
* Supports different Perplexity models (defaults to `sonar-pro`).
* Allows results to be output in JSON format.
## Installation
### 1. Install required dependencies
Ensure you are using the Python environment you intend to run the script with (e.g., `python3.10` if that's your target).
```bash theme={null}
# Install from requirements file (recommended)
pip install -r requirements.txt
# Or install manually
pip install requests
```
### 2. Make the script executable (Optional)
```bash theme={null}
chmod +x research_finder.py
```
Alternatively, you can run the script using `python3 research_finder.py ...`.
## API Key Setup
The tool requires a Perplexity API key (`PPLX_API_KEY`) to function. You can provide it in one of these ways (checked in this order):
1. **As a command-line argument:**
```bash theme={null}
python3 research_finder.py "Your query" --api-key YOUR_API_KEY
```
2. **As an environment variable:**
```bash theme={null}
export PPLX_API_KEY=YOUR_API_KEY
python3 research_finder.py "Your query"
```
3. **In a file:** Create a file named `pplx_api_key`, `.pplx_api_key`, `PPLX_API_KEY`, or `.PPLX_API_KEY` in the *same directory as the script* or in the *current working directory* containing just your API key.
```bash theme={null}
echo "YOUR_API_KEY" > .pplx_api_key
chmod 600 .pplx_api_key # Optional: restrict permissions
python3 research_finder.py "Your query"
```
## Usage
Run the script from the `sonar-use-cases/research_finder` directory or provide the full path.
```bash theme={null}
# Basic usage
python3 research_finder.py "What are the latest advancements in quantum computing?"
# Using a specific model
python3 research_finder.py "Explain the concept of Large Language Models" --model sonar-small-online
# Getting output as JSON
python3 research_finder.py "Summarize the plot of Dune Part Two" --json
# Using a custom system prompt file
python3 research_finder.py "Benefits of renewable energy" --prompt-file /path/to/your/custom_prompt.md
# Using an API key via argument
python3 research_finder.py "Who won the last FIFA World Cup?" --api-key sk-...
# Using the executable (if chmod +x was used)
./research_finder.py "Latest news about Mars exploration"
```
### Arguments
* `query`: (Required) The research question or topic (enclose in quotes if it contains spaces).
* `-m`, `--model`: Specify the Perplexity model (default: `sonar-pro`).
* `-k`, `--api-key`: Provide the API key directly.
* `-p`, `--prompt-file`: Path to a custom system prompt file.
* `-j`, `--json`: Output the results in JSON format.
## Example Output (Human-Readable - *Note: Actual output depends heavily on the query and API results*)
```
Initializing research assistant for query: "Recent studies on transformer models in NLP"...
Researching in progress...
✅ Research Complete!
📝 SUMMARY:
Recent studies on transformer models in Natural Language Processing (NLP) continue to explore architectural improvements, efficiency optimizations, and new applications. Key areas include modifications to the attention mechanism (e.g., sparse attention, linear attention) to handle longer sequences more efficiently, techniques for model compression and knowledge distillation, and applications beyond text, such as in computer vision and multimodal tasks. Research also focuses on understanding the internal workings and limitations of large transformer models.
🔗 SOURCES:
1. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., ... & Polosukhin, I. (2017). Attention is all you need. Advances in neural information processing systems, 30. (arXiv:1706.03762)
2. Tay, Y., Dehghani, M., Bahri, D., & Metzler, D. (2020). Efficient transformers: A survey. arXiv preprint arXiv:2009.06732.
3. Beltagy, I., Peters, M. E., & Cohan, A. (2020). Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150.
4. Rogers, A., Kovaleva, O., & Rumshisky, A. (2020). A primer in bertology: What we know about how bert works. Transactions of the Association for Computational Linguistics, 8, 842-866. (arXiv:2002.12327)
```
## Limitations
* The ability of the Sonar API to consistently prioritize and access specific academic databases or extract detailed citation information (like DOIs) may vary. The quality depends on the API's search capabilities and the structure of the source websites.
* The script performs basic parsing to separate summary and sources; complex or unusual API responses might not be parsed perfectly. Check the raw response in case of issues.
* Queries that are too broad or not well-suited for academic search might yield less relevant results.
* Error handling for API rate limits or specific API errors could be more granular.
# Perplexity API Cookbook
Source: https://docs.perplexity.ai/cookbook/index
A collection of practical examples and guides for building with Perplexity's API Platform
A collection of practical examples and guides for building with [**Perplexity's API Platform**](https://docs.perplexity.ai/) - the fastest, most cost-effective AI answer engine with real-time search capabilities.
## Quick Start
To get started with any project in this cookbook:
1. **Browse examples** - Find the use case that matches your needs
2. **Follow the guide** - Each example includes complete setup instructions
3. **Get the code** - Full implementations are available in our [GitHub repository](https://github.com/perplexityai/api-cookbook)
4. **Build and customize** - Use the examples as starting points for your projects
## What's Inside
### [Examples](/cookbook/examples/README)
Ready-to-run projects that demonstrate specific use cases and implementation patterns.
### [Showcase](/cookbook/showcase/briefo/)
Community-built applications that demonstrate real-world implementations of the API Platform.
### [Integration Guides](/cookbook/articles/memory-management/chat-summary-memory-buffer/README)
In-depth tutorials for advanced implementations and integrations with other tools.
> **Note**: All complete code examples, scripts, and project files can be found in our [GitHub repository](https://github.com/perplexityai/api-cookbook). The documentation here provides guides and explanations, while the repository contains the full runnable implementations.
## Contributing
Have a project built with API Platform? We'd love to feature it! Check our [Contributing Guidelines](https://github.com/perplexityai/api-cookbook/blob/main/CONTRIBUTING.md) to learn how to:
* Submit example tutorials
* Add your project to the showcase
* Improve existing content
## Resources
* [API Documentation](https://docs.perplexity.ai/home)
* [GitHub Repository](https://github.com/perplexityai/api-cookbook)
***
*Maintained by the Perplexity community*
# 4Point Hoops | AI Basketball Analytics Platform
Source: https://docs.perplexity.ai/cookbook/showcase/4point-Hoops
Advanced NBA analytics platform that combines live Basketball-Reference data with Perplexity Sonar to deliver deep-dive player stats, cross-season comparisons and expert-grade AI explanations

**4Point Hoops** is an advanced NBA analytics platform that turns raw basketball statistics into actionable, narrative-driven insights. By scraping Basketball-Reference in real time and routing context-rich prompts to Perplexity's Sonar Pro model, it helps fans, analysts, and fantasy players understand the "why" and "what's next" – not just the numbers.
## Features
* **Player Analytics** with season & playoff splits, shot-type breakdowns, and performance radar for any NBA player
* **Cross-Era Comparisons** enabling side-by-side stat comparisons (e.g., Michael Jordan '97 vs. Stephen Curry '22)
* **Team Dashboards** with standings, playoff-probability Sankey flows, and auto-refreshing KPI tiles
* **AI Explain & Similar Players** providing one-click Sonar explanations of stat lines and AI-picked comparable athletes
* **Basketball AI Chat** allowing users to ask an expert LLM about NBA history, rosters, or projections
* **Credit-Based SaaS System** with Firebase Auth, Google login, credit wallets, and admin tooling
## Prerequisites
* Node.js 16+ and npm
* Python 3.8+ and pip
* Firebase project setup
* Perplexity API key (Sonar Pro)
* Basketball-Reference access
## Installation
```bash theme={null}
# Clone the frontend repository
git clone https://github.com/rapha18th/hoop-ai-frontend-44.git
cd hoop-ai-frontend-44
npm install
# Clone the backend repository
git clone https://github.com/rapha18th/4Point-Hoops-Server.git
cd 4Point-Hoops-Server
pip install -r requirements.txt
```
## Configuration
Create `.env` file in the backend directory:
```ini theme={null}
PERPLEXITY_API_KEY=your_sonar_pro_api_key
FIREBASE_PROJECT_ID=your_firebase_project_id
FIREBASE_PRIVATE_KEY=your_firebase_private_key
FIREBASE_CLIENT_EMAIL=your_firebase_client_email
```
## Usage
1. **Start Backend**:
```bash theme={null}
cd 4Point-Hoops-Server
python app.py
```
2. **Start Frontend**:
```bash theme={null}
cd hoop-ai-frontend-44
npm run dev
```
3. **Access Application**: Open the frontend URL and explore NBA analytics with AI-powered insights
4. **Use AI Features**: Click "AI Explain" on any player or stat to get intelligent analysis powered by Perplexity Sonar
## Code Explanation
* **Frontend**: React with shadcn/ui components and Recharts for data visualization
* **Backend**: Python Flask API serving Basketball-Reference data and managing Perplexity API calls
* **Data Pipeline**: BRScraper for real-time data collection with Firebase caching
* **AI Integration**: Perplexity Sonar Pro for intelligent basketball analysis and explanations
* **Authentication**: Firebase Auth with Google login and credit-based access control
* **Deployment**: Frontend on Netlify, backend on Hugging Face Spaces with Docker
## Links
* [Frontend Repository](https://github.com/rapha18th/hoop-ai-frontend-44)
* [Backend Repository](https://github.com/rapha18th/4Point-Hoops-Server)
* [Live Demo](https://4pointhoops.netlify.app/)
* [Devpost Submission](https://devpost.com/software/4point-hoops)
# Ellipsis | One-Click Podcast Generation Agent
Source: https://docs.perplexity.ai/cookbook/showcase/Ellipsis
A next-gen podcast generation agent that brings human-like, high-quality audio content to life on any topic with just one click
**Ellipsis** is a next-generation podcast generation agent that brings human-like, high-quality audio content to life on any topic with just one click. Whether it's breaking news, deep-dive tech explainers, movie reviews, or post-match sports breakdowns, Ellipsis crafts intelligent podcast episodes that sound like they were created by seasoned hosts in a professional studio.
## Features
* **Intelligent Multi-Speaker Dialogue** with multiple distinct voices and personalities
* **Comprehensive Topic Coverage** from LLM architectures to lunar eclipses
* **Custom Evaluation Engine** ensuring factual accuracy, legal compliance, and conversational quality
* **Fully Automated Podcast Generation** with human-like, podcast-ready audio output
* **Real-time Streaming Updates** via Server-Sent Events (SSE)
* **Podbean Integration** for direct podcast publishing
* **Trending Topics Detection** using Perplexity API
## Prerequisites
* Node.js v16+ and npm/yarn
* Python 3.10+ and pip
* Redis server running (default on port 6380)
* Perplexity API key, Podbean credentials
## Installation
```bash theme={null}
# Clone the repository
git clone https://github.com/dineshkannan010/Ellipsis.git
cd Ellipsis
# Backend setup
cd backend
python -m venv venv
source venv/bin/activate # macOS/Linux
pip install -r requirements.txt
# Install native packages
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
pip install git+https://github.com/freddyaboulton/orpheus-cpp.git
pip install huggingface_hub[hf_xet] hf_xet
# Frontend setup
cd ../frontend
npm install
```
## Configuration
Create `backend/.env`:
```ini theme={null}
REDIS_URL=redis://your-redis-host:6379
PERPLEXITY_API_KEY=your_key_here
PODBEAN_CLIENT_ID=...
PODBEAN_CLIENT_SECRET=...
```
Create `frontend/.env`:
```ini theme={null}
REACT_APP_API_URL=http://your-backend-host:5000
```
## Usage
1. **Start Redis Server**:
```bash theme={null}
redis-server --port 6380
```
2. **Launch Backend**:
```bash theme={null}
cd backend
python app.py
```
3. **Launch Frontend**:
```bash theme={null}
cd frontend
npm run dev
```
4. **Optional: Podbean Integration**:
```bash theme={null}
cd backend/integrations/podbean_mcp
pip install -e .
python server.py
python client.py server.py
```
5. **Generate Content**: Enter a topic in the homepage textbox and hit Enter. Switch to `ContentGenerationView` to see live script & audio progress.
## Code Explanation
* **Backend**: Python Flask with Redis pub/sub, llama.cpp, and Orpheus TTS for audio generation
* **Frontend**: React with Vite, Tailwind CSS, and Server-Sent Events for real-time updates
* **AI Integration**: Perplexity API for content generation and trending topics detection
* **Audio Processing**: Multi-speaker TTS with distinct voice personalities
* **Content Evaluation**: Built-in pipelines for factual accuracy and legal compliance
* **Podcast Publishing**: Direct integration with Podbean via MCP server
## Demo Video
## Links
* [GitHub Repository](https://github.com/dineshkannan010/Ellipsis)
* [Devpost Submission](https://devpost.com/software/ellipsis)
# BazaarAISaathi | AI-Powered Indian Stock Market Assistant
Source: https://docs.perplexity.ai/cookbook/showcase/bazaar-ai-saathi
An AI-powered platform for Indian stock market analysis, portfolio optimization, and investment strategies using Perplexity Sonar API
**BazaarAISaathi** is an AI-powered platform designed to empower investors with actionable insights into the Indian stock market. Leveraging advanced natural language processing, real-time data analytics, and expert-driven financial modeling, the app delivers personalized investment strategies, market sentiment analysis, and portfolio optimization recommendations.
## Features
* **Financial Independence Planner (FIRE)** with personalized plans based on age, salary, and goals
* **Investment Advice Tester** using EasyOCR for text extraction and AI validation
* **Fundamental & Technical Analysis** with comprehensive company reports and trading strategies
* **Portfolio Analysis** with multi-dimensional analysis and stock-wise recommendations
* **Market Research & Competitor Benchmarking** using AI-driven industry trend analysis
* **Real-Time Stock Data** with live price tracking and trend analysis
* **Hypothesis Testing** using historical and real-time market data
* **Investment Books Summary** with concise summaries of top 50 investment books
## Prerequisites
* Python 3.8+ and pip
* Streamlit for web application framework
* Perplexity API key (Sonar models)
* Optional: EasyOCR for image text extraction
## Installation
```bash theme={null}
# Clone the repository
git clone https://github.com/mahanteshimath/BazaarAISaathi.git
cd BazaarAISaathi
# Install dependencies
pip install -r requirements.txt
```
## Configuration
Create `secrets.toml` file for Streamlit secrets:
```ini theme={null}
PERPLEXITY_API_KEY = "your_perplexity_api_key"
# Add other API keys as needed
```
## Usage
1. **Start the Application**:
```bash theme={null}
streamlit run Home.py
```
2. **Access Features**:
* Navigate through different pages for specific functionality
* Use the main dashboard for overview and navigation
* Access specialized tools like portfolio analysis, FIRE planning, and tip testing
3. **Run Specific Modules**:
```bash theme={null}
streamlit run pages/Financial_Independence.py
streamlit run pages/Portfolio_Analysis.py
streamlit run pages/Tip_Tester.py
```
## Code Explanation
* **Frontend**: Streamlit web application with interactive pages and real-time data visualization
* **Backend**: Python-based business logic with Pandas for data manipulation and analysis
* **AI Integration**: Perplexity Sonar API models (sonar-deep-research, sonar-reasoning-pro, sonar-pro) for financial analysis
* **Data Processing**: Real-time stock data fetching, CSV data management, and market insights generation
* **Text Extraction**: EasyOCR integration for processing investment tips from images
* **Portfolio Management**: Comprehensive portfolio analysis with optimization recommendations
* **Market Analysis**: Technical and fundamental analysis with sentiment scoring
## Demo Video
## Links
* [GitHub Repository](https://github.com/mahanteshimath/BazaarAISaathi)
* [Live Application](https://bazaar-ai-saathi.streamlit.app/)
* [Architecture Diagram](https://github.com/mahanteshimath/BazaarAISaathi/raw/main/src/App_Architecture.jpg)
# Briefo | Perplexity Powered News & Finance Social App
Source: https://docs.perplexity.ai/cookbook/showcase/briefo
AI curated newsfeed, social discussion, and deep research reports built on the Sonar API
# Briefo | Perplexity Powered News & Finance Social App
**Briefo** delivers a personalized, AI generated newsfeed and company deep dives. Readers can follow breaking stories, request on demand financial analyses, and discuss insights with friends, all in one mobile experience powered by Perplexity’s Sonar API.
## Features
* Personalized newsfeed across 17 categories with AI summaries and source links
* Private and public threads for article discussion and sharing
* Watch list with real time market snapshots and optional AI analyses
* Deep research reports generated on 12 selectable criteria such as management, competitors, and valuation
* General purpose chat assistant that remembers each user’s preferred topics
## Prerequisites
* Node 18 LTS or newer
* npm, Yarn, or pnpm
* Expo CLI (`npm i -g expo-cli`)
* Supabase CLI 1.0 or newer for local emulation and Edge Function deploys
## Installation
```bash theme={null}
git clone https://github.com/adamblackman/briefo-public.git
cd briefo-public
npm install
```
### Environment variables
```ini theme={null}
# .env (project root)
MY_SUPABASE_URL=https://
|
|
***
## Creating and Managing an API Group
To set up your organization:
### Roles
* **Admin**: Full access to invite/remove members, manage billing, and view usage data.
* **Member**: Can view usage and account limits but cannot modify settings.
Models designed to retrieve and synthesize information efficiently.
Models that excel at complex, multi-step tasks.
Models that conduct in-depth analysis and generate detailed reports.
{selectedUseCase.codeExamples[1].code}
{selectedUseCase.codeExamples[2].code}
{selectedUseCase.codeExamples[0].code}