-
Notifications
You must be signed in to change notification settings - Fork 195
feat: add Brave and TinyFish web search providers #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
9129c8a
42e9a22
2ffb696
3363e92
f612f98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -197,6 +197,55 @@ functions: | |
| - **`fast`** -- Optimized for low latency. Returns results quickly at the cost of recall and semantic depth. Use for interactive UIs, high-volume calls, or when the query is narrow and keyword-like. | ||
| - **`deep`** -- Optimized for thoroughness. Runs a more expensive semantic search with broader retrieval. Use for research-quality queries where completeness matters more than speed. | ||
|
|
||
| ### `brave_web_search` | ||
|
|
||
| Web search powered by the [Brave Search API](https://api.search.brave.com/). | ||
|
|
||
| ```yaml | ||
| functions: | ||
| web_search_tool: | ||
| _type: brave_web_search | ||
| max_results: 5 | ||
| country: US | ||
| search_lang: en | ||
| ``` | ||
|
|
||
| | Parameter | Type | Default | Description | | ||
| |-----------|------|---------|-------------| | ||
| | `max_results` | `int` | `5` | Maximum number of web results to return. Brave supports up to 20 web results per request. | | ||
| | `api_key` | `str` | `None` | Brave Search API subscription token. Falls back to `BRAVE_API_KEY` environment variable. | | ||
| | `max_retries` | `int` | `3` | Number of retry attempts on search failure. | | ||
| | `country` | `str` | `"US"` | Two-character country code for search results. | | ||
| | `search_lang` | `str` | `"en"` | Language code for search results. | | ||
| | `safesearch` | `str` | `"moderate"` | Adult-content filtering mode: `off`, `moderate`, or `strict`. | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Follow the style that was used for Tavily's |
||
| | `freshness` | `str` | `None` | Optional page-age filter such as `pd`, `pw`, `pm`, `py`, or `YYYY-MM-DDtoYYYY-MM-DD`. | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. List out the options and descriptions for each one. Use the same format as used by the Tavily Last 24 Hours (pd): Get the latest updates and recent content |
||
| | `timeout` | `float` | `20.0` | HTTP request timeout in seconds. | | ||
| | `max_content_length` | `int` | `10000` | Truncate each result's snippet text to this many characters. Set to `None` to disable truncation. | | ||
|
|
||
| ### `tinyfish_web_search` | ||
|
|
||
| Web search powered by the [TinyFish Search API](https://docs.tinyfish.ai/search-api). | ||
|
|
||
| ```yaml | ||
| functions: | ||
| web_search_tool: | ||
| _type: tinyfish_web_search | ||
| max_results: 5 | ||
| location: US | ||
| language: en | ||
| ``` | ||
|
|
||
| | Parameter | Type | Default | Description | | ||
| |-----------|------|---------|-------------| | ||
| | `max_results` | `int` | `5` | Maximum number of search results to return from the response, up to `20`. | | ||
| | `api_key` | `str` | `None` | TinyFish API key. Falls back to `TINYFISH_API_KEY` environment variable. | | ||
| | `max_retries` | `int` | `3` | Number of retry attempts on search failure. | | ||
| | `location` | `str` | `"US"` | Country code for geo-targeted results. | | ||
| | `language` | `str` | `"en"` | Language code for result language. | | ||
| | `page` | `int` | `0` | Search result page number, starting from `0`. | | ||
| | `timeout` | `float` | `20.0` | HTTP request timeout in seconds. | | ||
| | `max_content_length` | `int` | `10000` | Truncate each result's snippet text to this many characters. Set to `None` to disable truncation. | | ||
|
|
||
| ### `paper_search` | ||
|
|
||
| Academic paper search through Google Scholar (using the [Serper API](https://serper.dev/)). | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Brave Web Search | ||
|
|
||
| NAT tool package for the Brave Search API web search endpoint. | ||
|
|
||
| ## Configuration | ||
|
|
||
| ```yaml | ||
| functions: | ||
| web_search_tool: | ||
| _type: brave_web_search | ||
| max_results: 5 | ||
| country: US | ||
| search_lang: en | ||
| ``` | ||
|
|
||
| Set `BRAVE_API_KEY` in the environment, or provide `api_key` in the workflow config. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| [build-system] | ||
| build-backend = "setuptools.build_meta" | ||
| requires = ["setuptools >= 64", "setuptools-scm>=8"] | ||
|
|
||
| [tool.setuptools] | ||
| packages = ["brave_web_search"] | ||
| package-dir = {"brave_web_search" = "src"} | ||
|
|
||
| [project] | ||
| name = "brave-web-search" | ||
| version = "1.0.0" | ||
| description = "NAT-based Brave Search API web search tool" | ||
| readme = "README.md" | ||
| requires-python = ">=3.11,<3.14" | ||
| license = {text = "Apache-2.0"} | ||
| dependencies = [ | ||
| "pydantic>=2.0.0", | ||
| ] | ||
|
|
||
| [project.entry-points."nat.plugins"] | ||
| brave_web_search = "brave_web_search.register" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from .register import brave_web_search # noqa: F401 | ||
|
|
||
| __all__ = [ | ||
| "brave_web_search", | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indicate that at least one of these are required