1
- from typing import Any , Dict , List , Union , cast
1
+ from typing import Any , Dict , List , Union , cast , Literal
2
2
from typing_extensions import NotRequired , TypedDict
3
3
from .request import Request , RequestConfig
4
4
from .async_request import AsyncRequest , AsyncRequestConfig
9
9
class SearchResponse (TypedDict ):
10
10
success : bool
11
11
"""
12
- Indicates whether the translation was successful.
12
+ Whether the search request was successful
13
13
"""
14
- results : List [Any ]
15
14
16
- is_safe : bool
15
+ query : str
16
+ """
17
+ The search query that was used
18
+ """
17
19
18
20
ai_overview : str
21
+ """
22
+ AI-generated overview/summary of the search results
23
+ or deep research results if enabled
24
+ """
19
25
20
- spell_fixed : str
26
+ results : List [Any ]
27
+ """
28
+ List of search result items
29
+ """
30
+
31
+ is_safe : bool
32
+ """
33
+ Whether the search results passed safe search filtering
34
+ """
35
+
36
+ spell_fixed : bool
37
+ """
38
+ Whether the query was spell-checked and fixed
39
+ """
21
40
22
41
geo_results : List [Any ]
42
+ """
43
+ List of location/geographic search results if applicable
44
+ """
23
45
24
46
image_urls : List [str ]
47
+ """
48
+ List of image URLs found in the search results
49
+ """
25
50
26
51
links : List [str ]
52
+ """
53
+ List of web page URLs found in the search results
54
+ """
27
55
28
56
29
57
class SearchSuggestionsResponse (TypedDict ):
30
58
success : bool
31
59
"""
32
- Indicates whether the translation was successful.
60
+ Whether the search suggestions request was successful
33
61
"""
34
62
35
63
suggestions : List [str ]
64
+ """
65
+ List of search suggestions
66
+ """
36
67
37
68
38
69
class SearchSuggestionsParams (TypedDict ):
@@ -41,26 +72,59 @@ class SearchSuggestionsParams(TypedDict):
41
72
The search value. The maximum query character length is 200.
42
73
"""
43
74
75
+ class DeepResearchConfig (TypedDict ):
76
+ max_depth : NotRequired [int ]
77
+ max_breadth : NotRequired [int ]
78
+ max_output_tokens : NotRequired [int ]
79
+ target_output_tokens : NotRequired [int ]
44
80
45
81
class SearchParams (TypedDict ):
46
82
query : str
47
83
"""
48
- The search value. The maximum query character length is 200.
84
+ The search query string to execute
49
85
"""
50
- ai_overview : NotRequired [bool ] = True
86
+
87
+ spell_check : NotRequired [bool ]
51
88
"""
52
- Include AI powered overview in the search results. The default value is True
89
+ Whether to perform spell checking on the query. Defaults to True.
53
90
"""
54
- safe_search : NotRequired [str ] = "moderate"
91
+
92
+ safe_search : NotRequired [Literal ["strict" , "moderate" , "off" ]]
55
93
"""
56
- Include offensive results in the search results. The default value is "moderate". Supported values: moderate, strict, off
94
+ Safe search filtering level. Can be 'strict', ' moderate', or ' off'
57
95
"""
58
- spell_check : NotRequired [bool ] = True
96
+
97
+ ai_overview : NotRequired [bool ]
59
98
"""
60
- Spell check the search query .
99
+ Whether to generate an AI-powered overview of the search results. Defaults to True .
61
100
"""
62
101
63
102
byo_urls : NotRequired [List [str ]]
103
+ """
104
+ List of custom URLs to include in the search results
105
+ """
106
+
107
+ country_code : NotRequired [str ]
108
+ """
109
+ Two-letter country code to localize search results (e.g. 'US', 'GB')
110
+ """
111
+
112
+ auto_scrape : bool
113
+ """
114
+ Whether to automatically scrape content from search result URLs
115
+ """
116
+
117
+ deep_research : NotRequired [bool ]
118
+ """
119
+ Enable deep research mode for more comprehensive results
120
+ """
121
+
122
+ deep_research_config : NotRequired [DeepResearchConfig ]
123
+ """
124
+ Configuration options for deep research mode
125
+ """
126
+
127
+
64
128
65
129
66
130
class Search (ClientConfig ):
0 commit comments