Skip to content

[FEAT] Add native Baidu Search provider for Agent web browsing#5388

Open
jimmyzhuu wants to merge 2 commits intoMintplex-Labs:masterfrom
jimmyzhuu:codex/add-baidu-search-provider
Open

[FEAT] Add native Baidu Search provider for Agent web browsing#5388
jimmyzhuu wants to merge 2 commits intoMintplex-Labs:masterfrom
jimmyzhuu:codex/add-baidu-search-provider

Conversation

@jimmyzhuu
Copy link
Copy Markdown

Summary

This PR adds Baidu Search as a native web search provider for the Agent web-browsing skill.

Until now, Baidu was only exposed as an engine option under third-party providers like SerpApi/SearchApi. That still depended on an intermediary service. This change adds a first-class baidu-search provider so AnythingLLM can use Baidu Search directly for web retrieval, which is especially useful for stronger zh-CN search coverage.

Closes #5387

What changed

  • added baidu-search to the Agent web search provider switch
  • implemented a native Baidu Search request path against Qianfan web_search
  • normalized Baidu search references into the existing citation shape used by web browsing
  • added Admin UI support for selecting Baidu Search and entering its API key
  • exposed AGENT_BAIDU_SEARCH_API_KEY in system settings and env syncing
  • documented the new env var in server and docker env examples
  • added unit tests for Baidu search result normalization

Why

AnythingLLM already supports multiple native web-search providers at the top level for the Agent skill. Baidu is a meaningful gap if we want better Chinese-language web retrieval without forcing users to go through a third-party aggregator.

This keeps the feature aligned with the current product model:

  • web search providers are retrieval sources
  • the agent is still responsible for reasoning over returned citations
  • this does not introduce a second answer-generating search workflow

Testing

  • corepack yarn lint:ci
  • corepack yarn test
  • corepack yarn build (frontend)
  • manual smoke test against Baidu Qianfan web_search with a real API key:
    • received HTTP 200
    • received references
    • normalized results successfully into AnythingLLM citation format

Notes

  • this is intentionally scoped to native web search only
  • no Baidu AI answer or smart search generation flow is introduced in this PR
  • the frontend currently reuses an existing icon for the Baidu Search provider entry

Copy link
Copy Markdown
Member

@timothycarambat timothycarambat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get a video/screencapture of the:

  • Running a request against this engine (devs cannot signup since no wxinPay account)
  • UI of the search picker showing this option

{
name: "Baidu Search",
value: "baidu-search",
logo: AnythingLLMIcon,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a 300x300 Baidu Icon with a white BG

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 75c2005 with the provided 300x300 white-background Baidu logo.

@@ -0,0 +1,72 @@
/* eslint-env jest, node */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this test I think - as it only check Baidu and we would realistically want this on all providers

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 75c2005 so we do not keep a Baidu-specific test here.

body: JSON.stringify({
messages: [{ role: "user", content: query }],
resource_type_filter: [{ type: "web", top_k: 10 }],
search_source: "baidu_search_v2",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an optional and fixed value - we can probably remove it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 75c2005 so we now rely on the API default instead of forcing a fixed search source.

@jimmyzhuu
Copy link
Copy Markdown
Author

Addressed the requested review updates in 75c20053:

  • swapped in the provided 300x300 Baidu logo with a white background
  • removed the fixed search_source parameter and now rely on the API default
  • removed the Baidu-only test

Demo assets for verification are here:

  • picker UI showing Baidu Search
  • recorded request / smoke test against the Baidu engine

Google Drive folder: https://drive.google.com/drive/folders/1-5gQ35FZRU0tHhzcTeQf-mdbzabpaUrm

yarn lint:ci also passes locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Add Baidu Search as a native web search provider for Agent skill

2 participants