Skip to main content

ai-deepresearch-flow logo

ai-deepresearch-flow

From documents to deep research insight — automatically.

English | 中文

PyPI - Version


Core Pain Points

  • OCR Chaos: Raw markdown from OCR tools is often broken — tables drift, formulas break, references are non-clickable.
  • Translation Nightmares: Translating technical papers often destroys code blocks, LaTeX formulas, and table structures.
  • Information Overload: Extracting structured insights (authors, venues, summaries) from hundreds of PDFs manually is impossible.
  • Context Switching: Managing PDFs, summaries, and translations in different windows kills focus.

Solution

DeepResearch Flow provides a unified pipeline to Repair, Translate, Extract, and Serve your research library.

Key Features

  • Smart Extraction — Turn unstructured Markdown into schema-enforced JSON (summaries, metadata, Q&A) using LLMs.
  • Precision Translation — Translate OCR Markdown to Chinese/Japanese while freezing formulas, code, tables, and references.
  • Local Knowledge DB — Web UI with Split View (Source/Translation/Summary), full-text search, and multi-dimensional filtering.
  • Snapshot + API Serve — Production-ready SQLite snapshot with static assets and read-only JSON API.
  • OCR Post-Processing — Fix broken references, merge split paragraphs, repair LaTeX and Mermaid diagrams.
  • Semantic Search — LanceDB-backed vector search with hybrid recall and cloud reranking.
  • MCP Integration — FastMCP server for AI agent access with bounded read tools, static-bearer Streamable HTTP/SSE, and GitHub OAuth at /oauth/mcp.

Quick Start

1) Installation

uv pip install deepresearch-flow
# or: pip install deepresearch-flow

2) Configuration

cp config.example.toml config.toml

Minimal config with weighted multi-provider routing:

main_model = [
  { model = "openai/gpt-4o-mini", weight = 4 },
  { model = "claude/claude-sonnet-4-5-20250929", weight = 1 }
]

[[providers]]
name = "openai"
type = "openai_compatible"
base = [
  { url = "https://api.openai.com/v1", weight = 1, key = [
    { value = "env:OPENAI_API_KEY", weight = 4 }
  ] }
]
models = [
  { model_name = "gpt-4o-mini", is_support_json_schema = true }
]

[[providers]]
name = "claude"
type = "claude"
base = [
  { url = "https://api.anthropic.com", weight = 1, key = [
    { value = "env:ANTHROPIC_API_KEY", weight = 1 }
  ] }
]
models = [
  { model_name = "claude-sonnet-4-5-20250929" }
]

Keys use env:VAR_NAME syntax to keep secrets out of config files. Multiple providers (Ollama, Gemini, DashScope, Azure OpenAI) are supported. For full configuration options (embedding, rerank, translator defaults, search), see config.example.toml.

3) The "Zero to Hero" Workflow

Start with ./pdfs/ and, optionally, ./papers.bib. You do not need an existing JSON library, SQLite database, or processed Markdown directory.

The workflow produces these roots:

pdfs/ + papers.bib
  → ocr_output/
  → md_simple/            # local image files
  → md_base64/            # images embedded as data URLs
  ├─ summary_json/<template>.json
  └─ md_base64_translated/

Step 1: OCR PDFs or Images

Copy and configure the OCR settings:

cp ocr.example.toml ocr.toml
# Set: export PADDLE_OCR_TOKEN=xxx
# The example uses PaddleOCR-VL-1.6's asynchronous Job API.
# Adjust poll_interval_seconds and job_timeout_seconds in ocr.toml if needed.

uv run deepresearch-flow recognize ocr ./pdfs \
  --config ocr.toml \
  --output-dir ./ocr_output
# Processes up to 4 files concurrently by default; override with --workers 2.

The backend writes MinerU-compatible layouts: one full.md and images/ directory per document. The configured timeout stops local polling only; it does not cancel the remote PaddleOCR job.

Step 2: Repair Nested OCR Outputs

