JatsTheAIGen commited on
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

Files changed (3) hide show
  1. agents.py +51 -27
  2. utils/__init__.py +2 -2
  3. 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: produce stunning, visually rich, and highly engaging insights.
83
 
84
- CRITICAL VISUAL FORMATTING REQUIREMENTS:
85
- - Use beautiful section headers with emojis and clear hierarchy
86
- - Create visually appealing bullet points with icons (β€’ βœ… ❌ ⚠️ πŸ’‘ 🎯 πŸ“Š)
87
- - Use tables extensively for data comparison and organization
88
- - Include progress bars, metrics cards, and visual separators
89
- - Use **bold** for key concepts, numbers, and important data
90
- - Create infographic-style summaries with visual elements
91
- - Use color coding and visual hierarchy throughout
92
- - Include actionable insights with clear visual indicators
93
 
94
- CONTENT REQUIREMENTS:
95
- - Be concise but comprehensive - every word counts
96
- - Use simple language with technical depth when needed
97
- - Include specific numbers, percentages, and metrics prominently
98
- - Provide clear next steps with visual callouts
99
- - Structure information for instant scanning and understanding
100
- - Focus on what matters most with visual emphasis
101
- - Create engaging, professional presentations
102
 
103
- VISUAL ELEMENTS TO USE:
104
- - πŸ“Š Data visualizations and metrics
105
- - 🎯 Key insights with visual emphasis
106
- - βœ… Success indicators and achievements
107
- - ⚠️ Important warnings and considerations
108
- - πŸ’‘ Actionable recommendations
109
- - πŸ“ˆ Trends and comparisons
110
- - πŸ” Detailed analysis sections"""
 
 
 
 
 
 
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: produce concise insights and structured summaries. Adapt your language and complexity to the target audience. Provide clear, actionable insights with appropriate examples and analogies for complex topics."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 a summarization expert. Create concise summaries that capture the most important insights."},
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 an expert at creating comprehensive summaries from multiple sources. Synthesize the key insights into a coherent final summary."},
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",