Spaces:
Paused
Paused
Update crew.py
Browse files
crew.py
CHANGED
|
@@ -42,6 +42,10 @@ CrewAIInstrumentor().instrument(tracer_provider=tracer_provider)
|
|
| 42 |
def run_crew(question, file_path):
|
| 43 |
# Tools
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
@tool("Image Analysis Tool")
|
| 46 |
def image_analysis_tool(question: str, file_path: str) -> str:
|
| 47 |
"""Answer a question about an image file.
|
|
@@ -177,10 +181,6 @@ def run_crew(question, file_path):
|
|
| 177 |
except Exception as e:
|
| 178 |
raise RuntimeError(f"Processing failed: {str(e)}")
|
| 179 |
|
| 180 |
-
web_search_tool = SerperDevTool()
|
| 181 |
-
web_rag_tool = WebsiteSearchTool()
|
| 182 |
-
python_coding_tool = CodeInterpreterTool()
|
| 183 |
-
|
| 184 |
# Agents
|
| 185 |
|
| 186 |
web_search_agent = Agent(
|
|
@@ -249,14 +249,14 @@ def run_crew(question, file_path):
|
|
| 249 |
verbose=False
|
| 250 |
)
|
| 251 |
|
| 252 |
-
|
| 253 |
-
role="
|
| 254 |
goal="Write and/or execute Python code to help answer question \"{question}\"",
|
| 255 |
-
backstory="As an expert
|
| 256 |
allow_delegation=False,
|
| 257 |
llm=AGENT_MODEL,
|
| 258 |
-
max_iter=
|
| 259 |
-
tools=[
|
| 260 |
verbose=False
|
| 261 |
)
|
| 262 |
|
|
@@ -268,7 +268,7 @@ def run_crew(question, file_path):
|
|
| 268 |
backstory="As an expert manager assistant, you answer the question.",
|
| 269 |
allow_delegation=True,
|
| 270 |
llm=MANAGER_MODEL,
|
| 271 |
-
max_iter=
|
| 272 |
verbose=True
|
| 273 |
)
|
| 274 |
|
|
@@ -289,7 +289,7 @@ def run_crew(question, file_path):
|
|
| 289 |
video_analysis_agent,
|
| 290 |
youtube_analysis_agent,
|
| 291 |
document_analysis_agent,
|
| 292 |
-
|
| 293 |
manager_agent=manager_agent,
|
| 294 |
tasks=[manager_task],
|
| 295 |
verbose=True
|
|
|
|
| 42 |
def run_crew(question, file_path):
|
| 43 |
# Tools
|
| 44 |
|
| 45 |
+
web_search_tool = SerperDevTool()
|
| 46 |
+
web_rag_tool = WebsiteSearchTool()
|
| 47 |
+
code_execution_tool = CodeInterpreterTool()
|
| 48 |
+
|
| 49 |
@tool("Image Analysis Tool")
|
| 50 |
def image_analysis_tool(question: str, file_path: str) -> str:
|
| 51 |
"""Answer a question about an image file.
|
|
|
|
| 181 |
except Exception as e:
|
| 182 |
raise RuntimeError(f"Processing failed: {str(e)}")
|
| 183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
# Agents
|
| 185 |
|
| 186 |
web_search_agent = Agent(
|
|
|
|
| 249 |
verbose=False
|
| 250 |
)
|
| 251 |
|
| 252 |
+
code_execution_agent = Agent(
|
| 253 |
+
role="Code Execution Agent",
|
| 254 |
goal="Write and/or execute Python code to help answer question \"{question}\"",
|
| 255 |
+
backstory="As an expert code execution assistant, you write and/or execute Python code to help answer the question.",
|
| 256 |
allow_delegation=False,
|
| 257 |
llm=AGENT_MODEL,
|
| 258 |
+
max_iter=3,
|
| 259 |
+
tools=[code_execution_tool],
|
| 260 |
verbose=False
|
| 261 |
)
|
| 262 |
|
|
|
|
| 268 |
backstory="As an expert manager assistant, you answer the question.",
|
| 269 |
allow_delegation=True,
|
| 270 |
llm=MANAGER_MODEL,
|
| 271 |
+
max_iter=5,
|
| 272 |
verbose=True
|
| 273 |
)
|
| 274 |
|
|
|
|
| 289 |
video_analysis_agent,
|
| 290 |
youtube_analysis_agent,
|
| 291 |
document_analysis_agent,
|
| 292 |
+
code_execution_agent],
|
| 293 |
manager_agent=manager_agent,
|
| 294 |
tasks=[manager_task],
|
| 295 |
verbose=True
|