Featured image of post 使用 openhands 操作代码仓库

使用 openhands 操作代码仓库

openhands 是一个基于 codeActAgent 的 headless code editor。

codex 是 openai 出品的 headless code editor (我起的名字)。 相对的,openhands 是一个优秀的开源作品,可以自主操作和编辑 repo。openhands 有基于 web 的 UI 界面。

安装

通过私有化部署可以直接使用 openhands

  •  1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    
    docker pull docker.all-hands.dev/all-hands-ai/runtime:0.37-nikolaik
    
    docker run -it --rm --pull=always \
        -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.37-nikolaik \
        -e LOG_ALL_EVENTS=true \
        -v /var/run/docker.sock:/var/run/docker.sock \
        -v ~/.openhands-state:/.openhands-state \
        -p 3000:3000 \
        --add-host host.docker.internal:host-gateway \
        --name openhands-app \
        docker.all-hands.dev/all-hands-ai/openhands:0.37
    

使用自定的 provider

  • openhands 实际上使用 litellm 来调用其他的仓库。
    • 配置 litellm 的相关文档
    • 配置样例
      1
      2
      3
      4
      5
      6
      7
      8
      
        - model_name: vllm-models
          litellm_params:
            model: openai/facebook/opt-125m # the `openai/` prefix tells litellm it's openai compatible
            api_base: http://0.0.0.0:4000/v1
            api_key: none
            rpm: 1440
          model_info:
            version: 2
      
  • image.png

实际上配置 openhands 不需要去配置 litellm。但是,配置的方式和 litellm 是一样的。

在 openhands 设置中,需要在 model 前面加上 openai 来让 litellm 知道模型是 openai 兼容的。

comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计