Repository navigation
Add cited research answers and async job routes - #166
Merged
Merged
Conversation
`docpull research` and `docpull.research` search with a chosen backend, fetch results through the local pipeline, and rank paragraphs with the `docpull query` scorer. Answers are the best passages with exact spans and `[S#]` citations. An optional OpenAI-compatible model can rewrite them; the rewrite is kept only when every citation names a real source, and endpoints outside localhost require `--allow-remote-llm`. The compatible server adds Exa `/answer` and fills Tavily's `answer` when `include_answer` is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add Firecrawl `/v1/crawl` and `/v2/crawl` (create, poll, cancel), Parallel `/v1/tasks/runs` with `/result`, and Tavily `/research` to `docpull serve --compat`. Crawls use local discovery and fetching with Firecrawl's regex path filters; task runs and research tasks run `docpull research` and return cited passages. Jobs run as background tasks, live in memory, expire after 24 hours, and are capped at 200. A done-callback marks jobs finished even when they are cancelled before starting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
admin-raintree
force-pushed
the
feat/research
branch
from
October 12, 2026 20:27
d30257e to
49498eb
Compare
admin-raintree
enabled auto-merge (squash)
October 12, 2026 20:27
# Conflicts: # docs/CHANGELOG.md # docs/cli-recipes.md # docs/surface-contract.md # src/docpull/cli.py # src/docpull/surface.py
# Conflicts: # docs/CHANGELOG.md # docs/cli-recipes.md # docs/surface-contract.md # src/docpull/cli.py # src/docpull/surface.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DocPull now answers questions from the web with cited evidence, with no hosted research API involved. This stacks on #165 (local search). The base retargets to
mainwhen #165 merges.docpull research QUESTION --backend searxng|marginaliaanddocpull.research:--max-sourcesresults (default 5, at most 10) through the local pipeline, with HTTPS-only fetching, private-network blocking, and robots.txt handling.docpull querypassage splitter, which keeps paragraphs and code fences whole, and scores the passages with the same_search_score.--max-passages(default 8), at most three per source. Each passage keeps its exactchar_start/char_endspan. Sources are numberedS1,S2, … in order of first use.[S#]citation.Optional model rewrite.
--llm-urland--llm-modelcall any OpenAI-compatible/chat/completionsendpoint, such as Ollama or llama.cpp, at temperature 0, with instructions to answer only from the numbered evidence.--allow-remote-llm, because it may cost money.--llm-api-key-env NAMEsends a bearer key.Compatible routes.
docpull serve --compat --search-backend ..., plus the optional--llm-*flags, adds:POST /answer, which returnsanswerandcitations[], with passagetextwhentext: true.POST /searchwithinclude_answer, which fillsanswer.Surface.
researchmoves fromPRUNED_CLI_COMMANDSto the public CLI. The surface contract, CLI recipes, and changelog are updated.Async job routes (second commit). The compatible server now runs the async APIs:
POST /v1/crawl,/v2/crawlGET /v{1,2}/crawl/{id},DELETEcancelslimitdefaults to 50 and is capped at 500. Firecrawl's regexincludePathsandexcludePathsare applied to the URL path (DocPull's own crawler uses globs, so they are applied after discovery). Status values arescraping,completed,failed, andcancelled.POST /v1/tasks/runsGET /v1/tasks/runs/{run_id},GET .../result?timeout=trun_./resultwaits up to the timeout (600 s max) and returns 408 while the run is still active.output.basis[0].citations[]carries each source's passages asexcerpts.POST /researchGET /research/{request_id}pending/in_progresswhile running, and 200 withcontentandsources[]when done.Not covered yet. No live end-to-end run happened, because it needs a working search backend and a local model.
Validation. The
bun run validate:fullresults below are for the research commit. For the job commit, I ran ruff, mypy on the changed modules, and the 31 compat, search, research, and job tests. I didn't run full local validation because another session had uncommitted changes in the same checkout, so CI is the full check for this commit.bun run validate:fullpasses:tests/test_research.pyandtests/test_compat_jobs.pycover:🤖 Generated with Claude Code