Prerequisites
The following example requires theddgs library. To install it, run the following command:
Example
Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
enable_search | bool | True | Enable web search function. |
enable_news | bool | True | Enable news search function. |
backend | str | "auto" | The backend to use for searching. Options: "auto", "duckduckgo", "google", "bing", "brave", "yandex", "yahoo", etc. |
modifier | Optional[str] | None | A modifier to prepend to search queries. |
fixed_max_results | Optional[int] | None | A fixed number of maximum results. |
proxy | Optional[str] | None | Proxy to use for requests. |
timeout | Optional[int] | 10 | Maximum seconds to wait for a response. |
verify_ssl | bool | True | Whether to verify SSL certificates. |
timelimit | Optional[str] | None | Time limit for results. "d" (day), "w" (week), "m" (month), "y" (year). |
region | Optional[str] | None | Region for results (e.g., "us-en", "uk-en", "ru-ru"). |
Toolkit Functions
| Function | Description |
|---|---|
web_search | Search the web for a query. Parameters include query (str) for the search query and max_results (int, default=5) for maximum results. Returns JSON formatted search results. |
search_news | Get the latest news from the web. Parameters include query (str) for the search query and max_results (int, default=5) for maximum results. Returns JSON formatted news results. |
Supported Backends
Thebackend parameter supports the following options:
| Backend | Description |
|---|---|
auto | Automatically selects an available backend |
duckduckgo | DuckDuckGo search engine |
google | Google search engine |
bing | Microsoft Bing search engine |
brave | Brave Search |
yandex | Yandex search engine |
yahoo | Yahoo search engine |