-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpresenter_agent.py
More file actions
127 lines (96 loc) · 3.66 KB
/
presenter_agent.py
File metadata and controls
127 lines (96 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
"""
Presenter Agent - Produces final structured output
"""
from google import genai
from google.genai import types
import json
from datetime import datetime
class PresenterAgent:
"""Agent responsible for creating final structured presentation"""
def __init__(self, api_key: str, model_name: str = "gemini-2.5-flash"):
"""Initialize the Presenter Agent with Gemini model"""
self.client = genai.Client(api_key=api_key)
self.model_name = model_name
self.name = "Presenter Agent"
def create_presentation(self, refined_data: dict) -> dict:
"""
Create a final structured presentation of the creative process and results
Args:
refined_data: Dictionary containing refined ideas from the Refiner Agent
Returns:
dict: Contains the final structured presentation
"""
topic = refined_data.get("topic", "Unknown")
original_ideas = refined_data.get("original_ideas", "")
critique = refined_data.get("critique", "")
refined_ideas = refined_data.get("refined_ideas", "")
prompt = f"""You are a Presenter Agent. Create a professional, executive-ready presentation document that showcases the entire creative process and final recommendations.
TOPIC: {topic}
ORIGINAL IDEAS:
{original_ideas}
CRITICAL ANALYSIS:
{critique}
REFINED IDEAS:
{refined_ideas}
Create a comprehensive presentation document with:
1. EXECUTIVE SUMMARY
- Brief overview of the project
- Key findings and recommendations
2. CREATIVE PROCESS OVERVIEW
- How ideas were generated
- How they were critiqued
- How they were refined
3. FINAL RECOMMENDATIONS (Top 3 Ideas)
- Present each refined idea with:
* Title
* Complete description
* Target audience
* Implementation roadmap
* Expected outcomes
* Risk mitigation strategies
4. COMPARISON ANALYSIS
- How original ideas evolved
- Key improvements made
- Value added through the refinement process
5. NEXT STEPS
- Action items
- Timeline suggestions
- Resource requirements
Make it professional, clear, and actionable. Use markdown formatting for better readability."""
response = self.client.models.generate_content(
model=self.model_name,
contents=prompt
)
presentation_text = response.text
return {
"agent": self.name,
"topic": topic,
"presentation": presentation_text,
"generated_at": datetime.now().isoformat(),
"status": "completed"
}
def save_presentation(self, presentation_data: dict, filename: str = None):
"""
Save the presentation to a markdown file
Args:
presentation_data: The presentation data to save
filename: Optional filename (default: creative_studio_output_[timestamp].md)
"""
if filename is None:
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
filename = f"creative_studio_output_{timestamp}.md"
content = f"""# Multi-Agent Creative Studio Output
**Topic:** {presentation_data.get('topic', 'Unknown')}
**Generated:** {presentation_data.get('generated_at', 'Unknown')}
**Agent:** {presentation_data.get('agent', 'Unknown')}
---
{presentation_data.get('presentation', '')}
---
*Generated by Multi-Agent Creative Studio*
*Powered by Google Gemini 2.5 Flash*
"""
with open(filename, 'w', encoding='utf-8') as f:
f.write(content)
return filename
def __str__(self):
return f"{self.name} (Gemini-powered presentation creator)"