The Zhipu web-search provider hardcoded search_std, leaving search_pro
( higher recall, 3x price ) unreachable from any configuration surface.
- providers/zhipu.py resolves the engine from the call-time value, then
the provider config's search_engine/engine field, then search_std;
only search_std/search_pro are allowed and unknown values warn and
fall back to the default instead of raising.
- The engine rides the resolved search config the same way max_results
and proxy do: active search profile field first, then
tools.web_search.search_engine in main.yaml, then None (provider
default), injected into the provider kwargs by web_search().
- get_current_config() surfaces the resolved engine.
Tests cover the default payload, config-driven search_pro, the engine
alias, invalid values warning and falling back, and the end-to-end
settings -> resolved config -> real ZhipuProvider -> payload flow.
Add SearchApi (searchapi.io) as a web-search provider, following the Serply
shape: one key, three modes (search -> google, news -> google_news,
scholar -> google_scholar) behind a single GET endpoint selected by the
`engine` parameter. Rows are plain SERP results, so consolidation still
writes the answer and Scholar rows render through the shared academic
template via the `searchapi_scholar` -> `serper_scholar` mapping.
- Key travels only as `Authorization: Bearer`, never in the URL; requests
carry `Accept: application/json` and `User-Agent: DeepTutor`.
- Google retired `num` for web and news results, so those are cut
client-side with `max_results`; Scholar still honors `num` (capped at 20).
- News sends `link=resolved` so links point at the publisher instead of a
Google redirect, and prefers `iso_date` over the relative `date`.
- Scholar maps `publication`, `inline_links.cited_by.total`, `resource.link`
and `data_cid` onto the Serper attribute keys; a dead `javascript:` PDF
badge is dropped.
- Non-200 raises with the API's `error` message; a non-JSON body raises too.
- Spec table entry (`requires_api_key=True, soft_fallback=False`), registry
import, consolidation mapping and `deeptutor init` wizard entry reading
`SEARCHAPI_API_KEY` / `SEARCH_API_KEY`.
- Nine tests mirroring the Serply block, with fixtures shaped after live
responses from each engine.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Engine-level search provider backed by DeepSeek's /v1/tools/search endpoint,
distinct from the model-side web_search tool mapping: works with any
configured LLM. Rows carry no model-written answer, so consolidation still
supplies it.
- providers/deepseek.py: Bearer auth, count capped 1-50, need_content
default False (page Markdown kept in SearchResult.content only when
requested), summary preferred over snippet as the model-facing blurb,
authority/rerank_score in attributes, proxy honored, base_url used
verbatim with the documented endpoint as fallback. No new dependency.
- SEARCH_PROVIDERS: label DeepSeek, requires_api_key=True,
soft_fallback=False (billed per request; a missing key raises instead
of landing on DuckDuckGo).
- Init wizard entry with DEEPSEEK_API_KEY/SEARCH_API_KEY env keys, keeping
the wizard set equal to the backend table.
- TracePresentation PROVIDER_LABELS: deepseek -> DeepSeek (titleCase would
render "Deepseek").
- Tests: row mapping, 401/402/429 paths, missing key fails before network,
and the base_url/proxy/max_results contract via _NEW_PROVIDERS.
GET /v1/web-search with Bearer auth, answer-first: the confirmed answer
maps onto WebSearchResponse.answer (supports_answer), ranked sources onto
citations/search_results, and list rows ride along in metadata. No count
parameter exists on the endpoint, so max_results caps client-side like
Aliyun IQS. Registered in the SEARCH_PROVIDERS spec table as a paid
provider (soft_fallback=False); tests mock requests offline.
Closes#2516
_moderation_rejections keyed its decision dict by text.strip()[:4000] while
filter_web_search_response looked the decision up by the unstripped row text
(_reference_text(...)[:4000]). When a reference exceeded the 4000-char cap and
the cut landed on whitespace, the stripped key differed from the row text, the
lookup missed, and a reference OpenAI Moderation had flagged survived into the
results — the exact fail-open the stage exists to prevent. Key the dict by each
exact submitted text and cap only the payload sent to the API.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
web_search() fetched max_results results from the provider but built
the AnswerConsolidator with its default max_results=5. For providers
without their own answer, the template and LLM consolidation kept only
the first five results, so a search profile set to 6-10 results still
gave the model five sources while the footer reported all of them.
Pass the resolved max_results to the consolidator.
Two pieces of work land together because the second is built on the
first: the provider layer was consolidated onto one spec table, then six
new providers were registered against it.
Layer overhaul
- Converge seven separate provider lists (backend registry, runtime
config, settings router, CLI wizard, frontend catalog, i18n, tests)
onto a single SEARCH_PROVIDERS spec table; every consumer derives from
it instead of keeping its own copy.
- Fix three silent defects: serper's `num` never reached the API (it was
swallowed by **kwargs, so max_results did nothing), serper dropped its
proxies, and jina had no result-count limit at all.
- A runtime failure (rate limit, timeout, unreachable network) no longer
fails the whole turn. The request walks the user's other credentialed
search profiles and finally DuckDuckGo, recording the downgrade under
a top-level `search_fallback` key so the trace shows what happened.
- Drop three provider modules that were never registered (exa, baidu,
openrouter). They stay in the deprecated list, so a stale config reads
as outdated rather than as a misspelled name.
Six new providers
doubao, bocha, zhipu, firecrawl, qianfan, aliyun_iqs — selectable under
Settings > Catalog > Search with their credential fields derived from the
spec table, and offered by `deeptutor init`. All six set
`soft_fallback=False`: five are China-hosted and the DuckDuckGo fallback
is unreachable on those networks, so a missing API key has to fail
loudly instead of silently timing out somewhere else.
Baidu returns as `qianfan` on the official Qianfan API; the old `baidu`
key stays deprecated.