Update crew.py
Browse files
crew.py
CHANGED
|
@@ -27,10 +27,14 @@ tracer_provider = register(
|
|
| 27 |
CrewAIInstrumentor().instrument(tracer_provider=tracer_provider)
|
| 28 |
|
| 29 |
def run_crew(question):
|
|
|
|
|
|
|
| 30 |
code_interpreter_tool = CodeInterpreterTool()
|
| 31 |
web_search_tool = SerperDevTool()
|
| 32 |
web_rag_tool = WebsiteSearchTool()
|
| 33 |
youtube_search_tool = YoutubeVideoSearchTool()
|
|
|
|
|
|
|
| 34 |
|
| 35 |
web_search_agent = Agent(
|
| 36 |
role="Web Search Agent",
|
|
@@ -51,6 +55,18 @@ def run_crew(question):
|
|
| 51 |
tools=[youtube_search_tool],
|
| 52 |
verbose=True
|
| 53 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
web_search = Task(
|
| 56 |
agent=web_search_agent,
|
|
@@ -63,13 +79,21 @@ def run_crew(question):
|
|
| 63 |
description="Search a YouTube video for question \"{topic}\"",
|
| 64 |
expected_output="Content to help answer the YouTube related question."
|
| 65 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
crew = Crew(
|
| 68 |
-
agents=[web_search_agent, youtube_search_agent],
|
| 69 |
#planning=True,
|
| 70 |
#planning_llm=PLANNING_MODEL,
|
| 71 |
process=Process.sequential,
|
| 72 |
-
tasks=[web_search, youtube_search],
|
| 73 |
verbose=True
|
| 74 |
)
|
| 75 |
|
|
|
|
| 27 |
CrewAIInstrumentor().instrument(tracer_provider=tracer_provider)
|
| 28 |
|
| 29 |
def run_crew(question):
|
| 30 |
+
# Tools
|
| 31 |
+
|
| 32 |
code_interpreter_tool = CodeInterpreterTool()
|
| 33 |
web_search_tool = SerperDevTool()
|
| 34 |
web_rag_tool = WebsiteSearchTool()
|
| 35 |
youtube_search_tool = YoutubeVideoSearchTool()
|
| 36 |
+
|
| 37 |
+
# Agents
|
| 38 |
|
| 39 |
web_search_agent = Agent(
|
| 40 |
role="Web Search Agent",
|
|
|
|
| 55 |
tools=[youtube_search_tool],
|
| 56 |
verbose=True
|
| 57 |
)
|
| 58 |
+
|
| 59 |
+
python_coding_agent = Agent(
|
| 60 |
+
role="Python Coding Agent",
|
| 61 |
+
goal="Write and execute Python code to solve question \"{topic}\".",
|
| 62 |
+
backstory="As an expert Python coding assistant, you write and execute Python for the question.",
|
| 63 |
+
allow_delegation=False,
|
| 64 |
+
max_iter=1,
|
| 65 |
+
tools=[code_interpreter_tool],
|
| 66 |
+
verbose=True,
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
# Tasks
|
| 70 |
|
| 71 |
web_search = Task(
|
| 72 |
agent=web_search_agent,
|
|
|
|
| 79 |
description="Search a YouTube video for question \"{topic}\"",
|
| 80 |
expected_output="Content to help answer the YouTube related question."
|
| 81 |
)
|
| 82 |
+
|
| 83 |
+
coding_task = Task(
|
| 84 |
+
agent=python_coding_agent,
|
| 85 |
+
description="Write and execute Python code to solve question \"{topic}\".",
|
| 86 |
+
expected_output="Content to help answer the Phyton coding related question."
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
# Crew
|
| 90 |
|
| 91 |
crew = Crew(
|
| 92 |
+
agents=[python_coding_agent, web_search_agent, youtube_search_agent],
|
| 93 |
#planning=True,
|
| 94 |
#planning_llm=PLANNING_MODEL,
|
| 95 |
process=Process.sequential,
|
| 96 |
+
tasks=[coding_task, web_search, youtube_search],
|
| 97 |
verbose=True
|
| 98 |
)
|
| 99 |
|