Spaces:
Sleeping
Sleeping
agent with meme roaster tool
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool,
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
@@ -7,16 +7,145 @@ from tools.final_answer import FinalAnswerTool
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
-
#
|
| 11 |
@tool
|
| 12 |
-
def
|
| 13 |
-
|
| 14 |
-
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -55,7 +184,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 1 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel, load_tool, tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
+
# AI Framework Roasting Meme Generator Tool
|
| 11 |
@tool
|
| 12 |
+
def roast_ai_frameworks_meme(target_framework: str = "random", roast_style: str = "playful") -> str:
|
| 13 |
+
"""Generates memes that playfully mock and roast AI agent frameworks and their quirks.
|
| 14 |
+
|
| 15 |
Args:
|
| 16 |
+
target_framework: Which framework to roast (options: "langchain", "autogen", "crewai", "smolagents", "haystack", "random")
|
| 17 |
+
roast_style: How savage the roast should be (options: "playful", "savage", "brutal")
|
| 18 |
"""
|
| 19 |
+
|
| 20 |
+
# Framework-specific roasts and stereotypes
|
| 21 |
+
framework_roasts = {
|
| 22 |
+
"langchain": {
|
| 23 |
+
"stereotypes": ["overcomplicated everything", "documentation nightmare", "callback hell", "abstraction overload"],
|
| 24 |
+
"common_issues": ["version breaking changes", "too many ways to do one thing", "memory management chaos", "dependency hell"],
|
| 25 |
+
"meme_scenarios": [
|
| 26 |
+
"trying to understand LangChain's architecture",
|
| 27 |
+
"reading LangChain docs for the 100th time",
|
| 28 |
+
"LangChain update breaking your entire project",
|
| 29 |
+
"explaining LangChain to a junior developer"
|
| 30 |
+
]
|
| 31 |
+
},
|
| 32 |
+
"autogen": {
|
| 33 |
+
"stereotypes": ["agents talking in circles", "conversation loops", "Microsoft complexity", "over-engineered"],
|
| 34 |
+
"common_issues": ["agents arguing forever", "multi-agent chaos", "conversation management", "complex setup"],
|
| 35 |
+
"meme_scenarios": [
|
| 36 |
+
"AutoGen agents having a 3-hour argument about nothing",
|
| 37 |
+
"trying to stop AutoGen agents from talking",
|
| 38 |
+
"AutoGen agent conversation going completely off-topic",
|
| 39 |
+
"setting up AutoGen for a simple task"
|
| 40 |
+
]
|
| 41 |
+
},
|
| 42 |
+
"crewai": {
|
| 43 |
+
"stereotypes": ["trying too hard to be cool", "crew member management", "workflow complexity", "startup vibes"],
|
| 44 |
+
"common_issues": ["crew coordination problems", "task delegation chaos", "role confusion", "process overhead"],
|
| 45 |
+
"meme_scenarios": [
|
| 46 |
+
"CrewAI agents not knowing their roles",
|
| 47 |
+
"crew members doing each other's jobs",
|
| 48 |
+
"CrewAI workflow taking longer than doing it manually",
|
| 49 |
+
"explaining why you need a 'crew' for a simple task"
|
| 50 |
+
]
|
| 51 |
+
},
|
| 52 |
+
"smolagents": {
|
| 53 |
+
"stereotypes": ["'smol' but complicated", "trying to be minimalist", "tool management issues", "documentation gaps"],
|
| 54 |
+
"common_issues": ["tool integration problems", "limited ecosystem", "debugging nightmares", "unclear error messages"],
|
| 55 |
+
"meme_scenarios": [
|
| 56 |
+
"SmolagAgents being anything but 'smol'",
|
| 57 |
+
"trying to debug a SmolagAgents tool",
|
| 58 |
+
"SmolagAgents promising simplicity but delivering complexity",
|
| 59 |
+
"finding SmolagAgents documentation"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
"haystack": {
|
| 63 |
+
"stereotypes": ["search obsessed", "RAG everything", "pipeline confusion", "enterprise bloat"],
|
| 64 |
+
"common_issues": ["pipeline configuration hell", "version compatibility", "component confusion", "setup complexity"],
|
| 65 |
+
"meme_scenarios": [
|
| 66 |
+
"Haystack turning every problem into a search problem",
|
| 67 |
+
"configuring Haystack pipelines",
|
| 68 |
+
"Haystack's 47 different ways to do RAG",
|
| 69 |
+
"Haystack documentation sending you in circles"
|
| 70 |
+
]
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
# Select target framework
|
| 75 |
+
if target_framework == "random":
|
| 76 |
+
import random
|
| 77 |
+
target_framework = random.choice(list(framework_roasts.keys()))
|
| 78 |
+
|
| 79 |
+
framework_data = framework_roasts.get(target_framework, framework_roasts["smolagents"])
|
| 80 |
+
|
| 81 |
+
# Meme formats perfect for roasting
|
| 82 |
+
roast_formats = [
|
| 83 |
+
"Drake rejecting vs approving meme format",
|
| 84 |
+
"Expanding brain meme with increasingly absurd solutions",
|
| 85 |
+
"Distracted boyfriend looking at other frameworks",
|
| 86 |
+
"This is fine dog in burning room (framework on fire)",
|
| 87 |
+
"Galaxy brain ascending to framework enlightenment",
|
| 88 |
+
"Two buttons difficult choice between frameworks",
|
| 89 |
+
"Surprised Pikachu face when framework breaks",
|
| 90 |
+
"Woman yelling at cat (developer vs framework)",
|
| 91 |
+
"Stonks going down with framework complexity",
|
| 92 |
+
"Change my mind: framework is overcomplicated"
|
| 93 |
+
]
|
| 94 |
+
|
| 95 |
+
# Roast intensity levels
|
| 96 |
+
roast_levels = {
|
| 97 |
+
"playful": "gentle teasing, developer humor, lighthearted jokes about common issues",
|
| 98 |
+
"savage": "pointed criticism, highlighting real problems, witty burns about framework flaws",
|
| 99 |
+
"brutal": "ruthless roasting, exposing all the pain points, maximum developer frustration humor"
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
# Pick random elements
|
| 103 |
+
import random
|
| 104 |
+
selected_format = random.choice(roast_formats)
|
| 105 |
+
selected_scenario = random.choice(framework_data["meme_scenarios"])
|
| 106 |
+
selected_issue = random.choice(framework_data["common_issues"])
|
| 107 |
+
selected_stereotype = random.choice(framework_data["stereotypes"])
|
| 108 |
+
|
| 109 |
+
roast_intensity = roast_levels[roast_style]
|
| 110 |
+
|
| 111 |
+
# Create the roast meme prompt
|
| 112 |
+
meme_prompt = f"""Create a programming meme roasting {target_framework.title()} using {selected_format}.
|
| 113 |
+
|
| 114 |
+
Scenario: {selected_scenario}
|
| 115 |
+
Focus on: {selected_issue} and {selected_stereotype}
|
| 116 |
+
|
| 117 |
+
Roast style: {roast_intensity}
|
| 118 |
+
|
| 119 |
+
The meme should be relatable to developers who have struggled with AI frameworks.
|
| 120 |
+
Include bold, readable meme text with typical internet meme formatting.
|
| 121 |
+
Make it funny but accurate to real developer experiences.
|
| 122 |
+
Use programming/developer culture references and inside jokes.
|
| 123 |
+
The visual should clearly convey developer frustration or irony.
|
| 124 |
+
Perfect for sharing on developer Twitter, Reddit, or Discord.
|
| 125 |
+
High contrast text (white with black outline) for maximum readability."""
|
| 126 |
+
|
| 127 |
+
instructions = f"""
|
| 128 |
+
🔥 AI FRAMEWORK ROAST MEME GENERATOR 🔥
|
| 129 |
+
|
| 130 |
+
Target: {target_framework.title()}
|
| 131 |
+
Roast Level: {roast_style.title()}
|
| 132 |
+
Scenario: {selected_scenario}
|
| 133 |
+
Format: {selected_format}
|
| 134 |
+
|
| 135 |
+
ROAST PROMPT:
|
| 136 |
+
{meme_prompt}
|
| 137 |
+
|
| 138 |
+
BURN TOPICS:
|
| 139 |
+
• Main Issue: {selected_issue}
|
| 140 |
+
• Stereotype: {selected_stereotype}
|
| 141 |
+
• Developer Pain Point: Framework complexity vs promised simplicity
|
| 142 |
+
|
| 143 |
+
INSTRUCTIONS: Use the image generation tool with the prompt above to create this spicy developer meme!
|
| 144 |
+
|
| 145 |
+
⚠️ WARNING: This meme may cause framework maintainers to cry and developers to nod in agreement! ⚠️
|
| 146 |
+
"""
|
| 147 |
+
|
| 148 |
+
return instructions
|
| 149 |
|
| 150 |
@tool
|
| 151 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 184 |
|
| 185 |
agent = CodeAgent(
|
| 186 |
model=model,
|
| 187 |
+
tools=[final_answer, image_generation_tool], ## add your tools here (don't remove final answer)
|
| 188 |
max_steps=6,
|
| 189 |
verbosity_level=1,
|
| 190 |
grammar=None,
|