Update app.py
Browse files
app.py
CHANGED
@@ -28,12 +28,16 @@ gemini_llm = GoogleGenerativeAI(model="gemini-pro", google_api_key=GOOGLE_AI_STU
|
|
28 |
|
29 |
# Base Example with Gemini Search
|
30 |
|
31 |
-
def crewai_process(
|
32 |
# Define your agents with roles and goals
|
33 |
crazy1 = Agent(
|
34 |
-
role='
|
35 |
-
goal=f'Discuss issue with {
|
36 |
-
|
|
|
|
|
|
|
|
|
37 |
verbose=True,
|
38 |
allow_delegation=False,
|
39 |
llm = gemini_llm,
|
@@ -45,9 +49,68 @@ def crewai_process(research_topic):
|
|
45 |
|
46 |
)
|
47 |
crazy2 = Agent(
|
48 |
-
role='
|
49 |
-
goal='
|
50 |
-
backstory="""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
verbose=True,
|
52 |
allow_delegation=True,
|
53 |
llm = gemini_llm,
|
@@ -61,21 +124,37 @@ def crewai_process(research_topic):
|
|
61 |
|
62 |
# Create tasks for your agents
|
63 |
task1 = Task(
|
64 |
-
description=f"""Discuss the {
|
65 |
-
do 10 rounds of chat with. react to
|
66 |
-
agent=
|
67 |
)
|
68 |
|
69 |
task2 = Task(
|
70 |
-
description=f"""Discuss the {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
do 10 rounds of chat with. react to crazy1 """,
|
72 |
-
agent=
|
|
|
|
|
|
|
|
|
73 |
)
|
74 |
|
75 |
# Instantiate your crew with a sequential process
|
76 |
crew = Crew(
|
77 |
-
agents=[
|
78 |
-
tasks=[task1, task2],
|
79 |
verbose=2,
|
80 |
process=Process.sequential
|
81 |
)
|
|
|
28 |
|
29 |
# Base Example with Gemini Search
|
30 |
|
31 |
+
def crewai_process(discussion_topic):
|
32 |
# Define your agents with roles and goals
|
33 |
crazy1 = Agent(
|
34 |
+
role='Therapist',
|
35 |
+
goal=f'Discuss issue with {discussion_topic} and come to a deeper understanding.
|
36 |
+
Facilitate a supportive and constructive group therapy discussion on mental health.',
|
37 |
+
backstory=""" You are Dr.Smith. Dr. Smith is a seasoned therapist with a wealth of experience, has dedicated their career to helping individuals
|
38 |
+
navigate the complexities of mental health. With a compassionate and empathetic approach,
|
39 |
+
Dr. Smith has witnessed the transformative power of therapy and aims to create
|
40 |
+
a safe space for individuals to share, heal, and grow.""",
|
41 |
verbose=True,
|
42 |
allow_delegation=False,
|
43 |
llm = gemini_llm,
|
|
|
49 |
|
50 |
)
|
51 |
crazy2 = Agent(
|
52 |
+
role='Anxiety Patient',
|
53 |
+
goal='Share experiences and seek support for managing ongoing mental health challenges.',
|
54 |
+
backstory="""You are Sarah.
|
55 |
+
Sarah finds herself in the grips of anxiety and depression, grappling with the challenges that life has thrown her way.
|
56 |
+
The weight of these struggles in both personal and professional spheres has led Sarah to seek solace in therapy.
|
57 |
+
Desiring understanding and support, Sarah embarks on a journey toward healing,
|
58 |
+
hoping to connect with others who can relate to her experiences.""",
|
59 |
+
verbose=True,
|
60 |
+
allow_delegation=True,
|
61 |
+
llm = gemini_llm,
|
62 |
+
tools=[
|
63 |
+
MixtralSearchTools.mixtral_normal,
|
64 |
+
GeminiSearchTools.gemini_search
|
65 |
+
]
|
66 |
+
|
67 |
+
# Add tools and other optional parameters as needed
|
68 |
+
)
|
69 |
+
crazy3 = Agent(
|
70 |
+
role='Recovered Patient',
|
71 |
+
goal=f'Share insights from overcoming depression and offer support to others regarding {discussion_topic}.'
|
72 |
+
backstory="""You are Emily.
|
73 |
+
Emily faced the depths of severe depression, a journey marked by pain and despair.
|
74 |
+
Through resilience, therapy, and unwavering support from loved ones,
|
75 |
+
Emily emerged victorious over the darkness that once consumed her.
|
76 |
+
Driven by a profound desire to give back, Emily now stands as a beacon of hope,
|
77 |
+
eager to share her insights and support others on their path to recovery.""",
|
78 |
+
verbose=True,
|
79 |
+
allow_delegation=True,
|
80 |
+
llm = gemini_llm,
|
81 |
+
tools=[
|
82 |
+
MixtralSearchTools.mixtral_normal,
|
83 |
+
GeminiSearchTools.gemini_search
|
84 |
+
]
|
85 |
+
|
86 |
+
# Add tools and other optional parameters as needed
|
87 |
+
)
|
88 |
+
crazy4 = Agent(
|
89 |
+
role='Current Patient',
|
90 |
+
goal='Discuss the impact of PTSD and foster understanding among the group.',
|
91 |
+
backstory="""You are Alex.
|
92 |
+
Alex, a brave military veteran, carries the scars of service in the form of PTSD.
|
93 |
+
The haunting memories of the battlefield have left an indelible mark on Alex's mental well-being.
|
94 |
+
Now, in the process of recovery, Alex seeks the understanding and camaraderie of peers who can
|
95 |
+
empathize with the unique challenges that come with post-traumatic stress disorder.""",
|
96 |
+
verbose=True,
|
97 |
+
allow_delegation=True,
|
98 |
+
llm = gemini_llm,
|
99 |
+
tools=[
|
100 |
+
MixtralSearchTools.mixtral_normal,
|
101 |
+
GeminiSearchTools.gemini_search
|
102 |
+
]
|
103 |
+
|
104 |
+
# Add tools and other optional parameters as needed
|
105 |
+
)
|
106 |
+
crazy5 = Agent(
|
107 |
+
role='Recovered Patient',
|
108 |
+
goal='Provide empathy and understanding to current patients based on personal experiences.',
|
109 |
+
backstory="""You are Chris.
|
110 |
+
Chris, having triumphed over the clutches of anxiety disorder, understands the tumultuous
|
111 |
+
journey to recovery intimately. The struggle involved reshaping lifestyle, cultivating resilience,
|
112 |
+
and fostering a robust support network. Now, with a deep well of empathy, Chris is committed to offering
|
113 |
+
understanding and encouragement to those currently navigating the challenges of mental health.""",
|
114 |
verbose=True,
|
115 |
allow_delegation=True,
|
116 |
llm = gemini_llm,
|
|
|
124 |
|
125 |
# Create tasks for your agents
|
126 |
task1 = Task(
|
127 |
+
description=f"""Discuss the {discussion_topic}. Use Mixtral
|
128 |
+
do 10 rounds of chat with. react to crazy4 """,
|
129 |
+
agent=crazy2
|
130 |
)
|
131 |
|
132 |
task2 = Task(
|
133 |
+
description=f"""Discuss the {discussion_topic}. Use Mixtral
|
134 |
+
do 10 rounds of chat with. react to crazy3.
|
135 |
+
Discuss the impact of PTSD""",
|
136 |
+
agent=crazy4
|
137 |
+
)
|
138 |
+
task3 = Task(
|
139 |
+
description=f"""Discuss the {discussion_topic}. Use Mixtral
|
140 |
+
do 10 rounds of chat with. react to crazy5
|
141 |
+
Share insights from overcoming depression or any type of mental illness. """,
|
142 |
+
agent=crazy3
|
143 |
+
)
|
144 |
+
task4 = Task(
|
145 |
+
description=f"""Discuss the {discussion_topic}. Use Mixtral
|
146 |
do 10 rounds of chat with. react to crazy1 """,
|
147 |
+
agent=crazy5
|
148 |
+
)
|
149 |
+
task5 = Task(
|
150 |
+
description=f"""{crazy1.role} listens to all the discussion peacefully. Deeply understand the problem and provide his sincere suggestions """,
|
151 |
+
agent=crazy1
|
152 |
)
|
153 |
|
154 |
# Instantiate your crew with a sequential process
|
155 |
crew = Crew(
|
156 |
+
agents=[crazy3, crazy4, crazy2, crazy5, crazy1],
|
157 |
+
tasks=[task1, task2, task3, task4, task5],
|
158 |
verbose=2,
|
159 |
process=Process.sequential
|
160 |
)
|