Each OCR document is nested below ocr_output/, so both repair commands must use -r:

# Repair Markdown structure in every OCR document
uv run deepresearch-flow recognize fix \
  --input ./ocr_output -r --in-place

# Repair LaTeX formulas in every OCR document
uv run deepresearch-flow recognize fix-math \
  --input ./ocr_output -r \
  --model openai/gpt-4o-mini \
  --in-place

fix

fix math

Step 3: Organize Source Markdown

Create both source representations in one pass. organize also needs -r to discover nested OCR layouts. Do not pass --fix: Step 2 has already repaired the OCR source.

uv run deepresearch-flow recognize organize \
  --input ./ocr_output -r \
  --output-simple ./md_simple \
  --output-base64 ./md_base64

md_simple/ keeps image files under md_simple/images/; md_base64/ embeds images, so it is the translation input.

Step 4: Generate Structured Summaries

Generate one JSON bundle per selected prompt template. This example uses deep_read; repeat it for every template you need, naming each output ./summary_json/<template>.json.

uv run deepresearch-flow paper extract \
  --input ./md_simple \
  --model openai/gpt-4o-mini \
  --prompt-template deep_read \
  --output ./summary_json/deep_read.json

extract

Step 4.1: Verify and Retry Summary Fields

Keep verification reports outside summary_json/ so JSON repair scans only summary bundles. paper db verify validates the JSON bundle; it does not require a database. Repeat this unit for every selected template.

uv run deepresearch-flow paper db verify \
  --input-json ./summary_json/deep_read.json \
  --prompt-template deep_read \
  --output-json ./summary_verify/deep_read.json

uv run deepresearch-flow paper extract \
  --input ./md_simple \
  --model openai/gpt-4o-mini \
  --prompt-template deep_read \
  --output ./summary_json/deep_read.json \
  --retry-list-json ./summary_verify/deep_read.json

verify

Step 5: Translate Base64 Markdown

uv run deepresearch-flow translator translate \
  --input ./md_base64 \
  --target-lang zh \
  --model openai/gpt-4o-mini \
  --fix-level moderate \
  --output-dir ./md_base64_translated

Step 6: Repair Generated Artifacts

Repair every summary JSON after extraction and retry. JSON inputs require --json; keep -r because the directory can contain multiple template bundles.

uv run deepresearch-flow recognize fix \
  --input ./summary_json --json -r --in-place

uv run deepresearch-flow recognize fix-math \
  --input ./summary_json --json -r \
  --model openai/gpt-4o-mini \
  --in-place

uv run deepresearch-flow recognize fix-mermaid \
  --input ./summary_json --json -r \
  --model openai/gpt-4o-mini \
  --in-place

fix mermaid

Repair the translated Markdown separately. Mermaid repair is only part of the summary JSON branch.

uv run deepresearch-flow recognize fix \
  --input ./md_base64_translated -r --in-place

uv run deepresearch-flow recognize fix-math \
  --input ./md_base64_translated -r \
  --model openai/gpt-4o-mini \
  --in-place

Step 7: Build a Snapshot Database or Serve Locally

Both commands consume the repaired summary JSON. Add one --input option for each additional file in summary_json/; neither command consumes the other command's output.

Build a persistent SQLite snapshot and static assets:

uv run deepresearch-flow paper db snapshot build \
  --input ./summary_json/deep_read.json \
  --bibtex ./papers.bib \
  --md-root ./md_simple \
  --md-translated-root ./md_base64_translated \
  --pdf-root ./pdfs \
  --output-db ./dist/paper_snapshot.db \
  --static-export-dir ./dist/paper-static

Or start the local web UI directly from the same inputs:

uv run deepresearch-flow paper db serve \
  --input ./summary_json/deep_read.json \
  --bibtex ./papers.bib \
  --md-root ./md_simple \
  --md-translated-root ./md_base64_translated \
  --pdf-root ./pdfs \
  --host 127.0.0.1

If you have no BibTeX file, omit --bibtex ./papers.bib.

