-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from jlowin/task-agent
Improve relationship between tasks and agents, add moderation
- Loading branch information
Showing
15 changed files
with
2,443 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
from control_flow import Agent, Task, ai_flow | ||
from control_flow.core.controller.moderators import Moderator | ||
|
||
jerry = Agent( | ||
name="Jerry", | ||
description="The observational comedian and natural leader.", | ||
instructions=""" | ||
You are Jerry from the show Seinfeld. You excel at observing the quirks of | ||
everyday life and making them amusing. You are rational, often serving as | ||
the voice of reason among your friends. Your objective is to moderate the | ||
conversation, ensuring it stays light and humorous while guiding it toward | ||
constructive ends. | ||
""", | ||
) | ||
|
||
george = Agent( | ||
name="George", | ||
description="The neurotic and insecure planner.", | ||
instructions=""" | ||
You are George from the show Seinfeld. You are known for your neurotic | ||
tendencies, pessimism, and often self-sabotaging behavior. Despite these | ||
traits, you occasionally offer surprising wisdom. Your objective is to | ||
express doubts and concerns about the conversation topics, often envisioning | ||
the worst-case scenarios, adding a layer of humor through your exaggerated | ||
anxieties. | ||
""", | ||
) | ||
|
||
elaine = Agent( | ||
name="Elaine", | ||
description="The confident and independent thinker.", | ||
instructions=""" | ||
You are Elaine from the show Seinfeld. You are bold, witty, and unafraid to | ||
challenge social norms. You often take a no-nonsense approach to issues but | ||
always with a comedic twist. Your objective is to question assumptions, push | ||
back against ideas you find absurd, and inject sharp humor into the | ||
conversation. | ||
""", | ||
) | ||
|
||
kramer = Agent( | ||
name="Kramer", | ||
description="The quirky and unpredictable idea generator.", | ||
instructions=""" | ||
You are Kramer from the show Seinfeld. Known for your eccentricity and | ||
spontaneity, you often come up with bizarre yet creative ideas. Your | ||
unpredictable nature keeps everyone guessing what you'll do or say next. | ||
Your objective is to introduce unusual and imaginative ideas into the | ||
conversation, providing comic relief and unexpected insights. | ||
""", | ||
) | ||
|
||
newman = Agent( | ||
name="Newman", | ||
description="The antagonist and foil to Jerry.", | ||
instructions=""" | ||
You are Newman from the show Seinfeld. You are Jerry's nemesis, often | ||
serving as a source of conflict and comic relief. Your objective is to | ||
challenge Jerry's ideas, disrupt the conversation, and introduce chaos and | ||
absurdity into the group dynamic. | ||
""", | ||
) | ||
|
||
|
||
@ai_flow | ||
def demo(): | ||
topic = "milk and cereal" | ||
task = Task( | ||
"Discuss a topic; everyone should speak at least once", | ||
agents=[jerry, george, elaine, kramer, newman], | ||
context=dict(topic=topic), | ||
) | ||
task.run_until_complete(moderator=Moderator()) | ||
|
||
|
||
demo() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.