Commit
Β·
f36fcc8
1
Parent(s):
2a149d1
Enhance analysis quality: Improve prompts and system instructions for better insights
Browse files- Enhanced AnalysisAgent system prompt for sophisticated, actionable analysis
- Added comprehensive monetization analysis template with strategic focus
- Improved chunk processing prompts to maintain quality across large documents
- Enhanced hierarchical summarization with strategic business analysis focus
- Upgraded all prompts to provide deeper insights, specific recommendations, and strategic value
- Focus on quantifiable insights, implementation strategies, and business opportunities
- agents.py +51 -27
- utils/__init__.py +2 -2
- utils/prompts.py +6 -0
agents.py
CHANGED
|
@@ -79,35 +79,38 @@ class AnalysisAgent(BaseAgent):
|
|
| 79 |
# Use standard token allocation
|
| 80 |
max_tokens = Config.OPENAI_MAX_TOKENS
|
| 81 |
|
| 82 |
-
system = """You are AnalysisAgent:
|
| 83 |
|
| 84 |
-
|
| 85 |
-
-
|
| 86 |
-
-
|
| 87 |
-
-
|
| 88 |
-
-
|
| 89 |
-
-
|
| 90 |
-
-
|
| 91 |
-
- Use color coding and visual hierarchy throughout
|
| 92 |
-
- Include actionable insights with clear visual indicators
|
| 93 |
|
| 94 |
-
CONTENT
|
| 95 |
-
-
|
| 96 |
-
-
|
| 97 |
-
- Include specific
|
| 98 |
-
-
|
| 99 |
-
-
|
| 100 |
-
-
|
| 101 |
-
- Create engaging, professional presentations
|
| 102 |
|
| 103 |
-
|
| 104 |
-
-
|
| 105 |
-
-
|
| 106 |
-
-
|
| 107 |
-
-
|
| 108 |
-
-
|
| 109 |
-
-
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
try:
|
| 113 |
response = await call_openai_chat(
|
|
@@ -152,7 +155,28 @@ VISUAL ELEMENTS TO USE:
|
|
| 152 |
metadata['total_chunks'] = len(chunks)
|
| 153 |
chunk_results = []
|
| 154 |
|
| 155 |
-
system = "You are AnalysisAgent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
for i, chunk in enumerate(chunks):
|
| 158 |
content = f"User prompt: {prompt}\n\nDocument chunk {i+1}/{len(chunks)}:\n{chunk}"
|
|
|
|
| 79 |
# Use standard token allocation
|
| 80 |
max_tokens = Config.OPENAI_MAX_TOKENS
|
| 81 |
|
| 82 |
+
system = """You are AnalysisAgent: an expert analyst who produces deeply insightful, actionable, and contextually relevant analysis.
|
| 83 |
|
| 84 |
+
ANALYSIS APPROACH:
|
| 85 |
+
- Provide sophisticated, nuanced insights that go beyond surface-level observations
|
| 86 |
+
- Identify underlying patterns, implications, and strategic opportunities
|
| 87 |
+
- Connect concepts to real-world applications and business value
|
| 88 |
+
- Offer specific, actionable recommendations with clear implementation paths
|
| 89 |
+
- Consider multiple perspectives and potential challenges
|
| 90 |
+
- Provide evidence-based conclusions with supporting rationale
|
|
|
|
|
|
|
| 91 |
|
| 92 |
+
CONTENT STRUCTURE:
|
| 93 |
+
- Start with a compelling executive summary that captures the essence
|
| 94 |
+
- Organize insights by strategic importance and implementation priority
|
| 95 |
+
- Include specific examples, case studies, and concrete applications
|
| 96 |
+
- Highlight unique opportunities and competitive advantages
|
| 97 |
+
- Address potential risks, challenges, and mitigation strategies
|
| 98 |
+
- Provide clear next steps with timelines and success metrics
|
|
|
|
| 99 |
|
| 100 |
+
QUALITY STANDARDS:
|
| 101 |
+
- Be precise and specific rather than generic
|
| 102 |
+
- Include quantifiable insights where possible (ROI, market size, timelines)
|
| 103 |
+
- Reference industry best practices and benchmarks
|
| 104 |
+
- Consider scalability, feasibility, and resource requirements
|
| 105 |
+
- Provide context for why recommendations matter
|
| 106 |
+
- Connect analysis to broader market trends and opportunities
|
| 107 |
+
|
| 108 |
+
FORMATTING:
|
| 109 |
+
- Use clear headings with strategic focus
|
| 110 |
+
- Include bullet points for easy scanning
|
| 111 |
+
- Highlight key insights with **bold** text
|
| 112 |
+
- Use emojis sparingly for visual appeal (π― π‘ π β‘ β
)
|
| 113 |
+
- Structure information by priority and actionability"""
|
| 114 |
|
| 115 |
try:
|
| 116 |
response = await call_openai_chat(
|
|
|
|
| 155 |
metadata['total_chunks'] = len(chunks)
|
| 156 |
chunk_results = []
|
| 157 |
|
| 158 |
+
system = """You are AnalysisAgent: an expert analyst producing sophisticated insights from document content.
|
| 159 |
+
|
| 160 |
+
ANALYSIS APPROACH:
|
| 161 |
+
- Provide deep, nuanced insights that identify underlying patterns and strategic opportunities
|
| 162 |
+
- Connect concepts to real-world applications and business value
|
| 163 |
+
- Offer specific, actionable recommendations with clear implementation paths
|
| 164 |
+
- Consider multiple perspectives and potential challenges
|
| 165 |
+
- Provide evidence-based conclusions with supporting rationale
|
| 166 |
+
|
| 167 |
+
CHUNK ANALYSIS FOCUS:
|
| 168 |
+
- Extract the most important insights from this specific section
|
| 169 |
+
- Identify key concepts, data points, and implications
|
| 170 |
+
- Note any unique opportunities or competitive advantages mentioned
|
| 171 |
+
- Highlight specific examples, case studies, or applications
|
| 172 |
+
- Consider how this content relates to broader strategic themes
|
| 173 |
+
|
| 174 |
+
OUTPUT FORMAT:
|
| 175 |
+
- Start with key insights from this chunk
|
| 176 |
+
- Include specific examples and concrete applications
|
| 177 |
+
- Note strategic implications and opportunities
|
| 178 |
+
- Highlight any unique value propositions or competitive advantages
|
| 179 |
+
- Keep analysis focused and actionable"""
|
| 180 |
|
| 181 |
for i, chunk in enumerate(chunks):
|
| 182 |
content = f"User prompt: {prompt}\n\nDocument chunk {i+1}/{len(chunks)}:\n{chunk}"
|
utils/__init__.py
CHANGED
|
@@ -189,7 +189,7 @@ async def create_hierarchical_summary(chunk_results: List[str], prompt: str, mod
|
|
| 189 |
summary = await call_openai_chat(
|
| 190 |
model=model,
|
| 191 |
messages=[
|
| 192 |
-
{"role": "system", "content": "You are
|
| 193 |
{"role": "user", "content": group_prompt}
|
| 194 |
],
|
| 195 |
temperature=0.2,
|
|
@@ -215,7 +215,7 @@ async def create_hierarchical_summary(chunk_results: List[str], prompt: str, mod
|
|
| 215 |
final_summary = await call_openai_chat(
|
| 216 |
model=model,
|
| 217 |
messages=[
|
| 218 |
-
{"role": "system", "content": "You are
|
| 219 |
{"role": "user", "content": final_prompt}
|
| 220 |
],
|
| 221 |
temperature=0.2,
|
|
|
|
| 189 |
summary = await call_openai_chat(
|
| 190 |
model=model,
|
| 191 |
messages=[
|
| 192 |
+
{"role": "system", "content": "You are an expert analyst creating sophisticated summaries. Focus on:\n- Identifying strategic opportunities and competitive advantages\n- Extracting specific, actionable insights with real-world applications\n- Highlighting unique value propositions and market implications\n- Connecting insights to broader business themes and opportunities\n- Providing concrete examples and implementation considerations"},
|
| 193 |
{"role": "user", "content": group_prompt}
|
| 194 |
],
|
| 195 |
temperature=0.2,
|
|
|
|
| 215 |
final_summary = await call_openai_chat(
|
| 216 |
model=model,
|
| 217 |
messages=[
|
| 218 |
+
{"role": "system", "content": "You are a strategic business analyst creating comprehensive, actionable insights. Your final summary should:\n- Synthesize insights into a coherent strategic narrative\n- Prioritize opportunities by potential impact and feasibility\n- Provide specific, actionable recommendations with clear next steps\n- Include quantifiable insights where possible (market size, ROI, timelines)\n- Address implementation challenges and mitigation strategies\n- Connect all insights to create a unified strategic vision\n- Focus on what matters most for business success"},
|
| 219 |
{"role": "user", "content": final_prompt}
|
| 220 |
],
|
| 221 |
temperature=0.2,
|
utils/prompts.py
CHANGED
|
@@ -44,6 +44,12 @@ class PromptManager:
|
|
| 44 |
},
|
| 45 |
|
| 46 |
# Business Documents
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
"whitepaper_analysis": {
|
| 48 |
"name": "π Whitepaper Analysis",
|
| 49 |
"description": "Comprehensive analysis for whitepapers and research papers",
|
|
|
|
| 44 |
},
|
| 45 |
|
| 46 |
# Business Documents
|
| 47 |
+
"monetization_analysis": {
|
| 48 |
+
"name": "π° Monetization Strategy Analysis",
|
| 49 |
+
"description": "Deep analysis of monetization opportunities and strategies",
|
| 50 |
+
"template": "Analyze this document for monetization opportunities and provide strategic recommendations:\n\n## π― Core Value Proposition\n- **Unique value**: What makes this monetizable?\n- **Target market**: Who would pay for this?\n- **Competitive advantage**: Why choose this over alternatives?\n- **Market timing**: Is the market ready for this?\n\n## π° Revenue Model Opportunities\n- **Direct monetization**: How to charge customers\n - Subscription models and pricing tiers\n - One-time purchases and licensing\n - Usage-based pricing strategies\n- **Indirect monetization**: Adjacent revenue streams\n - Data monetization opportunities\n - Partnership and affiliate models\n - Platform and ecosystem strategies\n\n## π Market Analysis & Sizing\n- **Total Addressable Market (TAM)**: Overall market size\n- **Serviceable Addressable Market (SAM)**: Realistic target\n- **Serviceable Obtainable Market (SOM)**: Achievable share\n- **Market growth trends**: Is the market expanding?\n- **Customer segments**: Different user types and needs\n\n## π Implementation Strategy\n- **Go-to-market approach**: How to reach customers\n- **Pricing strategy**: Optimal pricing models\n- **Sales channels**: How to sell and distribute\n- **Partnership opportunities**: Strategic alliances\n- **Resource requirements**: What's needed to execute\n\n## β‘ Quick Wins vs Long-term Plays\n- **Immediate opportunities**: Low-hanging fruit (0-6 months)\n- **Medium-term strategies**: Scalable approaches (6-18 months)\n- **Long-term vision**: Major market positions (18+ months)\n- **Implementation timeline**: Realistic milestones\n\n## β οΈ Risk Assessment & Mitigation\n- **Market risks**: Competition, regulation, adoption\n- **Technical risks**: Implementation challenges\n- **Financial risks**: Investment requirements\n- **Mitigation strategies**: How to reduce risks\n\n## π Success Metrics & KPIs\n- **Revenue targets**: Specific financial goals\n- **Customer metrics**: Acquisition, retention, growth\n- **Market metrics**: Market share, penetration\n- **Operational metrics**: Efficiency, scalability\n\n## π‘ Strategic Recommendations\n- **Priority ranking**: Which opportunities to pursue first\n- **Resource allocation**: Where to focus efforts\n- **Partnership strategy**: Who to work with\n- **Competitive positioning**: How to differentiate\n- **Next steps**: Specific actions to take",
|
| 51 |
+
"category": "business"
|
| 52 |
+
},
|
| 53 |
"whitepaper_analysis": {
|
| 54 |
"name": "π Whitepaper Analysis",
|
| 55 |
"description": "Comprehensive analysis for whitepapers and research papers",
|