ai-deepresearch-flow
From documents to deep research insight — automatically.
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
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
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
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deepresearch_flow-0.13.2.tar.gz.
File metadata
- Download URL: deepresearch_flow-0.13.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fd3aaeeea8f444614459bc8eba7cc3285ac1c9140971eafde3196f838da411e
|
|
| MD5 |
2234e876a226f2a2fba6122c23c8e74d
|
|
| BLAKE2b-256 |
06ed6dd553362c4fca2bb5d860c067f5a6e5cc5d6194f06a909f049b31ad3a19
|
Provenance
The following attestation bundles were made for deepresearch_flow-0.13.2.tar.gz:
Publisher:
push-to-pypi.yml on nerdneilsfield/ai-deepresearch-flow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepresearch_flow-0.13.2.tar.gz -
Subject digest:
6fd3aaeeea8f444614459bc8eba7cc3285ac1c9140971eafde3196f838da411e - Sigstore transparency entry: 2499943700
- Sigstore integration time:
-
Permalink:
nerdneilsfield/ai-deepresearch-flow@9f2ff698f499d3b0d0935154d7af02d592e00d51 -
Branch / Tag:
refs/tags/v0.13.2 - Owner: https://github.com/nerdneilsfield
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
push-to-pypi.yml@9f2ff698f499d3b0d0935154d7af02d592e00d51 -
Trigger Event:
push
-
Statement type:
File details
Details for the file deepresearch_flow-0.13.2-py3-none-any.whl.
File metadata
- Download URL: deepresearch_flow-0.13.2-py3-none-any.whl
- Upload date:
- Size: 6.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3da5a52ac73ecaec1cb17649b40847982bd84a4aba3acc016461b2eda2721951
|
|
| MD5 |
a0cdf1d71e5a5afe96a1b6443e94be15
|
|
| BLAKE2b-256 |
a0cfc785b8e8cfa273363c3d140beb2f2fc95f9c07fc45a95750463416265971
|
Provenance
The following attestation bundles were made for deepresearch_flow-0.13.2-py3-none-any.whl:
Publisher:
push-to-pypi.yml on nerdneilsfield/ai-deepresearch-flow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepresearch_flow-0.13.2-py3-none-any.whl -
Subject digest:
3da5a52ac73ecaec1cb17649b40847982bd84a4aba3acc016461b2eda2721951 - Sigstore transparency entry: 2499943708
- Sigstore integration time:
-
Permalink:
nerdneilsfield/ai-deepresearch-flow@9f2ff698f499d3b0d0935154d7af02d592e00d51 -
Branch / Tag:
refs/tags/v0.13.2 - Owner: https://github.com/nerdneilsfield
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
push-to-pypi.yml@9f2ff698f499d3b0d0935154d7af02d592e00d51 -
Trigger Event:
push
-
Statement type: