bstraehle commited on
Commit
4853bc7
·
verified ·
1 Parent(s): 5d1b2ab

Update crew.py

Browse files
Files changed (1) hide show
  1. crew.py +23 -5
crew.py CHANGED
@@ -49,8 +49,6 @@ tracer_provider = register(
49
  def run_crew(question, file_path):
50
  # Tools
51
 
52
- web_browser_tool = BrowserbaseLoadTool()
53
-
54
  @tool("Web Search Tool")
55
  def web_search_tool(question: str) -> str:
56
  """Given a question only, search the web to answer the question.
@@ -77,6 +75,26 @@ def run_crew(question, file_path):
77
  return response.text
78
  except Exception as e:
79
  raise RuntimeError(f"Processing failed: {str(e)}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
  @tool("Image Analysis Tool")
82
  def image_analysis_tool(question: str, file_path: str) -> str:
@@ -330,8 +348,8 @@ def run_crew(question, file_path):
330
 
331
  web_browser_agent = Agent(
332
  role="Web Browser Agent",
333
- goal="Given a question, go to the URL and act, extract, navigate, observe, and answer the question: {question}",
334
- backstory="As an expert browser assistant, you go to the URL and act, extract, navigate, observe to answer the question.",
335
  allow_delegation=False,
336
  llm=AGENT_MODEL,
337
  max_iter=2,
@@ -443,7 +461,7 @@ def run_crew(question, file_path):
443
  agent=manager_agent,
444
  description="Answer the following question. If needed, delegate to one of your coworkers:\n"
445
  "- Web Search Agent requires a question only.\n"
446
- "- Web Browser Agent requires a question only.\n"
447
  "- Image Analysis Agent requires a question and **.png, .jpeg, .webp, .heic, or .heif image file**.\n"
448
  "- Audio Analysis Agent requires a question and **.wav, .mp3, .aiff, .aac, .ogg, or .flac audio file**.\n"
449
  "- Video Analysis Agent requires a question and **.mp4, .mpeg, .mov, .avi, .x-flv, .mpg, .webm, .wmv, or .3gpp video file**.\n"
 
49
  def run_crew(question, file_path):
50
  # Tools
51
 
 
 
52
  @tool("Web Search Tool")
53
  def web_search_tool(question: str) -> str:
54
  """Given a question only, search the web to answer the question.
 
75
  return response.text
76
  except Exception as e:
77
  raise RuntimeError(f"Processing failed: {str(e)}")
78
+
79
+ @tool("Web Browser Tool")
80
+ def web_browser_tool(question: str, url: str) -> str:
81
+ """Given a question and URL, load the URL and act, extract, navigate, observe, to answer the question.
82
+
83
+ Args:
84
+ question (str): Question to answer
85
+ url (str): The URL
86
+
87
+ Returns:
88
+ str: Answer to the question
89
+
90
+ Raises:
91
+ RuntimeError: If processing fails"""
92
+ try:
93
+ web_browser_tool = BrowserbaseLoadTool()
94
+
95
+ return web_browser_tool.run(url)
96
+ except Exception as e:
97
+ raise RuntimeError(f"Processing failed: {str(e)}")
98
 
99
  @tool("Image Analysis Tool")
100
  def image_analysis_tool(question: str, file_path: str) -> str:
 
348
 
349
  web_browser_agent = Agent(
350
  role="Web Browser Agent",
351
+ goal="Given a question and URL, load the URL and act, extract, navigate, observe, and answer the question: {question}",
352
+ backstory="As an expert browser assistant, you load the URL and act, extract, navigate, observe to answer the question.",
353
  allow_delegation=False,
354
  llm=AGENT_MODEL,
355
  max_iter=2,
 
461
  agent=manager_agent,
462
  description="Answer the following question. If needed, delegate to one of your coworkers:\n"
463
  "- Web Search Agent requires a question only.\n"
464
+ "- Web Browser Agent requires a question and **URL**.\n"
465
  "- Image Analysis Agent requires a question and **.png, .jpeg, .webp, .heic, or .heif image file**.\n"
466
  "- Audio Analysis Agent requires a question and **.wav, .mp3, .aiff, .aac, .ogg, or .flac audio file**.\n"
467
  "- Video Analysis Agent requires a question and **.mp4, .mpeg, .mov, .avi, .x-flv, .mpg, .webm, .wmv, or .3gpp video file**.\n"