diegocp01 commited on
Commit
5f1d978
·
verified ·
1 Parent(s): c62fb0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +74 -1
app.py CHANGED
@@ -36,6 +36,79 @@ def chatgpt_conversation(prompt: str) -> str:
36
  )
37
  return response.choices[0].message.content
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  @tool
41
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -74,7 +147,7 @@ with open("prompts.yaml", 'r') as stream:
74
 
75
  agent = CodeAgent(
76
  model=model,
77
- tools=[final_answer, get_current_time_in_timezone, chatgpt_conversation], ## add your tools here (don't remove final answer)
78
  max_steps=6,
79
  verbosity_level=1,
80
  grammar=None,
 
36
  )
37
  return response.choices[0].message.content
38
 
39
+ @tool
40
+ def marketing_expert_review(post: str) -> str:
41
+ """A tool that reviews and enhances social media posts to maximize impressions, leveraging expertise in marketing, neuromarketing, sales, and social media strategies.
42
+
43
+ Args:
44
+ post: The social media post to be reviewed and enhanced.
45
+ """
46
+ prompt = f"""
47
+ You are an expert in marketing, neuromarketing, sales, and social media post reviewing with over 15 years of experience optimizing content for maximum reach and engagement. Your expertise includes understanding audience psychology, crafting compelling narratives, and applying proven strategies to boost impressions on platforms like Instagram, Facebook, LinkedIn, and Twitter. Your task is to review and enhance the following social media post to make it as engaging, attractive, and impactful as possible, ensuring it captures attention and drives the highest possible impressions.
48
+
49
+ **Context**: Social media platforms thrive on posts that are emotionally resonant, visually suggestive (even in text), and encourage interaction (likes, shares, comments). Successful posts often include a hook in the first few words, a clear value proposition, and a call-to-action.
50
+
51
+ **Post to enhance**: "{post}"
52
+
53
+ **Format**: Provide the enhanced post directly as a single block of text, ready to be posted. Keep it concise yet powerful, suitable for broad social media use unless a specific platform is mentioned in the instructions.
54
+
55
+ **References**: For guidance, consider posts like: "Just dropped our new summer collection – bold colors, big vibes! Which shade’s your vibe? Drop it below! 🌟 #SummerStyle" (hook + engagement + hashtag) or "Struggling with productivity? This 5-min trick changed my life – and it’ll change yours too. Link in bio!" (problem-solution + curiosity).
56
+
57
+ Enhanced post:
58
+ """
59
+ try:
60
+ response = openai.chat.completions.create(
61
+ model="gpt-4o-mini",
62
+ messages=[
63
+ {"role": "user", "content": prompt}
64
+ ],
65
+ )
66
+ return response.choices[0].message.content
67
+ except Exception as e:
68
+ return f"Error generating enhanced post: {str(e)}"
69
+
70
+ @tool
71
+ def twitter_post_enhancer(post: str) -> str:
72
+ """A tool that enhances short, basic social media posts into engaging Twitter (X) posts, leveraging expertise in social media engagement and content writing.
73
+
74
+ Args:
75
+ post: The social media post to be enhanced for Twitter.
76
+ """
77
+ prompt = f"""
78
+ You are an expert in social media engagement and content writing, with a specialization in crafting posts for Twitter (X). You have a deep understanding of Twitter’s unique culture, where concise, punchy, and emotionally engaging content thrives within a 280-character limit. Your task is to take the following short, basic social media post and enhance it to make it more engaging, attractive, and appealing for a general Twitter audience. Focus on:
79
+ - Adding relevant emojis to boost visual appeal and emotion.
80
+ - Rephrasing text for clarity, impact, and a casual, conversational tone.
81
+ - Making the post interesting and shareable while keeping it concise and easy to understand.
82
+
83
+ **Context**: Twitter users scroll fast—posts need a strong hook, relatable or surprising elements, and often a question or bold statement to spark interaction. Trending topics, humor, and timely references can amplify reach.
84
+
85
+ **Post to enhance**: "{post}"
86
+
87
+ **Format**: Return the enhanced post in this structure:
88
+ <title>
89
+ <br>
90
+ <Brief summary.>
91
+
92
+ **References**: Draw inspiration from posts like:
93
+ - "AI just solved a 10-yr mystery in 48 hrs! 🧠💥 Scientists are shook. What’s next for tech?"
94
+ <br>
95
+ "Google’s co-scientist cracked a superbug puzzle faster than a decade of research."
96
+ - "New year, new hacks! 🚀✨ What’s your top productivity tip? Spill it below!"
97
+ <br>
98
+ "Quick tricks to kickstart your 2023 goals."
99
+
100
+ Enhanced post:
101
+ """
102
+ try:
103
+ response = openai.chat.completions.create(
104
+ model="gpt-4o-mini",
105
+ messages=[
106
+ {"role": "user", "content": prompt}
107
+ ],
108
+ )
109
+ return response.choices[0].message.content
110
+ except Exception as e:
111
+ return f"Error generating enhanced Twitter post: {str(e)}"
112
 
113
  @tool
114
  def get_current_time_in_timezone(timezone: str) -> str:
 
147
 
148
  agent = CodeAgent(
149
  model=model,
150
+ tools=[final_answer, twitter_post_enhancer, marketing_expert_review], ## add your tools here (don't remove final answer)
151
  max_steps=6,
152
  verbosity_level=1,
153
  grammar=None,