LinkedinMonitor / chatbot_prompts.py
GuglielmoTor's picture
Create chatbot_prompts.py
d6d277f verified
raw
history blame
5.4 kB
# chatbot_prompts.py
import logging
def get_initial_insight_and_suggestions(plot_id: str, plot_label: str, plot_data_summary=None):
"""
Generates an initial insight and suggested questions for a given plot.
Args:
plot_id (str): The unique identifier for the plot.
plot_label (str): The display label for the plot.
plot_data_summary: Optional data summary for more tailored insights (not used in this version).
Returns:
tuple: (initial_chat_message_dict, list_of_suggestion_strings)
"""
logging.info(f"Generating initial insight for plot_id: {plot_id}, label: {plot_label}")
base_persona = "As an expert in Employer Branding and LinkedIn social media strategy, here's an insight on your "
insight_text = f"{base_persona}**{plot_label}**:\n\n"
# Default suggestions
suggestions = [
f"What are key drivers for {plot_label.lower()}?",
f"How can I improve my {plot_label.lower()}?",
f"What does good performance look like for {plot_label.lower()}?"
]
# Customize insights and suggestions per plot_id
if plot_id == "followers_count":
insight_text += ("Tracking your 'Numero di Follower nel Tempo' is crucial. A steady increase indicates growing brand reach and influence. "
"If you observe stagnation or decline, it might be time to review your content strategy, posting frequency, or engagement tactics with your target audience. "
"Consider running campaigns or promoting your LinkedIn page on other channels.")
suggestions = [
"What content resonates most with potential followers on LinkedIn?",
"How often should I post to maximize follower growth?",
"Are there specific LinkedIn features I should leverage more to gain followers?"
]
elif plot_id == "engagement_rate":
insight_text += ("Your 'Tasso di Engagement nel Tempo' is a vital indicator of how compelling your audience finds your content. Higher rates signify that your posts are sparking meaningful conversations and interactions. "
"If engagement is low, re-evaluate content relevance, the types of media used, and the clarity of your calls to action. Experiment with questions, polls, and interactive content.")
suggestions = [
"What types of posts typically get the highest engagement on LinkedIn?",
"How does posting time affect engagement rates for my audience?",
"Can you give me examples of strong calls to action for LinkedIn posts?"
]
elif plot_id == "reach_over_time":
insight_text += ("The 'Copertura nel Tempo' (Reach) shows how many unique LinkedIn members are seeing your posts. Expanding reach is fundamental for brand awareness and attracting new followers. "
"If this metric is flat or declining, explore content sharing strategies, encourage employees to share company posts, utilize relevant hashtags, and consider targeted LinkedIn advertising.")
suggestions = [
"What are effective organic strategies to increase post reach on LinkedIn?",
"Should I consider paid promotion to boost reach for key content?",
"How do hashtags and tagging strategies impact reach on LinkedIn?"
]
elif plot_id == "impressions_over_time":
insight_text += ("'Visualizzazioni nel Tempo' (Impressions) indicates the total number of times your posts have been seen. While related to reach, impressions can be higher as one person might see your post multiple times. "
"High impressions are good, but also analyze them in conjunction with engagement to ensure visibility translates to interaction.")
suggestions = [
"What's the difference between reach and impressions, and which is more important?",
"How can I increase the virality of my posts to get more impressions?",
"Does LinkedIn's algorithm favor certain types of content for impressions?"
]
elif plot_id == "comments_sentiment":
insight_text += ("Analyzing the 'Ripartizione Commenti per Sentiment' provides qualitative insights into how your content is being perceived. "
"A high volume of positive sentiment is ideal. Pay close attention to neutral and negative comments to understand concerns or areas for improvement in your communication or offerings.")
suggestions = [
"How can I encourage more positive comments on my posts?",
"What's the best way to respond to negative comments?",
"Can sentiment analysis help refine my content topics?"
]
else: # Default fallback for other plots
insight_text += (f"This chart on '{plot_label}' provides valuable data. Analyzing its trends, peaks, and troughs can help you refine your LinkedIn strategy. "
f"Look for patterns and correlate them with your activities or external events to understand performance drivers.")
# Ensure exactly 3 suggestions
while len(suggestions) < 3:
suggestions.append("Tell me more about this metric.")
if len(suggestions) > 3:
suggestions = suggestions[:3]
initial_chat_message = {"role": "assistant", "content": insight_text}
return initial_chat_message, suggestions