docker 运行claude 的computer use
需要注意的是:这里claude操纵的是docker的虚拟服务器,不能访问本地url,需要进行端口转发
export ANTHROPIC_API_KEY=%your_api_key%
docker run \
-e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
-v $HOME/.anthropic:/home/computeruse/.anthropic \
-p 5900:5900 \
-p 8501:8501 \
-p 6080:6080 \
-p 8080:8080 \
-it ghcr.io/anthropics/anthropic-quickstarts:computer-use-demo-latest
也可以用browser use 操纵自己的本地浏览器,步骤如下
conda create -n browse python=3.11
conda activate browse
git clone https://github.com/browser-use/web-ui.git
cd web-ui
pip install -r requirements.txt
python webui.py --ip 127.0.0.1 --port 7788
记得填写.env对应的key
Output Format - Browser Use
调用qwen模型
import os
from langchain_openai import ChatOpenAI
from langchain_openai.chat_models.base import BaseChatOpenAI
from browser_use import Agent, Browser, BrowserConfig
import asyncio
# 无头模式
browser = Browser(
config=BrowserConfig(
headless=False,
disable_security=True
)
)
os.environ['OPENAI_API_KEY'] = "your_openai_api_key"
async def main():
agent = Agent(
task="Visit URL: http://localhost:3000 And test the form submission function of this website to see if the successful submission prompt pop-up window is displayed. Finally, it is essential to provide an accurate conclusion on whether the function is effective or ineffective",
llm=BaseChatOpenAI(model="qwen-max-2025-01-25",
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1"),
browser=browser
)
result = await agent.run()
print(result)
asyncio.run(main())
阿里云调用vl模型
如何使用Qwen-VL模型_大模型服务平台百炼(Model Studio)-阿里云帮助中心