You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
query (str): The search query to use (e.g., "latest Brave news").
33
+
country (Optional[str]): Two-letter country code for geo-targeting (e.g., "US", "BR"). Default is "US".
34
+
search_language (Optional[str]): 2 or more character language code for which the search results are provided (e.g., "en", "es"). Default is "en".
35
+
count (Optional[int]): Number of results desired. The maximum is 20. Actual number may be less. Default is 10.
36
+
offset (Optional[int]): Number of result sets/pages to skip. Max is 9. Default is 0.
37
+
safesearch (Optional[Literal["off", "moderate", "strict"]]): Level of safe search to apply. Default is "moderate".
38
+
spellcheck (Optional[bool]): Whether to apply spell checking to the search query.
39
+
freshness (Optional[Freshness]): Filters search results by date discovered. Supported values: pd/pw/pm/py, or YYYY-MM-DDtoYYYY-MM-DD
40
+
text_decorations (Optional[bool]): Whether strings (e.g., result snippets) should include decoration markers (e.g. highlighting characters).
41
+
extra_snippets (Optional[bool]): Whether to include up to 5 extra snippets of text for each result.
42
+
operators (Optional[bool]): Whether to apply search operators to the query (e.g., 'site:example.com' or 'intitle:example'). Default is True.
43
+
"""
20
44
21
-
search_query: str=Field(
22
-
..., description="Mandatory search query you want to use to search the internet"
45
+
query: str=Field(..., description="Search query to perform")
46
+
country: str|None=Field(
47
+
default="US",
48
+
description="Two-letter country code for geo-targeting (e.g., 'US', 'BR').",
49
+
)
50
+
search_language: str|None=Field(
51
+
default="en",
52
+
description="2 or more character language code for which the search results are provided (e.g., 'en', 'es').",
53
+
)
54
+
count: int|None=Field(
55
+
default=None,
56
+
description="Number of results desired. The maximum is 20. Actual number may be less.",
57
+
)
58
+
offset: int|None=Field(
59
+
default=0,
60
+
description="Number of result sets/pages to skip. Max is 9.",
61
+
)
62
+
safesearch: SafeSearch|None=Field(
63
+
default="moderate",
64
+
description="Level of safe search to apply. Default is 'moderate'.",
65
+
)
66
+
spellcheck: bool|None=Field(
67
+
default=True,
68
+
description="Whether to apply spell checking to the search query.",
69
+
)
70
+
freshness: Freshness|None=Field(
71
+
default=None,
72
+
description="Filters search results by when they were discovered. Supported values: pd/pw/pm/py, or YYYY-MM-DDtoYYYY-MM-DD",
73
+
)
74
+
text_decorations: bool|None=Field(
75
+
default=None,
76
+
description="Whether strings (e.g., result snippets) should include decoration markers (e.g. highlighting characters).",
77
+
)
78
+
extra_snippets: bool|None=Field(
79
+
default=None,
80
+
description="Snippet is an excerpt from a page you get as a result of the query, and extra_snippets allow you to get up to 5 additional, alternative excerpts.",
81
+
)
82
+
operators: bool|None=Field(
83
+
default=True,
84
+
description="Whether to apply search operators to the query (e.g., 'site:example.com' or 'intitle:example').",
23
85
)
24
86
25
87
88
+
# TODO: Extend support to additional endpoints (e.g., /images, /news, etc.)
26
89
classBraveSearchTool(BaseTool):
27
90
"""BraveSearchTool - A tool for performing web searches using the Brave Search API.
28
91
@@ -36,12 +99,9 @@ class BraveSearchTool(BaseTool):
36
99
"""
37
100
38
101
name: str="Brave Web Search the internet"
39
-
description: str= (
40
-
"A tool that can be used to search the internet with a search_query."
41
-
)
102
+
description: str="Tool to perform web search using Brave Search API."
0 commit comments