🦔

Jina AIのnode-DeepResearchを試す

2025/02/15に公開

はじめに

この記事では、Jina AIのnode-DeepResearchを試します。

Jina AIのnode-DeepResearchは以下で公開されています。
https://github.com/jina-ai/node-DeepResearch

ollamaを使うと、ローカルでLLMを使用でき、API料金が発生せず、ローカルで色々と試せます。(Web検索を利用するためのAPI料金は発生します)

Jina AIのnode-DeepResearchを動かす

https://github.com/jina-ai/node-DeepResearch に従って、試していきます。

Install

git clone https://github.com/jina-ai/node-DeepResearch.git
cd node-DeepResearch
npm install

We use Gemini (latest gemini-2.0-flash) / OpenAI / LocalLLM for reasoning, Jina Reader for searching and reading webpages, you can get a free API key with 1M tokens from jina.ai.

推論には、Gemini(gemini-2.0-flash)/OpenAI/LocalLLMを使用できます。
Webページの検索と読み込みには、Jina Readerを使用することができます。

Usageに書かれているように、API Keyを環境変数としてexportしておきます。
Webページの検索と読み込みには、Jina Readerを使用するため、Jina AIのAPI Keyを取得します。
https://jina.ai/reader にアクセスし、「鍵と請求」の欄にAPI Keyがあるので、それを利用します。

export GEMINI_API_KEY=...  # for gemini
# export OPENAI_API_KEY=... # for openai
# export LLM_PROVIDER=openai # for openai
export JINA_API_KEY=jina_...  # free jina api key, get from https://jina.ai/reader

ローカルLLMを使用する

今回は、推論にローカルLLMを使用することにします。
その場合は、以下の環境変数を設定します。

export LLM_PROVIDER=openai  # yes, that's right - for local llm we still use openai client
export OPENAI_BASE_URL=http://127.0.0.1:11434/v1  # your local llm endpoint
export OPENAI_API_KEY=whatever  # random string would do, as we don't use it (unless your local LLM has authentication)
export DEFAULT_MODEL_NAME=qwen2.5:7b  # your local llm model name

クエリを入力する

クエリを入力して試してみます。

npm run dev "what is the latest blog post's title from jina ai?"
  • deepseek-r1:14bは400エラーとなりました。
  • qwen2.5:7bだと、多くの推論がなされますが、最終的な回答は得られませんでした。
  • qwen2.5:14bだと、7bよりは良さそうに推論をしていましたが、最終的な回答は得られませんでした。

推論:Gemini(gemini-2.0-flash)、Web検索:Jina Readerの組み合わせで試す

ここまでは、推論にローカルLLM、Web検索にJina Readerの組み合わせを試しましたが、うまく動作しませんでした。
ここでは、推論をGemini(gemini-2.0-flash)にした場合に、うまく動作するかを試します。

https://aistudio.google.com/app/apikey でAPIキーを作成します。
Google AI Studio上のGemini APIは無料枠で利用できます。
https://ai.google.dev/pricing?hl=ja#2_0flash

export GEMINI_API_KEY=...
export LLM_PROVIDER=gemini
export DEFAULT_MODEL_NAME= 

もう一回、以下を試してみます。

npm run dev "what is the latest blog post's title from jina ai?"

すると、3回目の推論で、以下のような結果が得られました。

...
{
  action: 'answer',
  think: 'I have identified the latest blog post title from the provided knowledge. I will extract the title and provide it as the answer.',
  references: [
    {
      exactQuote: 'January 31, 2025 • 14 minutes read A Practical Guide to Deploying Search Foundation Models in Production We offer detailed cost and performance breakdowns for three deployment strategies: Jina API, self-hosted K8s, and AWS SageMaker, to help you make the right decision.',
      url: 'https://jina.ai/news/a-practical-guide-to-deploying-search-foundation-models-in-production'
    }
  ],
  answer: `Based on the information from Jina AI's newsroom, the latest blog post is "A Practical Guide to Deploying Search Foundation Models in Production" published on January 31, 2025. [^1]`,
  isFinal: true
}
Final Answer: Based on the information from Jina AI's newsroom, the latest blog post is "A Practical Guide to Deploying Search Foundation Models in Production" published on January 31, 2025. [^1]
Token Usage Summary: {
  budget: 1000000,
  total: { promptTokens: 24897, completionTokens: 13719, totalTokens: 38372 },
  breakdown: {
    evaluator: 14107,
    agent: 10550,
    queryRewriter: 837,
    dedup: 18,
    search: 1840,
    read: 11020
  }
}

おわりに

本記事では、Jina AIのnode-DeepResearchを試しました。
推論にローカルLLM、Web検索にJina Readerの組み合わせを試しましたが、うまく動作しませんでした。
一方で、推論をGemini(gemini-2.0-flash)にした場合に、うまく動作することを確認しました。

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

GitHubで編集を提案

Discussion