A newer version of the Gradio SDK is available:
5.29.0
metadata
title: LLM-Enhanced Internet Search Agent
emoji: 🕵🏻♂️
colorFrom: indigo
colorTo: indigo
sdk: gradio
sdk_version: 5.25.2
app_file: app.py
pinned: false
hf_oauth: true
hf_oauth_expiration_minutes: 480
LLM-Enhanced Internet Search Agent
This agent uses a two-step approach to answer questions:
- Question Breakdown: The agent first uses an LLM (GPT-3.5) to break down complex questions into 2-3 key search queries
- Targeted Search: Each search query is sent to Wikipedia's API to retrieve relevant information
- Answer Synthesis: The agent then uses the LLM to synthesize a comprehensive answer based on all search results
Features
- Smart Query Generation: Transforms natural language questions into optimized search queries
- Parallel Search Processing: Searches for multiple key aspects of the question simultaneously
- Knowledge Synthesis: Combines information from multiple sources into a cohesive answer
- Fallback Mechanisms: Graceful handling of errors at each step of the process
Setup Requirements
- Clone this repository
- Install required packages:
pip install -r requirements.txt
- Set your OpenAI API key as an environment variable:
OPENAI_API_KEY=your-api-key
How It Works
- User submits a question
- LLM breaks down the question into key search terms
- Search terms are used to query Wikipedia API
- Results from multiple searches are collected
- LLM synthesizes the information into a comprehensive answer
- Answer is returned to the user
This approach is more effective than direct internet searches because:
- It identifies the most relevant aspects of complex questions
- It can break multi-part questions into their components
- It leverages the LLM's understanding of natural language
- It provides more targeted and accurate search results
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference