yong 8547666a31
feat(search): add DeepSeek web search with configurable thinking (#8299)
* feat(search): add DeepSeek web search with configurable thinking

* fix(search): drain DeepSeek teardown and retain citation spans

Reuse the cancellation-safe context helper so repeated cancellation cannot interrupt HTTP transport cleanup. Preserve validated Unicode citation ranges on retained public sources so the agent can associate claims with their supporting pages. Add regressions for cancellation, timeout, normal completion, invalid ranges, URL screening, and result limits.

* fix(search): preserve DeepSeek citation excerpts through guardrails

* fix(search): share DeepSeek citation excerpts across sources

Group each validated answer range once and associate it with response-local source IDs after URL filtering and result limits. Preserve full-answer PII redaction and existing source-card fields, document the model-facing citation mapping, and repair live-test configuration for both thinking modes. Add HTTP transport, guardrail/budget, attribution, and browser reload regressions.

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-18 21:19:41 +08:00

1.8 KiB

Community providers (deerflow/community/)

Optional search, fetch, knowledge and sandbox providers. The rules here apply to every provider. A provider directory has its own guide only when it has a trap of its own.

Verify

cd backend
python -m pytest tests -q -k "<provider name>"
make test-blocking-io

Rules for every search and fetch provider

  • Validate a successful response before you normalize it. A container of the wrong type, or a non-empty list that holds no objects, is a format error. A missing, null or empty result list is an empty search. Skip non-object entries and keep the valid ones in order.
  • Never return the raw payload as a fallback. It bypasses result-URL screening.
  • Screen result URLs with url_safety.safe_public_result_url. Providers share this one copy. It is a string check without DNS, so a later downloader still enforces the address policy at connection time. Normalize the Unicode dot separators of IDNA before the check, and return the original URL for an allowed result.
  • Pair cited DeepSeek sources with excerpts. Validate provider offsets against the full answer and apply configured PII redaction before slicing so clipped identifiers and later tool-result rewrites preserve attribution.
  • A diagnostic names the malformed container and its type. Queries, URLs, credentials and payload values stay out of logs.
  • Resolve API keys through provider_credentials.resolve_api_key.
  • Build the HTTPX client off the event loop. TLS setup is synchronous. Requests and cleanup stay on the loop.
  • Test the real tool through an offline HTTPX transport. Patch the provider's own httpx reference and leave the shared httpx.Client unchanged. A test that mocks the normalizer or the tool's final output proves nothing about the boundary.