Step 8: Add Semantic Search (Optional)

Build a LanceDB vector index from the same repaired summaries and Markdown roots:

uv run deepresearch-flow paper embed \
  --config ./config.toml \
  --input ./summary_json/deep_read.json \
  --md-root ./md_simple \
  --md-translated-root ./md_base64_translated \
  --max-concurrency 4 \
  --document-window 8 \
  --output-embed-db ./paper_vectors

Serve with semantic search enabled:

uv run deepresearch-flow paper db serve \
  --input ./summary_json/deep_read.json \
  --bibtex ./papers.bib \
  --md-root ./md_simple \
  --md-translated-root ./md_base64_translated \
  --pdf-root ./pdfs \
  --embed-db ./paper_vectors \
  --search-access-token "your-token"

Step 9: MCP Integration (Optional)

The project exposes bounded MCP tools for AI agent access via FastMCP. See the MCP documentation for endpoint, auth, and tool reference.


Further Reading

  • Advanced Workflows — Incremental builds, merging JSON/BibTeX, supplementing templates
  • Deployment — CDN serving, Nginx/Caddy config, Docker, Compose
  • API & MCP — Admin API, push/push-semantic, MCP endpoints, auth, and tools
  • Reference — Translator, Extract, DB & Recognize in detail
  • Snapshot Management — Snapshot migration, supplement, update

Built with love for the Open Science community.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepresearch_flow-0.11.0.tar.gz (6.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deepresearch_flow-0.11.0-py3-none-any.whl (6.5 MB view details)

Uploaded Python 3

File details

Details for the file deepresearch_flow-0.11.0.tar.gz.

File metadata

  • Download URL: deepresearch_flow-0.11.0.tar.gz
  • Upload date:
  • Size: 6.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for deepresearch_flow-0.11.0.tar.gz
Algorithm Hash digest
SHA256 01d94a520e614440f513cb5e80aa7b1ebd14b422233b9b8b559d1060cf10dc2c
MD5 fb460ef05e933d47acd7f389eadb2979
BLAKE2b-256 ee9b044e45b9e48a144c86883b1fbac46447021120994f7f057e152fda68024f

See more details on using hashes here.

Provenance

The following attestation bundles were made for deepresearch_flow-0.11.0.tar.gz:

Publisher: push-to-pypi.yml on nerdneilsfield/ai-deepresearch-flow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file deepresearch_flow-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for deepresearch_flow-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7c3a7a6478bcfc284d8860b560ed59da4d079aa7a6cce37612de5ba142b8be1
MD5 8bf85eb2a15afde0a9f0cfee848f4413
BLAKE2b-256 771ca312a1c2b8b1e49b718399b000d2bdcb01ce94c1a9d133e54a89dc716e49

See more details on using hashes here.

Provenance

The following attestation bundles were made for deepresearch_flow-0.11.0-py3-none-any.whl:

Publisher: push-to-pypi.yml on nerdneilsfield/ai-deepresearch-flow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.14.0

2 files

0.13.3

2 files

0.13.2

2 files

0.13.1

2 files

This release

0.11.0 This release

2 files

0.10.14

2 files

0.10.13

2 files

0.10.12

2 files

0.10.11

2 files

0.10.8

2 files

0.10.7

2 files

0.10.6

2 files

0.10.5

2 files

0.10.4

2 files

0.10.3

2 files

0.10.2

2 files

0.10.1

2 files

0.10.0

2 files

0.9.18

2 files

0.9.17

2 files

0.9.16

2 files

0.9.14

2 files

0.9.12

2 files

0.9.11

2 files

0.9.10

2 files

0.9.9

2 files

0.9.8

2 files

0.9.7

2 files

0.9.6

2 files

0.9.5

2 files

0.9.4

2 files

0.9.3

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.5

2 files

0.8.4

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.7.10

2 files

0.7.9

2 files

0.7.8

2 files

0.7.7

2 files

0.7.6

2 files

0.7.5

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.1

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page