Skip to content

Commit 4f86f40

Browse files
committed
update web search params and response
1 parent 0a04e8a commit 4f86f40

File tree

1 file changed

+77
-13
lines changed

1 file changed

+77
-13
lines changed

jigsawstack/search.py

Lines changed: 77 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Union, cast
1+
from typing import Any, Dict, List, Union, cast, Literal
22
from typing_extensions import NotRequired, TypedDict
33
from .request import Request, RequestConfig
44
from .async_request import AsyncRequest, AsyncRequestConfig
@@ -9,30 +9,61 @@
99
class SearchResponse(TypedDict):
1010
success: bool
1111
"""
12-
Indicates whether the translation was successful.
12+
Whether the search request was successful
1313
"""
14-
results: List[Any]
1514

16-
is_safe: bool
15+
query: str
16+
"""
17+
The search query that was used
18+
"""
1719

1820
ai_overview: str
21+
"""
22+
AI-generated overview/summary of the search results
23+
or deep research results if enabled
24+
"""
1925

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+
"""
2140

2241
geo_results: List[Any]
42+
"""
43+
List of location/geographic search results if applicable
44+
"""
2345

2446
image_urls: List[str]
47+
"""
48+
List of image URLs found in the search results
49+
"""
2550

2651
links: List[str]
52+
"""
53+
List of web page URLs found in the search results
54+
"""
2755

2856

2957
class SearchSuggestionsResponse(TypedDict):
3058
success: bool
3159
"""
32-
Indicates whether the translation was successful.
60+
Whether the search suggestions request was successful
3361
"""
3462

3563
suggestions: List[str]
64+
"""
65+
List of search suggestions
66+
"""
3667

3768

3869
class SearchSuggestionsParams(TypedDict):
@@ -41,26 +72,59 @@ class SearchSuggestionsParams(TypedDict):
4172
The search value. The maximum query character length is 200.
4273
"""
4374

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]
4480

4581
class SearchParams(TypedDict):
4682
query: str
4783
"""
48-
The search value. The maximum query character length is 200.
84+
The search query string to execute
4985
"""
50-
ai_overview: NotRequired[bool] = True
86+
87+
spell_check: NotRequired[bool]
5188
"""
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.
5390
"""
54-
safe_search: NotRequired[str] = "moderate"
91+
92+
safe_search: NotRequired[Literal["strict", "moderate", "off"]]
5593
"""
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'
5795
"""
58-
spell_check: NotRequired[bool] = True
96+
97+
ai_overview: NotRequired[bool]
5998
"""
60-
Spell check the search query.
99+
Whether to generate an AI-powered overview of the search results. Defaults to True.
61100
"""
62101

63102
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+
64128

65129

66130
class Search(ClientConfig):

0 commit comments

Comments
 (0)