Skip to content

Commit 1a8a84b

Browse files
fix: Added max_results and updated search params.
1 parent 0ea52a3 commit 1a8a84b

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

jigsawstack/search.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ class SearchParams(TypedDict):
193193
Whether to perform spell checking on the query. Defaults to True.
194194
"""
195195

196+
max_results: NotRequired[int]
197+
"""
198+
Maximum number of search results to return.
199+
"""
200+
196201
safe_search: NotRequired[Literal["strict", "moderate", "off"]]
197202
"""
198203
Safe search filtering level. Can be 'strict', 'moderate', or 'off'
@@ -241,14 +246,23 @@ def search(self, params: SearchParams) -> SearchResponse:
241246
safe_search = params.get("safe_search", "moderate")
242247
spell_check = params.get("spell_check", "True")
243248

244-
body = {
249+
body: Dict[str, Any] = {
245250
"byo_urls": params.get("byo_urls", []),
246251
"query": query,
247252
"ai_overview": ai_overview,
248253
"safe_search": safe_search,
249254
"spell_check": spell_check,
250255
}
251256

257+
if "max_results" in params:
258+
body["max_results"] = params["max_results"]
259+
260+
if "country_code" in params:
261+
body["country_code"] = params["country_code"]
262+
263+
if "auto_scrape" in params:
264+
body["auto_scrape"] = params["auto_scrape"]
265+
252266
path = "/web/search"
253267
resp = Request(
254268
config=self.config,
@@ -304,13 +318,23 @@ async def search(self, params: SearchParams) -> SearchResponse:
304318
safe_search = params.get("safe_search", "moderate")
305319
spell_check = params.get("spell_check", "True")
306320

307-
body = {
321+
body: Dict[str, Any] = {
308322
"byo_urls": params.get("byo_urls", []),
309323
"query": query,
310324
"ai_overview": ai_overview,
311325
"safe_search": safe_search,
312326
"spell_check": spell_check,
313327
}
328+
329+
if "max_results" in params:
330+
body["max_results"] = params["max_results"]
331+
332+
if "country_code" in params:
333+
body["country_code"] = params["country_code"]
334+
335+
if "auto_scrape" in params:
336+
body["auto_scrape"] = params["auto_scrape"]
337+
314338
resp = await AsyncRequest(
315339
config=self.config,
316340
path=path,

0 commit comments

Comments
 (0)