|
|
||
|---|---|---|
| .. | ||
| tools | ||
| utils | ||
| README.md | ||
| flow.py | ||
| main.py | ||
| nodes.py | ||
| requirements.txt | ||
README.md
Web Search with Analysis
A web search tool built with PocketFlow that performs searches using SerpAPI and analyzes results using LLM.
Features
- Web search using Google via SerpAPI
- Extracts titles, snippets, and links
- Analyzes search results using GPT-4 to provide:
- Result summaries
- Key points/facts
- Suggested follow-up queries
- Clean command-line interface
Installation
- Clone the repository
- Install dependencies:
pip install -r requirements.txt - Set required API keys:
export SERPAPI_API_KEY='your-serpapi-key' export OPENAI_API_KEY='your-openai-key'
Usage
Run the search tool:
python main.py
You will be prompted to:
- Enter your search query
- Specify number of results to fetch (default: 5)
The tool will then:
- Perform the search using SerpAPI
- Analyze results using GPT-4
- Present a summary with key points and follow-up queries
Project Structure
pocketflow-tool-search/
├── tools/
│ ├── search.py # SerpAPI search functionality
│ └── parser.py # Result analysis using LLM
├── utils/
│ └── call_llm.py # LLM API wrapper
├── nodes.py # PocketFlow nodes
├── flow.py # Flow configuration
├── main.py # Main script
└── requirements.txt # Dependencies
Limitations
- Requires SerpAPI subscription
- Rate limited by both APIs
- Basic error handling
- Text results only
Dependencies
- pocketflow: Flow-based processing
- google-search-results: SerpAPI client
- openai: GPT-4 API access
- pyyaml: YAML processing