You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to have an example of how to integrate this with llama. Its mentioned in the docs but there is no example on how to use it with llama (or ollama)
Reacted by Marcelo Cardoso, Luigi Maselli and bnainar
does that example work for you? Would you mind sharing your python and langchain-core version?
My local ollama server returns the following json, which seems ok {'args': {'action': {'search_google': {'query': 'Albert Einstein'}}, 'current_state': {}}, 'type': 'Output'}
However, the script fails with the following stacktrace
INFO:browser_use.agent.service:
📍 Step 1
INFO:browser_use.utils:--_process_content Execution time: 0.00 seconds
INFO:browser_use.utils:--get_cached_browser_state Execution time: 0.52 seconds
INFO:browser_use.agent.service:current tabs: [{'handle': '401296479A56DA7F0848BEA9AC1BD962', 'url': 'data:,', 'title': '', 'is_current': True}]
INFO:httpx:HTTP Request: POST http://localhost:11434/api/chat "HTTP/1.1 200 OK"
{'args': {'action': {'search_google': {'query': 'Albert Einstein'}}, 'current_state': {}}, 'type': 'Output'}
Traceback (most recent call last):
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/test.py", line 18, in <module>
run(agent.run())
File "/home/manuel/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/home/manuel/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/manuel/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/browser_use/agent/service.py", line 82, in run
action, result = await self.step()
^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/browser_use/utils.py", line 36, in wrapper
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/browser_use/agent/service.py", line 100, in step
action = await self.get_next_action(state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/browser_use/utils.py", line 36, in wrapper
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/browser_use/agent/service.py", line 172, in get_next_action
response: Output = await structured_llm.ainvoke(input_messages) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/runnables/base.py", line 3066, in ainvoke
input = await asyncio.create_task(part(), context=context) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/output_parsers/base.py", line 216, in ainvoke
return await self._acall_with_config(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/runnables/base.py", line 1978, in _acall_with_config
output: Output = await asyncio.create_task(coro, context=context) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/output_parsers/base.py", line 277, in aparse_result
return await run_in_executor(None, self.parse_result, result, partial=partial)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/runnables/config.py", line 588, in run_in_executor
return await asyncio.get_running_loop().run_in_executor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/manuel/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/runnables/config.py", line 579, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/output_parsers/openai_tools.py", line 300, in parse_result
raise e
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/output_parsers/openai_tools.py", line 295, in parse_result
pydantic_objects.append(name_dict[res["type"]](**res["args"]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/pydantic/main.py", line 212, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 3 validation errors for Output
current_state.valuation_previous_goal
Field required [type=missing, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.9/v/missing
current_state.memory
Field required [type=missing, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.9/v/missing
current_state.next_goal
Field required [type=missing, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.9/v/missing
Hey, I think Llama 8B might be too small for this to really work properly - big models like Claude 3.5 sonnet are also sometimes barely smart enough.
I have tested browser use with Llama 405B on Fireworks and that works quite well, it's just a bit slower usually than gpt4o or Claude. I think 70B should also work just fine.
Which provider do you plan on using? Tell me and I can help you more!
Thanks for the answer, I dont think the error im experiencing is due to the model size, isnt it? I wasnt planning on using a remote model yet, I would like to do the development locally to avoid costs.
I tried ChatOllama with qwen2.5:32b-instructand couple of llama models.
The main problem is that pydantic with structured output needs to be fixed by ChatOllama see this issue.
JSON output works - but is not robust.
@gregpr07 I tried running with llama3-groq-tool-use:8b and using json mode. for the following snippet
from asyncio import run
from browser_use import Agent
from langchain_ollama import ChatOllama
llm = ChatOllama(
model="llama3-groq-tool-use:70b",
base_url="http://localhost:11434",
format='json',
)
agent = Agent(
task="Go to google.com and search for 'Albert Einstein'.",
llm=llm,
)
run(agent.run())
It fails with the error:
Traceback (most recent call last):
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/test.py", line 19, in <module>
run(agent.run())
File "/home/manuel/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/home/manuel/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/manuel/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/browser_use/agent/service.py", line 82, in run
action, result = await self.step()
^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/browser_use/utils.py", line 36, in wrapper
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/browser_use/agent/service.py", line 100, in step
action = await self.get_next_action(state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/browser_use/utils.py", line 36, in wrapper
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/browser_use/agent/service.py", line 172, in get_next_action
response: Output = await structured_llm.ainvoke(input_messages) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/runnables/base.py", line 3066, in ainvoke
input = await asyncio.create_task(part(), context=context) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/output_parsers/base.py", line 216, in ainvoke
return await self._acall_with_config(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/runnables/base.py", line 1978, in _acall_with_config
output: Output = await asyncio.create_task(coro, context=context) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/output_parsers/base.py", line 277, in aparse_result
return await run_in_executor(None, self.parse_result, result, partial=partial)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/runnables/config.py", line 588, in run_in_executor
return await asyncio.get_running_loop().run_in_executor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/manuel/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/runnables/config.py", line 579, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/Backup/Proyectos/llm_projects/browser_use/.venv/lib/python3.12/site-packages/langchain_core/output_parsers/openai_tools.py", line 295, in parse_result
pydantic_objects.append(name_dict[res["type"]](**res["args"]))
~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'search Google'
You mention on the Project Readme that it works with llama. Have you tested it successfully with llama? Could you maybe share a example that actually works?
agent = Agent(
task="Go to google.com and search for 'piso en venta en aviles'.",
llm=llm,
)
Función para ejecutar el agente paso a paso
async def run_agent():
max_steps = 50 # Limitar el número de pasos
for step in range(max_steps):
print(f"\n📍 Step {step+1}")
try:
# Ejecutar un paso del agente
action, result = await agent.step()
# Asegurarse de que la memoria sea una cadena antes de continuar
if hasattr(result, "current_state") and hasattr(result.current_state, "memory"):
if isinstance(result.current_state.memory, dict):
# Convertir a cadena si memory es un diccionario
result.current_state.memory = str(result.current_state.memory)
elif result.current_state.memory is None:
# Manejar el caso donde memory es None
result.current_state.memory = ""
print("Action:", action)
print("Result:", result)
# Verificar si la tarea está completada
if result.done:
print("\n✅ Task completed successfully!")
print("Extracted content:", result.extracted_content)
break
except AttributeError as e:
print("Error:", e)
print("The model did not return a valid response.")
break
except Exception as e:
# Cualquier otro error
print("Unexpected error:", e)
break
from asyncio import run
from browser_use import Agent
from langchain_ollama import ChatOllama
#from dotenv import load_dotenv
#load_dotenv()
llm = ChatOllama(
model="llama3-groq-tool-use:70b-q2_K",
base_url="http://localhost:11434",
format='json',
)
agent = Agent(
task="Go to google.com and search for 'piso en venta en aviles'.",
llm=llm,
)
async def run_agent():
max_steps = 50 # Limitar el número de pasos
for step in range(max_steps):
print(f"\n📍 Step {step+1}")
try:
# Ejecutar un paso del agente
action, result = await agent.step()
# Asegurarse de que la memoria sea una cadena antes de continuar
if hasattr(result, "current_state") and hasattr(result.current_state, "memory"):
if isinstance(result.current_state.memory, dict):
# Convertir a cadena si memory es un diccionario
result.current_state.memory = str(result.current_state.memory)
elif result.current_state.memory is None:
# Manejar el caso donde memory es None
result.current_state.memory = ""
print("Action:", action)
print("Result:", result)
# Verificar si la tarea está completada
if result.done:
print("\n✅ Task completed successfully!")
print("Extracted content:", result.extracted_content)
break
except AttributeError as e:
print("Error:", e)
print("The model did not return a valid response.")
raise e
except Exception as e:
# Cualquier otro error
print("Unexpected error:", e)
break
run(run_agent())
from browser_use import Agent
from langchain_ollama import ChatOllama
llm = ChatOllama(
model="llama3-groq-tool-use:70b",
base_url="http://localhost:11434",
format='json',
)
agent = Agent(
task="Go to google.com and search for 'Albert Einstein'.",
llm=llm,
)
run(agent.run())
My error
📍 Step 1
ERROR [agent] ❌ Result failed 1/5 times:
'NoneType' object has no attribute 'action'
INFO [agent]
📍 Step 1
ERROR [agent] ❌ Result failed 2/5 times:
'NoneType' object has no attribute 'action'
INFO [agent]
📍 Step 1
ERROR [agent] ❌ Result failed 3/5 times:
'NoneType' object has no attribute 'action'
INFO [agent]
📍 Step 1
ERROR [agent] ❌ Result failed 4/5 times:
'NoneType' object has no attribute 'action'
INFO [agent]
📍 Step 1
ERROR [agent] ❌ Result failed 5/5 times:
'NoneType' object has no attribute 'action'
ERROR [agent] ❌ Stopping due to 5 consecutive failures```
I think you should use a multi-modal model for it since when we initiate a task with browser use, it labels each element from the current webpage which the Model Takes as input and perform necessary action. Tried other text models but I got that same error, but when I tried vision models like the Pixtral, and deepseek, it works just fine.
I never tried setting up an Ollama server before. But try this:
Create an Account from Mistral AI Le Plateforme
Obtain an API KEY
Use the OpenAI compatible api from the API Tab
Instead of using ChatMistralAI or ChatOllama from langchain chat models (since multi modal inputs are not supported in these chat models) use ChatOpenAI
Then use the API KEY, model name, and base_url, llm = ChatOpenAI( model=model_name, api_key=os.getenv(‘MISTRAL_API_KEY’), base_url=url )
I notice you’re using ChatOllama which doesn’t support multi-modal inputs where ai think browser-use requires a multi-modal model for it to properly work.
I notice you’re using ChatOllama which doesn’t support multi-modal inputs where ai think browser-use requires a multi-modal model for it to properly work.
Activity
MagMueller commentedon Nov 6, 2024
Here's a complete example of how to use browser-use with Llama via Ollama:
Setup
Example:
Note: This model currently struggles with JSON output formatting, which can cause the agent to break.
We need to develop a robuster system for this.
manugarri commentedon Nov 6, 2024
does that example work for you? Would you mind sharing your python and langchain-core version?
My local ollama server returns the following json, which seems ok
{'args': {'action': {'search_google': {'query': 'Albert Einstein'}}, 'current_state': {}}, 'type': 'Output'}However, the script fails with the following stacktrace
gregpr07 commentedon Nov 7, 2024
Hey, I think Llama 8B might be too small for this to really work properly - big models like Claude 3.5 sonnet are also sometimes barely smart enough.
I have tested browser use with Llama 405B on Fireworks and that works quite well, it's just a bit slower usually than gpt4o or Claude. I think 70B should also work just fine.
Which provider do you plan on using? Tell me and I can help you more!
manugarri commentedon Nov 7, 2024
Thanks for the answer, I dont think the error im experiencing is due to the model size, isnt it? I wasnt planning on using a remote model yet, I would like to do the development locally to avoid costs.
gregpr07 commentedon Nov 7, 2024
Do you have the compute to try larger model? Maybe
llama3-groq-tool-use:70b?MagMueller commentedon Nov 8, 2024
I tried ChatOllama with
qwen2.5:32b-instructand couple of llama models.The main problem is that pydantic with structured output needs to be fixed by ChatOllama see this issue.
JSON output works - but is not robust.
As soon as it works, I will include examples.
MagMueller commentedon Nov 10, 2024
I tried it now also with json mode - this works for the first action step; but with multiple steps it forgets the instructions
manugarri commentedon Nov 13, 2024
@gregpr07 I tried running with
llama3-groq-tool-use:8band using json mode. for the following snippetIt fails with the error:
You mention on the Project Readme that it works with llama. Have you tested it successfully with llama? Could you maybe share a example that actually works?
oberfx commentedon Nov 13, 2024
from asyncio import run
from browser_use import Agent
from langchain_ollama import ChatOllama
from dotenv import load_dotenv
Cargar variables de entorno
load_dotenv()
Configurar el modelo ChatOllama
llm = ChatOllama(
model="llama3-groq-tool-use:8b-q2_K",
base_url="http://localhost:11434",
)
Configurar el agente con la tarea deseada
agent = Agent(
task="Go to google.com and search for 'piso en venta en aviles'.",
llm=llm,
)
Función para ejecutar el agente paso a paso
async def run_agent():
max_steps = 50 # Limitar el número de pasos
for step in range(max_steps):
print(f"\n📍 Step {step+1}")
try:
# Ejecutar un paso del agente
action, result = await agent.step()
Ejecutar el agente
run(run_agent())
manugarri commentedon Nov 13, 2024
@oberfx your markdown is all wonky :D I think i managed to copy it correctly, and still fails with the error
oberfx commentedon Nov 13, 2024
Cambia el modelo a 70B
manugarri commentedon Nov 13, 2024
@oberfx sigue dando fallos asi
A ti te ha funcionado?
Rakesh-gene commentedon Nov 22, 2024
This solution also did not work.
await agent.step()return type isNone.brutuscat commentedon Nov 25, 2024
pydantic_core._pydantic_core.PydanticSerializationError: Error calling function
serialize_model: OSError: [Errno 63] File name too long:Trying this with 70b model, geeting weird MacOS error:
Stacktrace:
Traceback (most recent call last):
File "/Users/path/ai-browser/lib/python3.13/site-packages/browser_use/agent/service.py", line 123, in step
model_output = await self.get_next_action(state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/path/ai-browser/lib/python3.13/site-packages/browser_use/utils.py", line 36, in wrapper
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/path/ai-browser/lib/python3.13/site-packages/browser_use/agent/service.py", line 188, in get_next_action
response: dict[str, Any] = await structured_llm.ainvoke(input_messages) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/path/ai-browser/lib/python3.13/site-packages/langchain_core/runnables/base.py", line 3066, in ainvoke
input = await asyncio.create_task(part(), context=context) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/path/ai-browser/lib/python3.13/site-packages/langchain_core/runnables/base.py", line 3773, in ainvoke
results = await asyncio.gather(
^^^^^^^^^^^^^^^^^^^^^
...<10 lines>...
)
^
File "/Users/path/ai-browser/lib/python3.13/site-packages/langchain_core/runnables/base.py", line 3763, in _ainvoke_step
return await asyncio.create_task( # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
step.ainvoke(input, child_config), context=context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/path/ai-browser/lib/python3.13/site-packages/langchain_core/runnables/base.py", line 5366, in ainvoke
return await self.bound.ainvoke(
^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
)
^
File "/Users/path/ai-browser/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 307, in ainvoke
llm_result = await self.agenerate_prompt(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<8 lines>...
)
^
File "/Users/path/ai-browser/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 796, in agenerate_prompt
return await self.agenerate(
^^^^^^^^^^^^^^^^^^^^^
prompt_messages, stop=stop, callbacks=callbacks, **kwargs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/path/ai-browser/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 756, in agenerate
raise exceptions[0]
File "/Users/path/ai-browser/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 924, in _agenerate_with_cache
result = await self._agenerate(
^^^^^^^^^^^^^^^^^^^^^^
messages, stop=stop, run_manager=run_manager, **kwargs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/path/ai-browser/lib/python3.13/site-packages/langchain_ollama/chat_models.py", line 731, in _agenerate
final_chunk = await self._achat_stream_with_aggregation(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
messages, stop, run_manager, verbose=self.verbose, **kwargs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/path/ai-browser/lib/python3.13/site-packages/langchain_ollama/chat_models.py", line 588, in _achat_stream_with_aggregation
async for stream_resp in self._acreate_chat_stream(messages, stop, **kwargs):
...<27 lines>...
)
File "/Users/path/ai-browser/lib/python3.13/site-packages/langchain_ollama/chat_models.py", line 479, in _acreate_chat_stream
yield await self._async_client.chat(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<7 lines>...
) # type:ignore
^
File "/Users/path/ai-browser/lib/python3.13/site-packages/ollama/_client.py", line 845, in chat
).model_dump(exclude_none=True),
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/Users/path/ai-browser/lib/python3.13/site-packages/pydantic/main.py", line 426, in model_dump
return self.pydantic_serializer.to_python(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
self,
^^^^^
...<10 lines>...
serialize_as_any=serialize_as_any,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
pydantic_core._pydantic_core.PydanticSerializationError: Error calling function
serialize_model: OSError: [Errno 63] File name too long: 'iVBORw0KGgoAAAANSUhEUgAABQAAAAQACAIAAAAx8WMUAAAAAXNSR0IArs4c6QAAF59JREFUeJzt18ENwCAQwLDS/Xc+tgCJ2BPkmzUzHwAAALzuvx0AAAAAJxhgAAAAEgwwAAAACQYYAACABAMMAABAggEGAAAgwQADAACQYIABAABIMMAAAAAkGGAAAAASDDAAAAAJBhgAAIAEAwwAAECCAQYAACDBAAMAAJBggAEAAEgwwAAAACQYYAAAABIMMAAAAAkGGAAAgAQDDAAAQIIBBgAAIMEAAwAAkGCAAQAASDDAAAAAJBhgAAAAEgwwAAAACQYYAACABAMMAABAggEGAAAgwQADAACQYIABAABIMMAAAAAkGGAAAAASDDAAAAAJBhgAAIAEAwwAAECCAQYAACDBAAMAAJBggAEAAEgwwAAAACQYYAAAABIMMAAAAAkGGAAAgAQDDAAAQIIBBgAAIMEAAwAAkGCAAQAASDDAAAAAJBhgAAAAEgwwAAAACQYYAACABAMMAABAggEGAAAgwQADAACQYIABAABIMMAAAAAkGGAAAAASDDAAAAAJBhgAAIAEAwwAAECCAQYAACDBAAMAAJBggAEAAEgwwAAAACQYYAAAABIMMAAAAAkGGAAAgAQDDAAAQIIBBgAAIMEAAwAAkGCAAQAASDDAAAAAJBhgAAAAEgwwAAAACQYYAACABAMMAABAggEGAAAgwQADAACQYIABAABIMMAAAAAkGGAAAAASDDAAAAAJBhgAAIAEAwwAAECCAQYAACDBAAMAAJBggAEAAEgwwAAAACQYYAAAABIMMAAAAAkGGAAAgAQDDAAAQIIBBgAAIMEAAwAAkGCAAQAASDDAAAAAJBhgAAAAEgwwAAAACQYYAACABAMMAABAggEGAAAgwQADAACQYIABAABIMMAAAAAkGGAAAAASDDAAAAAJBhgAAIAEAwwAAECCAQYAACDBAAMAAJBggAEAAEgwwAAAACQYYAAAABIMMAAAAAkGGAAAgAQDDAAAQII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AJBggAEAAEgwwAAAACQYYAAAABIMMAAAAAkGGAAAgAQDDAAAQIIBBgAAIMEAAwAAkGCAAQAASDDAAAAAJBhgAAAAEgwwAAAACQYYAACABAMMAABAggEGAAAgwQADAACQYIABAABIMMAAAAAkGGAAAAASDDAAAAAJBhgAAIAEAwwAAECCAQYAACDBAAMAAJBggAEAAEgwwAAAACQYYAAAABIMMAAAAAkGGAAAgAQDDAAAQIIBBgAAIMEAAwAAkGCAAQAASDDAAAAAJBhgAAAAEgwwAAAACQYYAACABAMMAABAggEGAAAgwQADAACQYIABAABIMMAAAAAkGGAAAAASDDAAAAAJBhgAAIAEAwwAAECCAQYAACDBAAMAAJCwAYoKCv27r4piAAAAAElFTkSuQmCC'yuyangchee98 commentedon Dec 26, 2024
Tried
My error
sbhavani commentedon Dec 26, 2024
@yuyangchee98 getting the same error
rhyliieee commentedon Dec 26, 2024
I think you should use a multi-modal model for it since when we initiate a task with browser use, it labels each element from the current webpage which the Model Takes as input and perform necessary action. Tried other text models but I got that same error, but when I tried vision models like the Pixtral, and deepseek, it works just fine.
sbhavani commentedon Dec 27, 2024
@csharpmastr any specific model id you'd recommend with ollama? I've tried the deepseek tools and it doesn't work.
rhyliieee commentedon Dec 27, 2024
I never tried setting up an Ollama server before. But try this:
llm = ChatOpenAI( model=model_name, api_key=os.getenv(‘MISTRAL_API_KEY’), base_url=url )rhyliieee commentedon Dec 27, 2024
I notice you’re using ChatOllama which doesn’t support multi-modal inputs where ai think browser-use requires a multi-modal model for it to properly work.
Check out this link to view Langchain chat models that support multi-modal inputs: https://python.langchain.com/docs/integrations/chat/
yuyangchee98 commentedon Dec 29, 2024
I see. So it looks like the only way to run this is through ChatNVIDIA.
rhyliieee commentedon Dec 29, 2024
You can also use other Chat Models from langchain. As of this writing, there are 6 chat models from langchain that supports multi-modal inputs.
yuyangchee98 commentedon Dec 29, 2024
Chatnvidia is the only one that works locally and supports multi modal though? According to that site you linked
grigio commentedon Jan 4, 2025
+1 I tried via Ollama but I don't think there is a local model that supports vision+tools at the same time
Merge pull request browser-use#5 from browser-use/oskari-branch
fix(mcp/trust): address cubic-dev-ai review (P1 lookup-exception fail…
fix(mcp/trust): address cubic-dev-ai review (P1 lookup-exception fail…
fix(mcp/trust): address cubic-dev-ai review (P1 lookup-exception fail…
fix(mcp/trust): IPv6 brackets, invalid port, bool score, log redactio…