Spaces:
Runtime error
Runtime error
add support for curiosity_catalyst
Browse files- agents/curiosity_catalyst.py +2 -0
- agents/learning_curator.py +1 -1
- agents/learning_profiler.py +1 -1
- app.py +9 -2
- crew/article_suggestion.py +5 -2
- tasks/create_article_pitch.py +20 -0
- tasks/new_article_suggestion.py +1 -1
- utils/recommended_article.py +7 -0
agents/curiosity_catalyst.py
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
from crewai import Agent
|
| 2 |
from llms.gemini import gemini
|
|
|
|
| 3 |
|
| 4 |
curiosity_catalyst = Agent(
|
| 5 |
role="Curiosity Catalyst",
|
| 6 |
goal="To pique the user's curiosity to read the article.",
|
| 7 |
verbose=True,
|
|
|
|
| 8 |
backstory=(
|
| 9 |
"As a Curiosity Catalyst, you know exactly how to pique the user's curiosity "
|
| 10 |
"for reading the articles."
|
|
|
|
| 1 |
from crewai import Agent
|
| 2 |
from llms.gemini import gemini
|
| 3 |
+
from tools.scrape_website import scrape_tool
|
| 4 |
|
| 5 |
curiosity_catalyst = Agent(
|
| 6 |
role="Curiosity Catalyst",
|
| 7 |
goal="To pique the user's curiosity to read the article.",
|
| 8 |
verbose=True,
|
| 9 |
+
tools=[scrape_tool],
|
| 10 |
backstory=(
|
| 11 |
"As a Curiosity Catalyst, you know exactly how to pique the user's curiosity "
|
| 12 |
"for reading the articles."
|
agents/learning_curator.py
CHANGED
|
@@ -5,7 +5,7 @@ from llms.gemini import gemini
|
|
| 5 |
|
| 6 |
learning_curator = Agent(
|
| 7 |
role="Personal Learning Curator",
|
| 8 |
-
goal="Make sure you present
|
| 9 |
"the article should provide the user with an incremental learning.",
|
| 10 |
verbose=True,
|
| 11 |
backstory=(
|
|
|
|
| 5 |
|
| 6 |
learning_curator = Agent(
|
| 7 |
role="Personal Learning Curator",
|
| 8 |
+
goal="Make sure you present 5 articles on the topics that the user is interested in, "
|
| 9 |
"the article should provide the user with an incremental learning.",
|
| 10 |
verbose=True,
|
| 11 |
backstory=(
|
agents/learning_profiler.py
CHANGED
|
@@ -4,7 +4,7 @@ from llms.gemini import gemini
|
|
| 4 |
|
| 5 |
learning_profiler = Agent(
|
| 6 |
role="Personal Learning Profiler",
|
| 7 |
-
goal="Make sure to create an excellent learning profile of the user.",
|
| 8 |
verbose=True,
|
| 9 |
tools=[scrape_tool],
|
| 10 |
backstory=(
|
|
|
|
| 4 |
|
| 5 |
learning_profiler = Agent(
|
| 6 |
role="Personal Learning Profiler",
|
| 7 |
+
goal="Make sure to create an excellent learning profile of the user based on his interests and previous reading history.",
|
| 8 |
verbose=True,
|
| 9 |
tools=[scrape_tool],
|
| 10 |
backstory=(
|
app.py
CHANGED
|
@@ -5,11 +5,18 @@ from crew.article_suggestion import article_recommendation_crew
|
|
| 5 |
|
| 6 |
result = article_recommendation_crew.kickoff(inputs={
|
| 7 |
"interests": "GenAI, Architecture, Agentic Programming",
|
| 8 |
-
"previous_article_insights":
|
|
|
|
| 9 |
"Reflection: The LLM examines its own work to come up with ways to improve it. "
|
| 10 |
"Tool Use: The LLM is given tools such as web search, code execution, or any other function to help it gather information, take action, or process data. "
|
| 11 |
"Planning: The LLM comes up with, and executes, a multistep plan to achieve a goal "
|
| 12 |
-
"Multi-agent collaboration: More than one AI agent work together, splitting up tasks and discussing and debating ideas, to come up with better solutions than a single agent would."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
})
|
| 14 |
|
| 15 |
print(result)
|
|
|
|
| 5 |
|
| 6 |
result = article_recommendation_crew.kickoff(inputs={
|
| 7 |
"interests": "GenAI, Architecture, Agentic Programming",
|
| 8 |
+
"previous_article_insights":
|
| 9 |
+
"Agentic Design Patterns (https://www.deeplearning.ai/the-batch/how-agents-can-improve-llm-performance/)\n"
|
| 10 |
"Reflection: The LLM examines its own work to come up with ways to improve it. "
|
| 11 |
"Tool Use: The LLM is given tools such as web search, code execution, or any other function to help it gather information, take action, or process data. "
|
| 12 |
"Planning: The LLM comes up with, and executes, a multistep plan to achieve a goal "
|
| 13 |
+
"Multi-agent collaboration: More than one AI agent work together, splitting up tasks and discussing and debating ideas, to come up with better solutions than a single agent would.\n\n"
|
| 14 |
+
"GenAI Multi-Agent Systems (https://thenewstack.io/genai-multi-agent-systems-a-secret-weapon-for-tech-teams/)\n"
|
| 15 |
+
"Multi-agent systems go beyond the task-oriented roles to truly super-charge development and strategy teams. "
|
| 16 |
+
"Successful multi-agent systems act as a “digital twin” for your development team. "
|
| 17 |
+
"Different Approaches: 1. Centralized, with one agent in the center that collects and assimilates all the other outputs. "
|
| 18 |
+
"2. Distributed, where there is no central controller and the agents coordinate directly with one another in an “agent swarm. "
|
| 19 |
+
"3. Hierarchical, where agents are organized in teams or hierarchical layers.\n"
|
| 20 |
})
|
| 21 |
|
| 22 |
print(result)
|
crew/article_suggestion.py
CHANGED
|
@@ -2,14 +2,17 @@ from crewai import Crew
|
|
| 2 |
from agents.learning_profiler import learning_profiler
|
| 3 |
from agents.learning_curator import learning_curator
|
| 4 |
from agents.article_evaluator import article_evaluator
|
|
|
|
| 5 |
from tasks.create_learning_profile import learning_profile_task
|
| 6 |
from tasks.new_article_suggestion import article_suggestion_task
|
| 7 |
from tasks.evaluate_articles import evaluation_task
|
|
|
|
| 8 |
from llms.gemini import gemini
|
| 9 |
|
| 10 |
article_recommendation_crew = Crew(
|
| 11 |
-
agents=[learning_profiler, learning_curator, article_evaluator],
|
| 12 |
-
tasks=[learning_profile_task, article_suggestion_task, evaluation_task],
|
| 13 |
verbose=True,
|
|
|
|
| 14 |
# manager_llm=gemini
|
| 15 |
)
|
|
|
|
| 2 |
from agents.learning_profiler import learning_profiler
|
| 3 |
from agents.learning_curator import learning_curator
|
| 4 |
from agents.article_evaluator import article_evaluator
|
| 5 |
+
from agents.curiosity_catalyst import curiosity_catalyst
|
| 6 |
from tasks.create_learning_profile import learning_profile_task
|
| 7 |
from tasks.new_article_suggestion import article_suggestion_task
|
| 8 |
from tasks.evaluate_articles import evaluation_task
|
| 9 |
+
from tasks.create_article_pitch import article_pitch_task
|
| 10 |
from llms.gemini import gemini
|
| 11 |
|
| 12 |
article_recommendation_crew = Crew(
|
| 13 |
+
agents=[learning_profiler, learning_curator, article_evaluator, curiosity_catalyst],
|
| 14 |
+
tasks=[learning_profile_task, article_suggestion_task, evaluation_task, article_pitch_task],
|
| 15 |
verbose=True,
|
| 16 |
+
memory=True,
|
| 17 |
# manager_llm=gemini
|
| 18 |
)
|
tasks/create_article_pitch.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from crewai import Task
|
| 2 |
+
from agents.curiosity_catalyst import curiosity_catalyst
|
| 3 |
+
from tools.scrape_website import scrape_tool
|
| 4 |
+
from utils.recommended_article import RecommendedArticle
|
| 5 |
+
|
| 6 |
+
article_pitch_task = Task(
|
| 7 |
+
description=(
|
| 8 |
+
"Create a pitch for each of the articles that have passed evaluation. "
|
| 9 |
+
"Craft the pitch so to that it teases the article's most intriguing aspects, "
|
| 10 |
+
"by posing questions that the article might answer or "
|
| 11 |
+
"highlighting surprising facts to pique the user's curiosity "
|
| 12 |
+
" to read the article for incremental learning."
|
| 13 |
+
),
|
| 14 |
+
expected_output=(
|
| 15 |
+
"Json array of all the artilces that have passed evaluation phase. Each article should have the following keys title, article_url, pitch and reason behind the recommedation"
|
| 16 |
+
),
|
| 17 |
+
# output_json=RecommendedArticle,
|
| 18 |
+
tools=[scrape_tool],
|
| 19 |
+
agent=curiosity_catalyst
|
| 20 |
+
)
|
tasks/new_article_suggestion.py
CHANGED
|
@@ -3,7 +3,7 @@ from agents.learning_curator import learning_curator
|
|
| 3 |
|
| 4 |
article_suggestion_task = Task(
|
| 5 |
description=(
|
| 6 |
-
"Suggest
|
| 7 |
"The articles should provide incremental learning to the user."
|
| 8 |
),
|
| 9 |
expected_output=(
|
|
|
|
| 3 |
|
| 4 |
article_suggestion_task = Task(
|
| 5 |
description=(
|
| 6 |
+
"Suggest 5 recent articles (i.e published in last 10 days ) to the user based on his learning profile. "
|
| 7 |
"The articles should provide incremental learning to the user."
|
| 8 |
),
|
| 9 |
expected_output=(
|
utils/recommended_article.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseModel
|
| 2 |
+
|
| 3 |
+
class RecommendedArticle(BaseModel):
|
| 4 |
+
title: str
|
| 5 |
+
url: str
|
| 6 |
+
pitch: str
|
| 7 |
+
reason_for_recommendation: str
|