2020from scrapybara .tools import BashTool , ComputerTool , EditTool
2121
2222
23- class YCStats (BaseModel ):
24- number_of_startups : int
25- combined_valuation : int
23+ class ExampleSite (BaseModel ):
24+ title : str
25+ has_links : bool
2626
2727
2828def _check_api_key () -> None :
@@ -47,19 +47,19 @@ def test_ubuntu() -> None:
4747 response = client .act (
4848 model = Anthropic (),
4949 system = UBUNTU_SYSTEM_PROMPT_ANTHROPIC ,
50- prompt = "Go to the YC website and get the number of funded startups and combined valuation " ,
50+ prompt = "Go to example.com and get the page title and whether it has any links " ,
5151 tools = [
5252 ComputerTool (ubuntu_instance ),
5353 BashTool (ubuntu_instance ),
5454 EditTool (ubuntu_instance ),
5555 ],
56- schema = YCStats ,
56+ schema = ExampleSite ,
5757 on_step = lambda step : print (step .text , step .tool_calls ),
5858 )
5959 print (response .output )
6060 assert response .output is not None
61- assert response .output .number_of_startups is not None
62- assert response .output .combined_valuation is not None
61+ assert response .output .title is not None
62+ assert isinstance ( response .output .has_links , bool )
6363 ubuntu_instance .browser .stop ()
6464 ubuntu_instance .stop ()
6565
@@ -81,19 +81,19 @@ def test_ubuntu_openai() -> None:
8181 response = client .act (
8282 model = OpenAI (),
8383 system = UBUNTU_SYSTEM_PROMPT_OPENAI ,
84- prompt = "Go to the YC website and get the number of funded startups and combined valuation " ,
84+ prompt = "Go to example.com and get the page title and whether it has any links " ,
8585 tools = [
8686 ComputerTool (ubuntu_instance ),
8787 BashTool (ubuntu_instance ),
8888 EditTool (ubuntu_instance ),
8989 ],
90- schema = YCStats ,
90+ schema = ExampleSite ,
9191 on_step = lambda step : print (step .text , step .tool_calls ),
9292 )
9393 print (response .output )
9494 assert response .output is not None
95- assert response .output .number_of_startups is not None
96- assert response .output .combined_valuation is not None
95+ assert response .output .title is not None
96+ assert isinstance ( response .output .has_links , bool )
9797 ubuntu_instance .browser .stop ()
9898 ubuntu_instance .stop ()
9999
@@ -112,17 +112,17 @@ def test_browser() -> None:
112112 response = client .act (
113113 model = Anthropic (),
114114 system = BROWSER_SYSTEM_PROMPT_ANTHROPIC ,
115- prompt = "Go to the YC website and get the number of funded startups and combined valuation " ,
115+ prompt = "Go to example.com and get the page title and whether it has any links " ,
116116 tools = [
117117 ComputerTool (browser_instance ),
118118 ],
119- schema = YCStats ,
119+ schema = ExampleSite ,
120120 on_step = lambda step : print (step .text , step .tool_calls ),
121121 )
122122 print (response .output )
123123 assert response .output is not None
124- assert response .output .number_of_startups is not None
125- assert response .output .combined_valuation is not None
124+ assert response .output .title is not None
125+ assert isinstance ( response .output .has_links , bool )
126126 browser_instance .stop ()
127127
128128@pytest .mark .skip ()
@@ -140,17 +140,17 @@ def test_browser_openai() -> None:
140140 response = client .act (
141141 model = OpenAI (),
142142 system = BROWSER_SYSTEM_PROMPT_OPENAI ,
143- prompt = "Go to the YC website and get the number of funded startups and combined valuation " ,
143+ prompt = "Go to example.com and get the page title and whether it has any links " ,
144144 tools = [
145145 ComputerTool (browser_instance ),
146146 ],
147- schema = YCStats ,
147+ schema = ExampleSite ,
148148 on_step = lambda step : print (step .text , step .tool_calls ),
149149 )
150150 print (response .output )
151151 assert response .output is not None
152- assert response .output .number_of_startups is not None
153- assert response .output .combined_valuation is not None
152+ assert response .output .title is not None
153+ assert isinstance ( response .output .has_links , bool )
154154 browser_instance .stop ()
155155
156156
@@ -167,17 +167,17 @@ def test_windows() -> None:
167167 response = client .act (
168168 model = Anthropic (),
169169 system = WINDOWS_SYSTEM_PROMPT_ANTHROPIC ,
170- prompt = "Go to the YC website and get the number of funded startups and combined valuation " ,
170+ prompt = "Go to example.com and get the page title and whether it has any links " ,
171171 tools = [
172172 ComputerTool (windows_instance ),
173173 ],
174- schema = YCStats ,
174+ schema = ExampleSite ,
175175 on_step = lambda step : print (step .text , step .tool_calls ),
176176 )
177177 print (response .output )
178178 assert response .output is not None
179- assert response .output .number_of_startups is not None
180- assert response .output .combined_valuation is not None
179+ assert response .output .title is not None
180+ assert isinstance ( response .output .has_links , bool )
181181 windows_instance .stop ()
182182
183183
@@ -199,19 +199,19 @@ def test_ubuntu_thinking() -> None:
199199 response = client .act (
200200 model = Anthropic (name = "claude-3-7-sonnet-20250219-thinking" ),
201201 system = UBUNTU_SYSTEM_PROMPT_ANTHROPIC ,
202- prompt = "Go to the YC website and get the number of funded startups and combined valuation " ,
202+ prompt = "Go to example.com and get the page title and whether it has any links " ,
203203 tools = [
204204 ComputerTool (ubuntu_instance ),
205205 BashTool (ubuntu_instance ),
206206 EditTool (ubuntu_instance ),
207207 ],
208- schema = YCStats ,
208+ schema = ExampleSite ,
209209 on_step = lambda step : print (step .text , step .tool_calls , step .reasoning_parts ),
210210 )
211211 print (response .output )
212212 assert response .output is not None
213- assert response .output .number_of_startups is not None
214- assert response .output .combined_valuation is not None
213+ assert response .output .title is not None
214+ assert isinstance ( response .output .has_links , bool )
215215 ubuntu_instance .browser .stop ()
216216 ubuntu_instance .stop ()
217217
@@ -231,17 +231,17 @@ def test_browser_thinking() -> None:
231231 response = client .act (
232232 model = Anthropic (name = "claude-3-7-sonnet-20250219-thinking" ),
233233 system = BROWSER_SYSTEM_PROMPT_ANTHROPIC ,
234- prompt = "Go to the YC website and get the number of funded startups and combined valuation " ,
234+ prompt = "Go to example.com and get the page title and whether it has any links " ,
235235 tools = [
236236 ComputerTool (browser_instance ),
237237 ],
238- schema = YCStats ,
238+ schema = ExampleSite ,
239239 on_step = lambda step : print (step .text , step .tool_calls , step .reasoning_parts ),
240240 )
241241 print (response .output )
242242 assert response .output is not None
243- assert response .output .number_of_startups is not None
244- assert response .output .combined_valuation is not None
243+ assert response .output .title is not None
244+ assert isinstance ( response .output .has_links , bool )
245245 browser_instance .stop ()
246246
247247
0 commit comments