The generate-insights function creates professional PR and communications strategy reports based on sentiment data. It uses Gemini 2.0 Flash with function calling to optionally search the web for real-time context via Parallel AI.Supports two modes:
Report Generation: Creates full strategic analysis with recommendations
Chat Mode: Answers specific questions about sentiment data
## Situation AssessmentBrief overview of the current public sentiment landscape (2-3 sentences).## Key Concerns Identified- Main issue #1 driving negative sentiment- Main issue #2 causing frustration- Main issue #3 contributing to crisis level- Additional concern #4## Recommended Actions1. **Action verb**: Specific implementable recommendation2. **Action verb**: Another strategic response3. **Action verb**: Proactive measure to address concerns4. **Action verb**: Long-term reputation strategy5. **Action verb**: Communication plan adjustment## Opportunities- Potential opportunity #1 that could arise from this situation- Potential opportunity #2 to turn sentiment around- Potential opportunity #3 for positive messaging## Risk Factors to Monitor- Thing to watch #1 that could escalate the situation- Thing to watch #2 that indicates worsening sentiment- Thing to watch #3 for early warning signals
## Situation AssessmentThe iPhone 16 launch is facing significant public backlash with 42% of social media posts expressing anger and only 28% showing positive sentiment. The medium crisis level indicates elevated negativity that requires immediate attention. Volume is up 15%, suggesting the controversy is gaining traction.## Key Concerns Identified- Battery life complaints dominating the conversation (mentioned in 35% of negative posts)- Perceived lack of innovation compared to iPhone 15 Pro Max- Price increase not justified by feature improvements- Software bugs in iOS 18 affecting user experience## Recommended Actions1. **Acknowledge** battery concerns publicly and commit to software optimization in upcoming updates2. **Highlight** the differentiated features (camera improvements, A18 chip) through targeted content campaigns3. **Engage** directly with frustrated users on social platforms to demonstrate responsiveness4. **Release** a technical deep-dive explaining the engineering trade-offs and value proposition5. **Monitor** sentiment daily and prepare crisis escalation plan if negativity exceeds 60%## Opportunities- Pro Max variants showing stronger positive sentiment - leverage this segment for testimonials- Camera quality is being praised even by critics - focus marketing on visual storytelling- Early adopters forming defensive communities - empower them as brand advocates## Risk Factors to Monitor- Battery complaints spreading to mainstream media coverage- Comparison videos with competitors going viral- Return rates or pre-order cancellations increasing week-over-week
The function includes a web search tool powered by Parallel AI:
const tools = [{ type: 'function', function: { name: 'parallel_web_search', description: 'Search the web for real-time news and context', parameters: { type: 'object', properties: { query: { type: 'string', description: 'The search query' } }, required: ['query'] } }}];
Gemini can autonomously decide to use this tool:User: “What’s the latest news about this topic?”Gemini (internally): parallel_web_search({query: "iPhone 16 latest news"})Parallel AI: Returns 3 relevant web excerptsGemini: “Based on recent reports, the iPhone 16 battery controversy has been covered by TechCrunch and The Verge…”
You are a senior PR and communications strategist. Analyze the following public sentiment data and provide balanced, actionable recommendations.Topic: iPhone 16 LaunchHashtag: #iPhone16Overall Sentiment: mixedCrisis Level: mediumEmotion Breakdown: anger: 42%, joy: 28%, surprise: 18%Volume Change: +15%Generate a professional analysis report with the following sections:## Situation AssessmentBrief overview of the current public sentiment landscape (2-3 sentences).## Key Concerns Identified- Bullet points of main issues driving sentiment (3-4 points)## Recommended ActionsProvide 4-5 balanced, actionable recommendations. Each should:- Start with a clear action verb- Be specific and implementable- Consider both immediate and long-term impact- Not be one-sided or dismissive of public concerns## Opportunities- 2-3 potential opportunities that could arise from this situation## Risk Factors to Monitor- 2-3 things to watch that could escalate or change the situationKeep the tone professional, balanced, and constructive. Avoid corporate jargon.
You are an AI analyzing public sentiment data.Topic: iPhone 16 LaunchHashtag: #iPhone16Overall Sentiment: mixedCrisis Level: mediumTop Emotions: anger: 42%, joy: 28%, surprise: 18%Answer the user's questions in an extremely concise manner. Provide ONLY the direct answer to what is exactly asked. Do not add any polishing, pleasantries, formatting flair, or extra information. Just direct, raw answers.