1/26/2025

how we can build DeepSeek using Ollama.

🔥 We can build DeepSeek locally!

Ollama Deep Researcher is a fully local web research assistant powered by any LLM hosted by Ollama. Simply provide a topic, and it will:

  1. Generate a search query.
  2. Gather and summarize web search results.
  3. Reflect on the summary to identify knowledge gaps.
  4. Create new search queries to address those gaps.
  5. Refine the summary over user-defined cycles.

At the end, it delivers a comprehensive markdown summary, complete with citations for all sources used.

research-rabbit

📺 Video Tutorials

See it in action or build it yourself? Check out these helpful video tutorials:

🚀 Quickstart

Pull a local LLM that you want to use from Ollama:

ollama pull llama3.2
ollama pull deepseek-r1:8b

For free web search (up to 1000 requests), you can use the Tavily API:

export TAVILY_API_KEY=<your_tavily_api_key>

Clone the repository and launch the assistant with the LangGraph server:

curl -LsSf https://astral.sh/uv/install.sh | sh
git clone https://github.com/langchain-ai/ollama-deep-researcher.git
cd ollama-deep-researcher
uvx --refresh --from "langgraph-cli[inmem]" --with-editable . --python 3.11 langgraph dev

You should see the following output and Studio will open in your browser:

Ready!

API: http://127.0.0.1:2024

Docs: http://127.0.0.1:2024/docs

LangGraph Studio Web UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024

Open LangGraph Studio Web UI via the URL in the output above.

In the configuration tab:

  • You can set the name of your local LLM to use with Ollama (it will by default be llama3.2)
  • You can set the depth of the research iterations (it will by default be 3)

Give the assistant a topic for research, and you can visualize its process!

How it works

Ollama Deep Researcher is inspired by IterDRAG. This approach will decompose a query into sub-queries, retrieve documents for each one, answer the sub-query, and then build on the answer by retrieving docs for the second sub-query. Here, we do similar:

  • Given a user-provided topic, use a local LLM (via Ollama) to generate a web search query
  • Uses a search engine (configured for Tavily) to find relevant sources
  • Uses LLM to summarize the findings from web search related to the user-provided research topic
  • Then, it uses the LLM to reflect on the summary, identifying knowledge gaps
  • It generates a new search query to address the knowledge gaps
  • The process repeats, with the summary being iteratively updated with new information from web search
  • It will repeat down the research rabbit hole
  • Runs for a configurable number of iterations (see configuration tab)

Locally deploying DeepSeek as your perpetual workflow to enable continuous learning, correction, and task processing is undoubtedly a highly meaningful endeavor.