Spaces:
Running
Running
A newer version of the Gradio SDK is available:
5.43.1
metadata
title: Gpt Oss News Agent
emoji: π
colorFrom: green
colorTo: blue
sdk: gradio
sdk_version: 5.42.0
app_file: app.py
pinned: false
short_description: AI-powered news research assistant with real-time search
π° AI News Research Assistant
An intelligent AI-powered news research assistant built with Gradio that provides real-time news search, article fetching, and comprehensive summaries using GPT-OSS models.
β¨ Features
- Real-time News Search: Access current headlines from Google News RSS feeds
- Topic-specific Research: Search for news on specific subjects, companies, or events
- Site-restricted Search: Limit searches to specific news domains
- Article Content Extraction: Download and analyze full article content when needed
- AI-powered Summaries: Get intelligent news summaries with proper citations
- Multiple Model Support: Choose between GPT-OSS 120B and 20B models
- Modern Web Interface: Clean, responsive Gradio-based chat interface
- Langfuse Integration: Built-in observability and tracing for interactions
π Quick Start
Prerequisites
- Python 3.8+
- API keys for:
- Hugging Face (HF_TOKEN)
- Serper API (SERPER_API_KEY)
- Langfuse (optional, for observability)
Installation
Clone the repository
git clone <your-repo-url> cd agent_gradio_app
Install dependencies
pip install -r requirements.txt
Set up environment variables
# Create .env file echo "HF_TOKEN=your_huggingface_token" > .env echo "SERPER_API_KEY=your_serper_api_key" >> .env echo "LANGFUSE_PUBLIC_KEY=your_langfuse_public_key" >> .env echo "LANGFUSE_SECRET_KEY=your_langfuse_secret_key" >> .env
Run the application
python agent_gradio_chat.py
Open your browser Navigate to
http://localhost:7860
π§ Configuration
Available Models
- GPT-OSS 120B: Larger, more capable model for complex reasoning tasks
- GPT-OSS 20B: Faster, more efficient model for quick responses
Environment Variables
Variable | Description | Required |
---|---|---|
HF_TOKEN |
Hugging Face API token | Yes |
SERPER_API_KEY |
Serper API key for web search | Yes |
LANGFUSE_PUBLIC_KEY |
Langfuse public key for observability | No |
LANGFUSE_SECRET_KEY |
Langfuse secret key for observability | No |
π‘ Usage Examples
General News Requests
- "What are the top news stories today?"
- "What's happening in the world right now?"
- "Show me the latest headlines"
Topic-specific Research
- "What's the latest on artificial intelligence?"
- "Tell me about recent developments in climate change"
- "What's happening with Tesla stock?"
Site-specific Searches
- "What's the latest climate change news on the BBC?"
- "Show me recent AI articles from MIT Technology Review"
- "What's new on Ars Technica about cybersecurity?"
π οΈ How It Works
The application uses a sophisticated agent loop that:
- Analyzes User Queries: Understands the type of news request
- Selects Appropriate Tools: Chooses from available search and fetch tools
- Executes Searches: Performs targeted news searches using various APIs
- Extracts Content: Downloads and processes article content when needed
- Synthesizes Information: Provides comprehensive summaries with citations
- Tracks Interactions: Logs all interactions for observability
Available Tools
fetch_google_news_rss
: Get top headlines from Google Newsserper_news_search
: Search for specific topics in Google Newsserper_site_search
: Restrict searches to specific domainsfetch_article
: Download and extract article content
π Project Structure
agent_gradio_app/
βββ agent_gradio_chat.py # Main application file
βββ requirements.txt # Python dependencies
βββ config.json # Configuration file
βββ .env # Environment variables (create this)
βββ README.md # This file
βββ run_app.sh # Convenience script to run the app
π API Dependencies
- Hugging Face: Model inference and hosting
- Serper API: Web search capabilities
- Trafilatura: Article content extraction
- Langfuse: Observability and tracing
π Deployment
Local Development
python agent_gradio_chat.py
Production Deployment
# Using the convenience script
chmod +x run_app.sh
./run_app.sh
# Or directly with custom settings
python agent_gradio_chat.py --server-name 0.0.0.0 --server-port 7860
Docker (Optional)
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 7860
CMD ["python", "agent_gradio_chat.py"]
π§ͺ Testing
Test the application with various news queries:
# Test basic functionality
python -c "
from agent_gradio_chat import run_agent
response = run_agent('What are the top news stories today?')
print(response)
"
π€ Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Gradio for the web interface framework
- Hugging Face for model hosting and inference
- OpenAI for the GPT-OSS models
- Serper for web search capabilities
π Support
For issues, questions, or contributions:
- Open an issue on GitHub
- Check the documentation
- Review the code comments for implementation details
Happy news researching! ππ°