Update app.py
Browse files
app.py
CHANGED
@@ -36,10 +36,46 @@ TITLE3 = """<h3 align="center">"To see active group discussion click on logs dur
|
|
36 |
|
37 |
def crewai_process(research_topic):
|
38 |
# Define your agents with roles and goals
|
39 |
-
|
40 |
-
role='
|
41 |
-
goal=
|
42 |
-
backstory="""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
verbose=True,
|
44 |
allow_delegation=False,
|
45 |
llm = gemini_llm,
|
@@ -49,39 +85,78 @@ def crewai_process(research_topic):
|
|
49 |
|
50 |
]
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
)
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
57 |
verbose=True,
|
58 |
-
allow_delegation=
|
59 |
llm = gemini_llm,
|
60 |
tools=[
|
61 |
MixtralSearchTools.mixtral_normal,
|
|
|
62 |
GeminiSearchTools.gemini_search
|
|
|
63 |
]
|
64 |
-
|
65 |
-
# Add tools and other optional parameters as needed
|
66 |
)
|
|
|
67 |
|
68 |
# Create tasks for your agents
|
69 |
task1 = Task(
|
70 |
-
description=f"""Discuss the {research_topic}. Use Mixtral
|
71 |
-
|
72 |
-
agent=
|
73 |
)
|
74 |
|
75 |
task2 = Task(
|
76 |
-
description=f"""Discuss the {research_topic}. Use
|
77 |
-
|
78 |
-
agent=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
)
|
80 |
|
81 |
# Instantiate your crew with a sequential process
|
82 |
crew = Crew(
|
83 |
-
agents=[
|
84 |
-
tasks=[task1, task2],
|
85 |
verbose=2,
|
86 |
process=Process.sequential
|
87 |
)
|
|
|
36 |
|
37 |
def crewai_process(research_topic):
|
38 |
# Define your agents with roles and goals
|
39 |
+
Emily = Agent(
|
40 |
+
role='Mental Patient',
|
41 |
+
goal='To learn how to manage her anxiety in social situations.',
|
42 |
+
backstory="""Emily is a 28-year-old graphic designer. She has always struggled with social anxiety,
|
43 |
+
making it difficult for her to participate in group settings. She joined the therapy group to improve
|
44 |
+
her social skills and manage her anxiety.""",
|
45 |
+
verbose=True,
|
46 |
+
allow_delegation=False,
|
47 |
+
llm = gemini_llm,
|
48 |
+
tools=[
|
49 |
+
MixtralSearchTools.mixtral_normal,
|
50 |
+
GeminiSearchTools.gemini_search
|
51 |
+
|
52 |
+
]
|
53 |
+
|
54 |
+
)
|
55 |
+
|
56 |
+
David = Agent(
|
57 |
+
role='Mental Patient',
|
58 |
+
goal='To gain insights into managing his bipolar disorder.',
|
59 |
+
backstory="""David, a 35-year-old musician, has been living with bipolar disorder for over a decade.
|
60 |
+
His condition has impacted his career and personal life. He seeks to understand his emotions better
|
61 |
+
and find stability through the group sessions.""",
|
62 |
+
verbose=True,
|
63 |
+
allow_delegation=False,
|
64 |
+
llm = gemini_llm,
|
65 |
+
tools=[
|
66 |
+
ZephyrSearchTools.zephyr_crazy,
|
67 |
+
GeminiSearchTools.gemini_search
|
68 |
+
|
69 |
+
]
|
70 |
+
|
71 |
+
)
|
72 |
+
|
73 |
+
Sarah = Agent(
|
74 |
+
role='Mental Patient',
|
75 |
+
goal='To find strategies to cope with her depression.',
|
76 |
+
backstory="""Sarah, 42, is a former teacher who has been battling depression for several years.
|
77 |
+
The illness has led her to leave her job. She hopes to find new coping mechanisms and rediscover
|
78 |
+
her passion for teaching.""",
|
79 |
verbose=True,
|
80 |
allow_delegation=False,
|
81 |
llm = gemini_llm,
|
|
|
85 |
|
86 |
]
|
87 |
|
88 |
+
)
|
89 |
+
|
90 |
+
Michael = Agent(
|
91 |
+
role='Mental Patient',
|
92 |
+
goal='To overcome his PTSD and return to a normal life.',
|
93 |
+
backstory="""Michael is a 30-year-old ex-soldier. He developed PTSD following his service.
|
94 |
+
Struggling with flashbacks and anxiety, he joined the group to seek support and ways to
|
95 |
+
return to civilian life smoothly.""",
|
96 |
+
verbose=True,
|
97 |
+
allow_delegation=False,
|
98 |
+
llm = gemini_llm,
|
99 |
+
tools=[
|
100 |
+
ZephyrSearchTools.zephyr_normal,
|
101 |
+
GeminiSearchTools.gemini_search
|
102 |
+
|
103 |
+
]
|
104 |
+
|
105 |
)
|
106 |
+
|
107 |
+
Lisa = Agent(
|
108 |
+
role='Therapist',
|
109 |
+
goal='To facilitate the group progress and assist each member in their personal goals.',
|
110 |
+
backstory=""" Dr. Thompson is a seasoned psychologist specializing in group therapy.
|
111 |
+
With over 15 years of experience, she is skilled at creating a safe space for her patients
|
112 |
+
to explore and address their mental health challenges.""",
|
113 |
verbose=True,
|
114 |
+
allow_delegation=False,
|
115 |
llm = gemini_llm,
|
116 |
tools=[
|
117 |
MixtralSearchTools.mixtral_normal,
|
118 |
+
ZephyrSearchTools.zephyr_normal,
|
119 |
GeminiSearchTools.gemini_search
|
120 |
+
|
121 |
]
|
122 |
+
|
|
|
123 |
)
|
124 |
+
|
125 |
|
126 |
# Create tasks for your agents
|
127 |
task1 = Task(
|
128 |
+
description=f"""Discuss the {research_topic} from your backstory perspective. Use Mixtral
|
129 |
+
""",
|
130 |
+
agent=Emily
|
131 |
)
|
132 |
|
133 |
task2 = Task(
|
134 |
+
description=f"""Discuss the {research_topic} from your backstory perspective. Use Zephyr
|
135 |
+
""",
|
136 |
+
agent=David
|
137 |
+
)
|
138 |
+
|
139 |
+
task3 = Task(
|
140 |
+
description=f"""Discuss the {research_topic} from your backstory perspective. Use Mixtral
|
141 |
+
""",
|
142 |
+
agent=Sarah
|
143 |
+
)
|
144 |
+
task4 = Task(
|
145 |
+
description=f"""Discuss the {research_topic} from your backstory perspective. Use Zephyr
|
146 |
+
""",
|
147 |
+
agent=Michael
|
148 |
+
)
|
149 |
+
task4 = Task(
|
150 |
+
description=f"""Discuss the {research_topic} from your backstory perspective.
|
151 |
+
Use Gemini, Mixtral or Zephyr what ever is appropriate.
|
152 |
+
""",
|
153 |
+
agent=Lisa
|
154 |
)
|
155 |
|
156 |
# Instantiate your crew with a sequential process
|
157 |
crew = Crew(
|
158 |
+
agents=[Emily, David, Sarah, Michael, Lisa ],
|
159 |
+
tasks=[task1, task2, task3, task4, task5],
|
160 |
verbose=2,
|
161 |
process=Process.sequential
|
162 |
)
|