Zenn
🎉

Browser-use web-uiでollamaを使ってDeepseek-r1を使用する

2025/01/29に公開
1

はじめに

本記事では、browser-useのweb-ui上でollamaを使ってローカルでDeepseek-r1を動かします。

2025/01/28にbrowser-useのweb-uiのv1.4がリリースされました。
v1.4では、ollamaを使ってローカルでDeepseek-r1を使うことができます。
https://github.com/browser-use/web-ui/releases/tag/v1.4

ollamaを使うことで、API料金が発生せず、ローカルで色々と試せます。

browser-useとは?

browser-useは、ブラウザの自動的な操作をAIエージェントを活用して行うライブラリです。

https://github.com/browser-use/browser-use

browser-useの公式リポジトリのexamplesに様々な使い方が紹介されています。

https://github.com/browser-use/browser-use/tree/main/examples

browser-use web-uiのセットアップ

browser-use web-uiのセットアップは以下を参考に実施します。
https://zenn.dev/tossy21/articles/5b0ff1452af70a#browser-use-web-ui

ollamaを選択することでローカルLLMを使う

ollamaのセットアップ

こちらも以前の記事と同様に実施します。
https://zenn.dev/tossy21/articles/5b0ff1452af70a#ollamaをダウンロード

ollamaからDeepseek-r1をインストール

次に、ollamaにてDeepseek-r1をインストールします。
https://github.com/browser-use/web-ui/releases/tag/v1.4 の記載にあるように、14Bを用いました。

ollama run deepseek-r1:14b

https://ollama.com/library/deepseek-r1

browser-use web-uiの設定

http://127.0.0.1:7788/ へアクセスします。

LLM ConfigurationタブのLLM Providerを「ollama」を選択、Model Nameを「deepseek-r1:14b」を選択します。

WebUI Setup: Launch the WebUI following the instructions. Here's a crucial step: Uncheck "Use Vision" and set "Max Actions per Step" to 1. ✅

また、"Use Vision"のチェックを外し、"Max Actions per Step"は1としました。

その後、Run AgentのタブのTask Descriptionに任意の説明を記載して、Run Agentで実行します。

実用例

Googleへアクセスし、"OpenAI"で検索した最初のURLを取得

最初は、browser-use web-uiを開いた時のデフォルトで入っている説明を使います。
以前は、 llama2:7bqwen2.5:7bでは失敗しました。

https://zenn.dev/tossy21/articles/5b0ff1452af70a#googleへアクセスし、"openai"で検索した最初のurlを取得

Run AgentのタブのTask Descriptionには以下を記載します。

go to google.com and type 'OpenAI' click search and give me the first url

結果としては、時間は約7分かかりましたが、動作しました。

INFO     [src.agent.custom_agent] 🤯 End Deep Thinking
INFO     [src.agent.custom_agent] ✅ Eval: Success
INFO     [src.agent.custom_agent] 🧠 New Memory: https://openai.com
INFO     [src.agent.custom_agent] ⏳ Task Progress: 
1. Input 'OpenAI' into search bar. 2. Click search button.
INFO     [src.agent.custom_agent] 📋 Future Plans: 

INFO     [src.agent.custom_agent] 🤔 Thought: Successfully extracted the first URL from the search results, which is OpenAI's official website.
INFO     [src.agent.custom_agent] 🎯 Summary: Task completed successfully. First URL found.
INFO     [src.agent.custom_agent] 🛠️  Action 1/1: {"done":{"text":"https://openai.com"}}
INFO     [src.agent.custom_agent] 🧠 All Memory: 
https://openai.com

INFO     [src.agent.custom_agent] 📄 Result: https://openai.com
INFO     [src.agent.custom_agent] ✅ Task completed successfully

きちんと、https://openai.com のURLを取得できています。

任意のURLへアクセスし、特定の文字列までスクロール

Navigate to 'https://en.wikipedia.org/wiki/Internet' and scroll to the string 'The vast majority of computer'

プロンプトは以下を参考にしています。
https://github.com/browser-use/browser-use/blob/main/examples/use-cases/scrolling_page.py

INFO     [src.agent.custom_agent] ✅ Eval: Success - Successfully scrolled to the specified text 'The vast majority of computer'.
INFO     [src.agent.custom_agent] 🧠 New Memory: 
INFO     [src.agent.custom_agent] ⏳ Task Progress: 
1. Navigated to https://en.wikipedia.org/wiki/Internet. 2. Scrolled to 'The vast majority of computer'.
INFO     [src.agent.custom_agent] 📋 Future Plans: 

INFO     [src.agent.custom_agent] 🤔 Thought: The task required navigating to a Wikipedia page and scrolling to a specific phrase. Both actions have been completed successfully.
INFO     [src.agent.custom_agent] 🎯 Summary: Task completed successfully with all actions performed as required.
INFO     [src.agent.custom_agent] 🛠️  Action 1/1: {"done":{"text":"Successfully navigated to the Wikipedia page on the Internet and scrolled to the specified text."}}
INFO     [src.agent.custom_agent] 🧠 All Memory: 

INFO     [src.agent.custom_agent] 📄 Result: Successfully navigated to the Wikipedia page on the Internet and scrolled to the specified text.
INFO     [src.agent.custom_agent] ✅ Task completed successfully

こちらも成功しました。
https://en.wikipedia.org/wiki/Internet のSurveillanceの1行目のThe vast majority of computerまでスクロールされていました。

おわりに

本記事では、browser-useのweb-ui上でollamaを使ってローカルでDeepseek-r1を動かしました。

今回は、いくつかのタスクを解くことができました。
また、ollamaを使ってDeepseek-r1を活用できることを確かめることができました。

最後までお読み頂きありがとうございました。本記事が参考になれば、幸いです。

GitHubで編集を提案
1

Discussion

ログインするとコメントできます