browser-use: Error when using Gemini API.
Hi
Can you try with Gemini API as it looks to be incompatible…
` python demo.py INFO:browser_use.agent.service:
INFO:browser_use.agent.service:🚀 Starting task: Go to bbc.com to get the latest news. INFO:browser_use.agent.service:================================================== INFO:browser_use.agent.service: 📍 Step 1 INFO:WDM:====== WebDriver manager ====== INFO:WDM:Get LATEST chromedriver version for google-chrome INFO:WDM:Get LATEST chromedriver version for google-chrome INFO:WDM:Driver [/Users/test/.wdm/drivers/chromedriver/mac64/130.0.6723.116/chromedriver-mac-x64/chromedriver] found in cache INFO:browser_use.utils:–_process_content Execution time: 0.00 seconds INFO:browser_use.utils:–get_cached_browser_state Execution time: 8.32 seconds INFO:browser_use.agent.service:current tabs: [{‘handle’: ‘424241DC04D905CF8F236652334A9C87’, ‘url’: ‘data:,’, ‘title’: ‘’, ‘is_current’: True}] Traceback (most recent call last): File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/langchain_google_genai/chat_models.py”, line 232, in _achat_with_retry return await generation_method(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/google/ai/generativelanguage_v1beta/services/generative_service/async_client.py”, line 406, in generate_content response = await rpc( ^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/google/api_core/retry/retry_unary_async.py”, line 230, in retry_wrapped_func return await retry_target( ^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/google/api_core/retry/retry_unary_async.py”, line 160, in retry_target _retry_error_helper( File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/google/api_core/retry/retry_base.py”, line 212, in _retry_error_helper raise final_exc from source_exc File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/google/api_core/retry/retry_unary_async.py”, line 155, in retry_target return await target() ^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/google/api_core/grpc_helpers_async.py”, line 88, in await raise exceptions.from_grpc_error(rpc_error) from rpc_error google.api_core.exceptions.InvalidArgument: 400 * GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[input_text].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[ask_human].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[done].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[search_google].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[click_element].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[switch_tab].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[go_to_url].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[open_tab].properties: should be non-empty for OBJECT type
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File “/Users/test/Desktop/PYTHON/browser-use/demo.py”, line 27, in <module> asyncio.run(main()) File “/Users/test/.pyenv/versions/3.11.10/lib/python3.11/asyncio/runners.py”, line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File “/Users/test/.pyenv/versions/3.11.10/lib/python3.11/asyncio/runners.py”, line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/.pyenv/versions/3.11.10/lib/python3.11/asyncio/base_events.py”, line 654, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/demo.py”, line 24, in main await agent.run() File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/browser_use/agent/service.py”, line 82, in run action, result = await self.step() ^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/browser_use/utils.py”, line 36, in wrapper result = await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/browser_use/agent/service.py”, line 100, in step action = await self.get_next_action(state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/browser_use/utils.py”, line 36, in wrapper result = await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/browser_use/agent/service.py”, line 172, in get_next_action response: Output = await structured_llm.ainvoke(input_messages) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/langchain_core/runnables/base.py”, line 3066, in ainvoke input = await asyncio.create_task(part(), context=context) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/langchain_core/runnables/base.py”, line 5366, in ainvoke return await self.bound.ainvoke( ^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py”, line 307, in ainvoke llm_result = await self.agenerate_prompt( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py”, line 796, in agenerate_prompt return await self.agenerate( ^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py”, line 756, in agenerate raise exceptions[0] File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py”, line 924, in _agenerate_with_cache result = await self._agenerate( ^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/langchain_google_genai/chat_models.py”, line 1038, in _agenerate response: GenerateContentResponse = await _achat_with_retry( ^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/langchain_google_genai/chat_models.py”, line 241, in _achat_with_retry return await _achat_with_retry(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/tenacity/asyncio/init.py”, line 189, in async_wrapped return await copy(fn, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/tenacity/asyncio/init.py”, line 111, in call do = await self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/tenacity/asyncio/init.py”, line 153, in iter result = await action(retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/tenacity/_utils.py”, line 99, in inner return call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/tenacity/init.py”, line 398, in <lambda> self._add_action_func(lambda rs: rs.outcome.result()) ^^^^^^^^^^^^^^^^^^^ File “/Users/test/.pyenv/versions/3.11.10/lib/python3.11/concurrent/futures/_base.py”, line 449, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File “/Users/test/.pyenv/versions/3.11.10/lib/python3.11/concurrent/futures/_base.py”, line 401, in __get_result raise self._exception File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/tenacity/asyncio/init.py”, line 114, in call result = await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/test/Desktop/PYTHON/browser-use/venv/lib/python3.11/site-packages/langchain_google_genai/chat_models.py”, line 235, in _achat_with_retry raise ChatGoogleGenerativeAIError( langchain_google_genai.chat_models.ChatGoogleGenerativeAIError: Invalid argument provided to Gemini: 400 * GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[input_text].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[ask_human].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[done].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[search_google].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[click_element].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[switch_tab].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[go_to_url].properties: should be non-empty for OBJECT type
- GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[action].properties[open_tab].properties: should be non-empty for OBJECT type`
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15
FYI I fixed this issue by downgrading
langchain-google-genaidown to 2.0.8. I had 2.0.9 installed which seems to not work.Getting same issue, keeping thread alive
I am having the same issue here. I tried with flash and pro versions and got the output mentioned above