Skip to content

browser_use: 'ChatOpenAI' object has no attribute 'provider' #17

@zhouraym

Description

@zhouraym

When I ran the code in browser_use.py under your example directory, an error occurred in the code:

2025-11-05 18:03:06,082 [DEBUG] register_tool: {'tool': 'fetch_data_with_browser', 'status': 'success'}
2025-11-05 18:03:06,871 [INFO] [TraceID: 9671473064a946de9a3b3b3db7e31fea] run_start: {'query': 'Please search the weather in Shanghai.', 'user_id': 'default_user', 'stream': True}
2025-11-05 18:03:06,872 [DEBUG] [TraceID: 9671473064a946de9a3b3b3db7e31fea] first_request_params: {'params': {'model': 'qwen3-max', 'messages': [{'role': 'system', 'content': '##代理名称:LightAgent19039021\n##代理指令:You are a helpful agent.\n##身份:你是LightAgent,一个可以帮助用户完成多工具使用的有用助手。\n请一步一步思考来完成用户的要求。尽可能完成用户的回答,如果有补充信息,请参考补充信息来调用工具,直到获取所有满足用户的提问所需的答案。\n今日的日期: 2025-11-05 当前时间: 18:03:06'}, {'role': 'user', 'content': 'Please search the weather in Shanghai.'}], 'stream': True, 'tools': [{'type': 'function', 'function': {'name': 'browser_data_fetcher', 'description': '对于无法通过其他工具直接访问的任务,使用浏览器获取文本数据或者文件的URL地址。', 'parameters': {'type': 'object', 'properties': {'task_description': {'type': 'string', 'description': '浏览器要执行的任务的描述。'}}, 'required': ['task_description']}}}], 'tool_choice': 'auto'}}
ChatCompletionChunk(id='chatcmpl-08d3d4e3-d272-40d0-8e1a-282c0e1fd421', choices=[Choice(delta=ChoiceDelta(content=None, function_call=None, refusal=None, role='assistant', tool_calls=[ChoiceDeltaToolCall(index=0, id='call_9ea9b8ff83744d138c0bc3a2', function=ChoiceDeltaToolCallFunction(arguments='', name='browser_data_fetcher'), type='function')]), finish_reason=None, index=0, logprobs=None)], created=1762336988, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-08d3d4e3-d272-40d0-8e1a-282c0e1fd421', choices=[Choice(delta=ChoiceDelta(content=None, function_call=None, refusal=None, role=None, tool_calls=[ChoiceDeltaToolCall(index=0, id='', function=ChoiceDeltaToolCallFunction(arguments='{"task_description": "Search', name=None), type='function')]), finish_reason=None, index=0, logprobs=None)], created=1762336988, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-08d3d4e3-d272-40d0-8e1a-282c0e1fd421', choices=[Choice(delta=ChoiceDelta(content=None, function_call=None, refusal=None, role=None, tool_calls=[ChoiceDeltaToolCall(index=0, id='', function=ChoiceDeltaToolCallFunction(arguments=' for the current weather in Shanghai', name=None), type='function')]), finish_reason=None, index=0, logprobs=None)], created=1762336988, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-08d3d4e3-d272-40d0-8e1a-282c0e1fd421', choices=[Choice(delta=ChoiceDelta(content=None, function_call=None, refusal=None, role=None, tool_calls=[ChoiceDeltaToolCall(index=0, id='', function=ChoiceDeltaToolCallFunction(arguments='."', name=None), type='function')]), finish_reason=None, index=0, logprobs=None)], created=1762336988, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-08d3d4e3-d272-40d0-8e1a-282c0e1fd421', choices=[Choice(delta=ChoiceDelta(content=None, function_call=None, refusal=None, role=None, tool_calls=[ChoiceDeltaToolCall(index=0, id='', function=ChoiceDeltaToolCallFunction(arguments='}', name=None), type='function')]), finish_reason=None, index=0, logprobs=None)], created=1762336988, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-08d3d4e3-d272-40d0-8e1a-282c0e1fd421', choices=[Choice(delta=ChoiceDelta(content=None, function_call=None, refusal=None, role=None, tool_calls=None), finish_reason='tool_calls', index=0, logprobs=None)], created=1762336988, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
{'name': 'browser_data_fetcher', 'title': '使用浏览器', 'arguments': '{"task_description": "Search for the current weather in Shanghai."}'}
2025-11-05 18:03:08,529 [DEBUG] [TraceID: 9671473064a946de9a3b3b3db7e31fea] stream tool_calls: {'tool_calls': [{'name': 'browser_data_fetcher', 'arguments': '{"task_description": "Search for the current weather in Shanghai."}', 'index': 0, 'title': ''}]}
2025-11-05 18:03:08,529 [INFO] [TraceID: 9671473064a946de9a3b3b3db7e31fea] stream function_call: {'tool_call_start': {'name': 'browser_data_fetcher', 'title': '使用浏览器', 'arguments': '{"task_description": "Search for the current weather in Shanghai."}'}}
2025-11-05 18:03:08,529 [DEBUG] [TraceID: 9671473064a946de9a3b3b3db7e31fea] stream fixed_args: {'fixed_args': '{"task_description": "Search for the current weather in Shanghai."}'}
2025-11-05 18:03:10,090 [INFO] [TraceID: 9671473064a946de9a3b3b3db7e31fea] stream single_tool_response: {'single_tool_response': 'Tool call error: 'ChatOpenAI' object has no attribute 'provider'\nTraceback (most recent call last):\n File "D:\apps\ides\miniconda\envs\light_agent\Lib\site-packages\LightAgent\la_core.py", line 181, in dispatch\n result = await tool_call(**tool_params)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "D:\dc\python\light-agent\browser_use_demo.py", line 17, in fetch_data_with_browser\n agent = Agent(\n ^^^^^^\n File "D:\apps\ides\miniconda\envs\light_agent\Lib\site-packages\browser_use\utils.py", line 335, in wrapper\n result = func(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^\n File "D:\apps\ides\miniconda\envs\light_agent\Lib\site-packages\browser_use\agent\service.py", line 197, in init\n if llm.provider == 'browser-use':\n ^^^^^^^^^^^^\n File "D:\apps\ides\miniconda\envs\light_agent\Lib\site-packages\pydantic\main.py", line 1026, in getattr\n raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')\nAttributeError: 'ChatOpenAI' object has no attribute 'provider'\n'}
2025-11-05 18:03:10,091 [DEBUG] [TraceID: 9671473064a946de9a3b3b3db7e31fea] stream next_request_params: {'params': {'model': 'qwen3-max', 'messages': [{'role': 'system', 'content': '##代理名称:LightAgent19039021\n##代理指令:You are a helpful agent.\n##身份:你是LightAgent,一个可以帮助用户完成多工具使用的有用助手。\n请一步一步思考来完成用户的要求。尽可能完成用户的回答,如果有补充信息,请参考补充信息来调用工具,直到获取所有满足用户的提问所需的答案。\n今日的日期: 2025-11-05 当前时间: 18:03:06'}, {'role': 'user', 'content': 'Please search the weather in Shanghai.'}, {'role': 'assistant', 'content': '使用工具: \n [{"name": "browser_data_fetcher", "arguments": "{\"task_description\": \"Search for the current weather in Shanghai.\"}"}]\n'}, {'role': 'user', 'content': 'Tool call error: 'ChatOpenAI' object has no attribute 'provider'\nTraceback (most recent call last):\n File "D:\apps\ides\miniconda\envs\light_agent\Lib\site-packages\LightAgent\la_core.py", line 181, in dispatch\n result = await tool_call(**tool_params)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "D:\dc\python\light-agent\browser_use_demo.py", line 17, in fetch_data_with_browser\n agent = Agent(\n ^^^^^^\n File "D:\apps\ides\miniconda\envs\light_agent\Lib\site-packages\browser_use\utils.py", line 335, in wrapper\n result = func(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^\n File "D:\apps\ides\miniconda\envs\light_agent\Lib\site-packages\browser_use\agent\service.py", line 197, in init\n if llm.provider == 'browser-use':\n ^^^^^^^^^^^^\n File "D:\apps\ides\miniconda\envs\light_agent\Lib\site-packages\pydantic\main.py", line 1026, in getattr\n raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')\nAttributeError: 'ChatOpenAI' object has no attribute 'provider'\n'}], 'stream': True, 'tools': [{'type': 'function', 'function': {'name': 'browser_data_fetcher', 'description': '对于无法通过其他工具直接访问的任务,使用浏览器获取文本数据或者文件的URL地址。', 'parameters': {'type': 'object', 'properties': {'task_description': {'type': 'string', 'description': '浏览器要执行的任务的描述。'}}, 'required': ['task_description']}}}], 'tool_choice': 'auto'}}
{'name': 'browser_data_fetcher', 'title': '使用浏览器', 'output': 'Tool call error: 'ChatOpenAI' object has no attribute 'provider'\nTraceback (most recent call last):\n File "D:\apps\ides\miniconda\envs\light_agent\Lib\site-packages\LightAgent\la_core.py", line 181, in dispatch\n result = await tool_call(**tool_params)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "D:\dc\python\light-agent\browser_use_demo.py", line 17, in fetch_data_with_browser\n agent = Agent(\n ^^^^^^\n File "D:\apps\ides\miniconda\envs\light_agent\Lib\site-packages\browser_use\utils.py", line 335, in wrapper\n result = func(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^\n File "D:\apps\ides\miniconda\envs\light_agent\Lib\site-packages\browser_use\agent\service.py", line 197, in init\n if llm.provider == 'browser-use':\n ^^^^^^^^^^^^\n File "D:\apps\ides\miniconda\envs\light_agent\Lib\site-packages\pydantic\main.py", line 1026, in getattr\n raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')\nAttributeError: 'ChatOpenAI' object has no attribute 'provider'\n'}
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content='It', function_call=None, refusal=None, role='assistant', tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' seems there', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' was an issue', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' with the tool', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' used to fetch data', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' from the browser. Unfortunately', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=', I cannot directly access real', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content='-time weather information without', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' a working tool integration', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content='.\n\nHowever, you', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' can check the current weather in', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' Shanghai using a trusted', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' weather website or app such', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' as:\n\n- [Weather.com', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' (The Weather Channel)](', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content='https://weather.com)\n-', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' [AccuWeather](https', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content='://www.accuweather.com', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content='/)\n- [W', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content='indy](https://www', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content='.windy.com/)\n', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content='- Your smartphone’s built-in', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' weather app\n\nLet me know', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' if there’s anything else', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content=' I can assist with', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content='!', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason=None, index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
ChatCompletionChunk(id='chatcmpl-4b667d8e-19d2-4418-9013-040a32505af2', choices=[Choice(delta=ChoiceDelta(content='', function_call=None, refusal=None, role=None, tool_calls=None), finish_reason='stop', index=0, logprobs=None)], created=1762336991, model='qwen3-max', object='chat.completion.chunk', service_tier=None, system_fingerprint=None, usage=None)
2025-11-05 18:03:13,742 [INFO] [TraceID: 9671473064a946de9a3b3b3db7e31fea] stream_response: {'output': 'It seems there was an issue with the tool used to fetch data from the browser. Unfortunately, I cannot directly access real-time weather information without a working tool integration.\n\nHowever, you can check the current weather in Shanghai using a trusted weather website or app such as:\n\n- Weather.com (The Weather Channel)\n- AccuWeather\n- Windy\n- Your smartphone’s built-in weather app\n\nLet me know if there’s anything else I can assist with!'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions