update README
Browse files
README.md
CHANGED
@@ -1,156 +1,9 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
An advanced AI-powered system for automated web research and report generation. This system uses AI agents to search, analyze, and compile comprehensive reports on any given topic.
|
4 |
-
|
5 |
-
## Features
|
6 |
-
|
7 |
-
- **Intelligent Web Search**
|
8 |
-
- Multi-source search using DuckDuckGo and Google
|
9 |
-
- Smart retry mechanism with rate limit handling
|
10 |
-
- Configurable search depth and result limits
|
11 |
-
- Domain filtering for trusted sources
|
12 |
-
|
13 |
-
- **Advanced Report Generation**
|
14 |
-
- Beautiful HTML reports with modern styling
|
15 |
-
- Automatic keyword extraction
|
16 |
-
- Source validation and relevance scoring
|
17 |
-
- Comprehensive logging of research process
|
18 |
-
|
19 |
-
- **Smart Caching**
|
20 |
-
- Caches search results for faster repeat queries
|
21 |
-
- Configurable cache directory
|
22 |
-
- Cache invalidation management
|
23 |
-
|
24 |
-
- **Error Handling**
|
25 |
-
- Graceful fallback between search engines
|
26 |
-
- Rate limit detection and backoff
|
27 |
-
- Detailed error logging
|
28 |
-
- Automatic retry mechanisms
|
29 |
-
|
30 |
-
## Installation
|
31 |
-
|
32 |
-
1. Clone the repository:
|
33 |
-
```bash
|
34 |
-
git clone [repository-url]
|
35 |
-
cd phidata_analyst
|
36 |
-
```
|
37 |
-
|
38 |
-
2. Install dependencies:
|
39 |
-
```bash
|
40 |
-
pip install -r requirements.txt
|
41 |
-
```
|
42 |
-
|
43 |
-
3. Set up your API keys:
|
44 |
-
- Create a `.env` file in the project root
|
45 |
-
- Add your API keys:
|
46 |
-
```
|
47 |
-
NVIDIA_API_KEY=your-nvidia-api-key
|
48 |
-
GOOGLE_API_KEY=your-google-api-key
|
49 |
-
```
|
50 |
-
|
51 |
-
## Usage
|
52 |
-
|
53 |
-
### Basic Usage
|
54 |
-
|
55 |
-
```python
|
56 |
-
from web_search import create_blog_post_workflow
|
57 |
-
|
58 |
-
# Create a workflow instance
|
59 |
-
workflow = create_blog_post_workflow()
|
60 |
-
|
61 |
-
# Generate a report
|
62 |
-
for response in workflow.run("Your research topic"):
|
63 |
-
print(response.message)
|
64 |
-
```
|
65 |
-
|
66 |
-
### Advanced Usage
|
67 |
-
|
68 |
-
```python
|
69 |
-
from web_search import BlogPostGenerator, SqlWorkflowStorage
|
70 |
-
from phi.llm import Nvidia
|
71 |
-
from phi.tools import DuckDuckGo, GoogleSearch
|
72 |
-
|
73 |
-
# Configure custom agents
|
74 |
-
searcher = Agent(
|
75 |
-
model=Nvidia(
|
76 |
-
id="meta/llama-3.2-3b-instruct",
|
77 |
-
temperature=0.3,
|
78 |
-
top_p=0.1
|
79 |
-
),
|
80 |
-
tools=[DuckDuckGo(fixed_max_results=10)]
|
81 |
-
)
|
82 |
-
|
83 |
-
# Initialize with custom configuration
|
84 |
-
generator = BlogPostGenerator(
|
85 |
-
searcher=searcher,
|
86 |
-
storage=SqlWorkflowStorage(
|
87 |
-
table_name="custom_workflows",
|
88 |
-
db_file="path/to/db.sqlite"
|
89 |
-
)
|
90 |
-
)
|
91 |
-
|
92 |
-
# Run with caching enabled
|
93 |
-
for response in generator.run("topic", use_cache=True):
|
94 |
-
print(response.message)
|
95 |
-
```
|
96 |
-
|
97 |
-
## Output
|
98 |
-
|
99 |
-
The system generates:
|
100 |
-
1. Professional HTML reports with:
|
101 |
-
- Executive summary
|
102 |
-
- Detailed analysis
|
103 |
-
- Source citations
|
104 |
-
- Generation timestamp
|
105 |
-
2. Detailed logs of:
|
106 |
-
- Search process
|
107 |
-
- Keyword extraction
|
108 |
-
- Source relevance
|
109 |
-
- Download attempts
|
110 |
-
|
111 |
-
Reports are saved in:
|
112 |
-
- Default: `./reports/YYYY-MM-DD-HH-MM-SS/`
|
113 |
-
- Custom: Configurable via `file_handler`
|
114 |
-
|
115 |
-
## Configuration
|
116 |
-
|
117 |
-
Key configuration options:
|
118 |
-
|
119 |
-
```python
|
120 |
-
DUCK_DUCK_GO_FIXED_MAX_RESULTS = 10 # Max results from DuckDuckGo
|
121 |
-
DEFAULT_TEMPERATURE = 0.3 # Model temperature
|
122 |
-
TOP_P = 0.1 # Top-p sampling parameter
|
123 |
-
```
|
124 |
-
|
125 |
-
Trusted domains can be configured in `BlogPostGenerator.trusted_domains`.
|
126 |
-
|
127 |
-
## Logging
|
128 |
-
|
129 |
-
The system uses `phi.utils.log` for comprehensive logging:
|
130 |
-
- Search progress and results
|
131 |
-
- Keyword extraction details
|
132 |
-
- File downloads and failures
|
133 |
-
- Report generation status
|
134 |
-
|
135 |
-
Logs are color-coded for easy monitoring:
|
136 |
-
- INFO: Normal operations
|
137 |
-
- WARNING: Non-critical issues
|
138 |
-
- ERROR: Critical failures
|
139 |
-
|
140 |
-
## Contributing
|
141 |
-
|
142 |
-
1. Fork the repository
|
143 |
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
144 |
-
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
145 |
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
146 |
-
5. Open a Pull Request
|
147 |
-
|
148 |
-
## License
|
149 |
-
|
150 |
-
This project is licensed under the MIT License - see the LICENSE file for details.
|
151 |
-
|
152 |
-
## Acknowledgments
|
153 |
-
|
154 |
-
- Built with [Phi](https://github.com/phidatahq/phidata)
|
155 |
-
- Uses NVIDIA AI models
|
156 |
-
- Search powered by DuckDuckGo and Google
|
|
|
1 |
+
---
|
2 |
+
title: Analyst
|
3 |
+
emoji: ⚡
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: blue
|
6 |
+
sdk: static
|
7 |
+
pinned: false
|
8 |
+
---
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|