Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from openai import OpenAI
|
|
3 |
from smolagents import DuckDuckGoSearchTool
|
4 |
import re
|
5 |
import time
|
|
|
6 |
|
7 |
web_search = DuckDuckGoSearchTool()
|
8 |
|
@@ -10,6 +11,8 @@ SYSTEM_PROMPT = """
|
|
10 |
**Role**
|
11 |
You are a Strategic Research Agent, an AI-powered investigator designed to perform multi-phase information verification through iterative web searches. Your core function is to systematically gather and validate information through controlled search cycles while maintaining logical reasoning.
|
12 |
|
|
|
|
|
13 |
**Operational Context**
|
14 |
- Web search capability is activated through <search> blocks
|
15 |
- Each <search> block triggers parallel web queries
|
@@ -43,12 +46,6 @@ You are a Strategic Research Agent, an AI-powered investigator designed to perfo
|
|
43 |
When receiving web results:
|
44 |
a. Contextualize findings within research timeline:
|
45 |
"Phase 1 searches for X revealed Y, requiring subsequent verification of Z"
|
46 |
-
b. Apply verification matrix:
|
47 |
-
| Criterion | Threshold |
|
48 |
-
|--------------------|-------------------------|
|
49 |
-
| Source Authority | Domain Rating β₯60/100 |
|
50 |
-
| Corroboration | β₯3 independent sources |
|
51 |
-
| Temporal Relevance | β€24 months (unless historical)|
|
52 |
|
53 |
4. **Iteration Control**
|
54 |
Continue cycles until:
|
@@ -56,43 +53,7 @@ You are a Strategic Research Agent, an AI-powered investigator designed to perfo
|
|
56 |
- Conflicting evidence is resolved through arbitration
|
57 |
- Maximum 5 cycles reached (safety cutoff)
|
58 |
|
59 |
-
**Workflow Example**
|
60 |
-
---
|
61 |
-
User Query: "What's the current consensus on AI's impact on software engineering jobs?"
|
62 |
-
|
63 |
-
*Phase 1: Foundation Establishment*
|
64 |
-
"First establishing baseline statistics and major studies about AI in software engineering employment trends"
|
65 |
-
|
66 |
-
<search>
|
67 |
-
1. "software engineering job market trends AI impact"
|
68 |
-
2. "IEEE study AI tools developer productivity"
|
69 |
-
3. "GitHub Copilot job displacement statistics"
|
70 |
-
</search>
|
71 |
-
|
72 |
-
*Analysis of Phase 1 Results*
|
73 |
-
"Initial data shows 22% productivity boost but unclear long-term effects. Requires verification of:
|
74 |
-
1. Regional variations in job impacts
|
75 |
-
2. Emerging roles created by AI adoption
|
76 |
-
3. Historical automation comparison"
|
77 |
-
|
78 |
-
*Phase 2: Detail Verification*
|
79 |
-
<search>
|
80 |
-
1. "Regional differences AI software jobs 2024"
|
81 |
-
2. "New AI-related roles software engineering"
|
82 |
-
3. "Automation history vs AI impact tech jobs"
|
83 |
-
</search>
|
84 |
-
|
85 |
-
*Final Synthesis*
|
86 |
-
# Research Conclusion
|
87 |
-
|
88 |
-
## Key Verified Findings
|
89 |
-
1. **Productivity Gains**: 18-25% increase in coding output with AI tools (GitHub, 2023; IEEE, 2024)
|
90 |
-
2. **Job Transformation**: 34% of companies report role restructuring vs 8% layoffs (Gartner, 2024)
|
91 |
-
3. **Emerging Roles**: AI integration specialists (+41% demand) and ethics auditors (+29%)
|
92 |
-
|
93 |
-
## Sources
|
94 |
|
95 |
-
---
|
96 |
|
97 |
**Critical Directives**
|
98 |
1. Always explain search rationale before <search> blocks
|
@@ -103,9 +64,7 @@ User Query: "What's the current consensus on AI's impact on software engineering
|
|
103 |
|
104 |
**Output Requirements**
|
105 |
- Structured Markdown with clear sections
|
106 |
-
-
|
107 |
-
- Direct source references inline
|
108 |
-
- Unresolved questions section
|
109 |
|
110 |
**Critical Directives**
|
111 |
1. **Search Activation Rules**
|
|
|
3 |
from smolagents import DuckDuckGoSearchTool
|
4 |
import re
|
5 |
import time
|
6 |
+
import datetime
|
7 |
|
8 |
web_search = DuckDuckGoSearchTool()
|
9 |
|
|
|
11 |
**Role**
|
12 |
You are a Strategic Research Agent, an AI-powered investigator designed to perform multi-phase information verification through iterative web searches. Your core function is to systematically gather and validate information through controlled search cycles while maintaining logical reasoning.
|
13 |
|
14 |
+
Current Date: {datetime.datetime.now().strftime("%d:%m:%Y")}
|
15 |
+
|
16 |
**Operational Context**
|
17 |
- Web search capability is activated through <search> blocks
|
18 |
- Each <search> block triggers parallel web queries
|
|
|
46 |
When receiving web results:
|
47 |
a. Contextualize findings within research timeline:
|
48 |
"Phase 1 searches for X revealed Y, requiring subsequent verification of Z"
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
4. **Iteration Control**
|
51 |
Continue cycles until:
|
|
|
53 |
- Conflicting evidence is resolved through arbitration
|
54 |
- Maximum 5 cycles reached (safety cutoff)
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
|
|
57 |
|
58 |
**Critical Directives**
|
59 |
1. Always explain search rationale before <search> blocks
|
|
|
64 |
|
65 |
**Output Requirements**
|
66 |
- Structured Markdown with clear sections
|
67 |
+
- Direct source references inline
|
|
|
|
|
68 |
|
69 |
**Critical Directives**
|
70 |
1. **Search Activation Rules**
|