bstraehle commited on
Commit
9303a35
·
verified ·
1 Parent(s): 002b66a

Update tools/ai_tools.py

Browse files
Files changed (1) hide show
  1. tools/ai_tools.py +5 -3
tools/ai_tools.py CHANGED
@@ -4,6 +4,7 @@ from crewai.tools import tool
4
  from crewai_tools import StagehandTool
5
  from google import genai
6
  from google.genai import types
 
7
  from utils import (
8
  read_file_json,
9
  read_docx_text,
@@ -50,12 +51,13 @@ class AITools():
50
  raise RuntimeError(f"Processing failed: {str(e)}")
51
 
52
  @tool("Web Browser Tool")
53
- def web_browser_tool(question: str, url: str) -> str:
54
- """Given a question and URL, load the URL and act, extract, navigate, and observe to answer the question.
55
 
56
  Args:
57
  question (str): Question about a URL
58
  url (str): The URL
 
59
 
60
  Returns:
61
  str: Answer to the question
@@ -73,7 +75,7 @@ class AITools():
73
  return stagehand_tool.run(
74
  instruction=question,
75
  url=url,
76
- command_type="act"
77
  )
78
  except Exception as e:
79
  raise RuntimeError(f"Processing failed: {str(e)}")
 
4
  from crewai_tools import StagehandTool
5
  from google import genai
6
  from google.genai import types
7
+ from stagehand.schemas import AvailableModel
8
  from utils import (
9
  read_file_json,
10
  read_docx_text,
 
51
  raise RuntimeError(f"Processing failed: {str(e)}")
52
 
53
  @tool("Web Browser Tool")
54
+ def web_browser_tool(question: str, url: str, action: str) -> str:
55
+ """Given a question, URL, and action, load the URL and act, extract, or observe to answer the question.
56
 
57
  Args:
58
  question (str): Question about a URL
59
  url (str): The URL
60
+ action (str): Act, extract, or observe
61
 
62
  Returns:
63
  str: Answer to the question
 
75
  return stagehand_tool.run(
76
  instruction=question,
77
  url=url,
78
+ command_type=action
79
  )
80
  except Exception as e:
81
  raise RuntimeError(f"Processing failed: {str(e)}")