BaiduSearch
BaiduSearch enables an Agent to search the web for information using the Baidu search engine.
Prerequisites
The following example requires the baidusearch library. To install BaiduSearch, run the following command:
1uv pip install -U baidusearchExample
1from kern.agent import Agent2from kern.tools.baidusearch import BaiduSearchTools34agent = Agent(5 tools=[BaiduSearchTools()],6 description="You are a search agent that helps users find the most relevant information using Baidu.",7 instructions=[8 "Given a topic by the user, respond with the 3 most relevant search results about that topic.",9 "Search for 5 results and select the top 3 unique items.",10 "Search in both English and Chinese.",11 ],12 )1314agent.print_response("What are the latest advancements in AI?", markdown=True)Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
fixed_max_results | int | - | Sets a fixed number of maximum results to return. No default is provided, must be specified if used. |
fixed_language | str | - | Set the fixed language for the results. |
headers | Any | - | Headers to be used in the search request. |
proxy | str | - | Specifies a single proxy address as a string to be used for the HTTP requests. |
timeout | int | 10 | Sets the timeout for HTTP requests, in seconds. |
enable_baidu_search | bool | True | Enable the baidu_search functionality. |
all | bool | False | Enable all functionality. |
Toolkit Functions
| Function | Description |
|---|---|
baidu_search | Use this function to search Baidu for a query. |
Developer Resources
- View Tools