Skip to content

Commit 4ded29c

Browse files
feat(api): Search/Extract v1 with advanced_settings and max_results
1 parent 5836a6f commit 4ded29c

8 files changed

Lines changed: 31 additions & 24 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 23
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/parallel-web%2Fparallel-sdk-44048676c9b07d49ed9dbee5fad53d145eddaea5ba682b6557681c5a7e04f8ed.yml
3-
openapi_spec_hash: e239787937742b1bc15e7f211fe3c518
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/parallel-web%2Fparallel-sdk-7099c3aac2f0edacf413e426c176150404e1603f709cdd1f0af5c6689d33bd4f.yml
3+
openapi_spec_hash: eb61e027506aa339543ce33d7f052046
44
config_hash: fe820a5a10ee48e143c9e49a153b23b4

src/parallel/_client.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def extract(
231231
self,
232232
*,
233233
urls: SequenceNotStr[str],
234-
advanced: Optional[AdvancedExtractSettingsParam] | Omit = omit,
234+
advanced_settings: Optional[AdvancedExtractSettingsParam] | Omit = omit,
235235
client_model: Optional[str] | Omit = omit,
236236
max_chars_total: Optional[int] | Omit = omit,
237237
objective: Optional[str] | Omit = omit,
@@ -249,7 +249,7 @@ def extract(
249249
Args:
250250
urls: URLs to extract content from. Up to 20 URLs.
251251
252-
advanced: Advanced extract configuration.
252+
advanced_settings: Advanced extract configuration.
253253
254254
client_model: The model generating this request and consuming the results. Enables
255255
optimizations and tailors default settings for the model's capabilities.
@@ -278,7 +278,7 @@ def extract(
278278
body=maybe_transform(
279279
{
280280
"urls": urls,
281-
"advanced": advanced,
281+
"advanced_settings": advanced_settings,
282282
"client_model": client_model,
283283
"max_chars_total": max_chars_total,
284284
"objective": objective,
@@ -296,7 +296,7 @@ def search(
296296
self,
297297
*,
298298
search_queries: SequenceNotStr[str],
299-
advanced: Optional[AdvancedSearchSettingsParam] | Omit = omit,
299+
advanced_settings: Optional[AdvancedSearchSettingsParam] | Omit = omit,
300300
client_model: Optional[str] | Omit = omit,
301301
max_chars_total: Optional[int] | Omit = omit,
302302
mode: Optional[Literal["basic", "standard"]] | Omit = omit,
@@ -316,7 +316,7 @@ def search(
316316
provide 2-3 for best results. Used together with objective to focus results on
317317
the most relevant content.
318318
319-
advanced: Advanced search configuration.
319+
advanced_settings: Advanced search configuration.
320320
321321
client_model: The model generating this request and consuming the results. Enables
322322
optimizations and tailors default settings for the model's capabilities.
@@ -327,6 +327,7 @@ def search(
327327
mode: Search mode preset: supported values are basic and standard. Basic mode offers
328328
the lowest latency and works best with 2-3 high-quality search_queries. Standard
329329
mode provides higher quality with more advanced retrieval and compression.
330+
Defaults to standard when omitted.
330331
331332
objective: Natural-language description of the underlying question or goal driving the
332333
search. Used together with search_queries to focus results on the most relevant
@@ -346,7 +347,7 @@ def search(
346347
body=maybe_transform(
347348
{
348349
"search_queries": search_queries,
349-
"advanced": advanced,
350+
"advanced_settings": advanced_settings,
350351
"client_model": client_model,
351352
"max_chars_total": max_chars_total,
352353
"mode": mode,
@@ -556,7 +557,7 @@ async def extract(
556557
self,
557558
*,
558559
urls: SequenceNotStr[str],
559-
advanced: Optional[AdvancedExtractSettingsParam] | Omit = omit,
560+
advanced_settings: Optional[AdvancedExtractSettingsParam] | Omit = omit,
560561
client_model: Optional[str] | Omit = omit,
561562
max_chars_total: Optional[int] | Omit = omit,
562563
objective: Optional[str] | Omit = omit,
@@ -574,7 +575,7 @@ async def extract(
574575
Args:
575576
urls: URLs to extract content from. Up to 20 URLs.
576577
577-
advanced: Advanced extract configuration.
578+
advanced_settings: Advanced extract configuration.
578579
579580
client_model: The model generating this request and consuming the results. Enables
580581
optimizations and tailors default settings for the model's capabilities.
@@ -603,7 +604,7 @@ async def extract(
603604
body=await async_maybe_transform(
604605
{
605606
"urls": urls,
606-
"advanced": advanced,
607+
"advanced_settings": advanced_settings,
607608
"client_model": client_model,
608609
"max_chars_total": max_chars_total,
609610
"objective": objective,
@@ -621,7 +622,7 @@ async def search(
621622
self,
622623
*,
623624
search_queries: SequenceNotStr[str],
624-
advanced: Optional[AdvancedSearchSettingsParam] | Omit = omit,
625+
advanced_settings: Optional[AdvancedSearchSettingsParam] | Omit = omit,
625626
client_model: Optional[str] | Omit = omit,
626627
max_chars_total: Optional[int] | Omit = omit,
627628
mode: Optional[Literal["basic", "standard"]] | Omit = omit,
@@ -641,7 +642,7 @@ async def search(
641642
provide 2-3 for best results. Used together with objective to focus results on
642643
the most relevant content.
643644
644-
advanced: Advanced search configuration.
645+
advanced_settings: Advanced search configuration.
645646
646647
client_model: The model generating this request and consuming the results. Enables
647648
optimizations and tailors default settings for the model's capabilities.
@@ -652,6 +653,7 @@ async def search(
652653
mode: Search mode preset: supported values are basic and standard. Basic mode offers
653654
the lowest latency and works best with 2-3 high-quality search_queries. Standard
654655
mode provides higher quality with more advanced retrieval and compression.
656+
Defaults to standard when omitted.
655657
656658
objective: Natural-language description of the underlying question or goal driving the
657659
search. Used together with search_queries to focus results on the most relevant
@@ -671,7 +673,7 @@ async def search(
671673
body=await async_maybe_transform(
672674
{
673675
"search_queries": search_queries,
674-
"advanced": advanced,
676+
"advanced_settings": advanced_settings,
675677
"client_model": client_model,
676678
"max_chars_total": max_chars_total,
677679
"mode": mode,

src/parallel/resources/beta/findall.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def create(
117117
match_conditions: List of match conditions for the FindAll run.
118118
119119
match_limit: Maximum number of matches to find for this FindAll run. Must be between 5 and
120-
1000 (inclusive).
120+
1000 (inclusive). May return fewer results.
121121
122122
objective: Natural language objective of the FindAll run.
123123
@@ -662,7 +662,7 @@ async def create(
662662
match_conditions: List of match conditions for the FindAll run.
663663
664664
match_limit: Maximum number of matches to find for this FindAll run. Must be between 5 and
665-
1000 (inclusive).
665+
1000 (inclusive). May return fewer results.
666666
667667
objective: Natural language objective of the FindAll run.
668668

src/parallel/types/advanced_search_settings_param.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class AdvancedSearchSettingsParam(TypedDict, total=False):
2424
location: Optional[str]
2525
"""ISO 3166-1 alpha-2 country code for geo-targeted search results."""
2626

27+
max_results: Optional[int]
28+
"""Upper bound on the number of results to return. Defaults to 10 if not provided."""
29+
2730
source_policy: Optional[SourcePolicy]
2831
"""Source policy for web search results.
2932

src/parallel/types/beta/findall_create_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class FindAllCreateParams(TypedDict, total=False):
2525
match_limit: Required[int]
2626
"""Maximum number of matches to find for this FindAll run.
2727
28-
Must be between 5 and 1000 (inclusive).
28+
Must be between 5 and 1000 (inclusive). May return fewer results.
2929
"""
3030

3131
objective: Required[str]

src/parallel/types/client_extract_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ClientExtractParams(TypedDict, total=False):
1515
urls: Required[SequenceNotStr[str]]
1616
"""URLs to extract content from. Up to 20 URLs."""
1717

18-
advanced: Optional[AdvancedExtractSettingsParam]
18+
advanced_settings: Optional[AdvancedExtractSettingsParam]
1919
"""Advanced extract configuration."""
2020

2121
client_model: Optional[str]

src/parallel/types/client_search_params.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ClientSearchParams(TypedDict, total=False):
1919
objective to focus results on the most relevant content.
2020
"""
2121

22-
advanced: Optional[AdvancedSearchSettingsParam]
22+
advanced_settings: Optional[AdvancedSearchSettingsParam]
2323
"""Advanced search configuration."""
2424

2525
client_model: Optional[str]
@@ -39,7 +39,7 @@ class ClientSearchParams(TypedDict, total=False):
3939
4040
Basic mode offers the lowest latency and works best with 2-3 high-quality
4141
search_queries. Standard mode provides higher quality with more advanced
42-
retrieval and compression.
42+
retrieval and compression. Defaults to standard when omitted.
4343
"""
4444

4545
objective: Optional[str]

tests/api_resources/test_client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_method_extract(self, client: Parallel) -> None:
3232
def test_method_extract_with_all_params(self, client: Parallel) -> None:
3333
client_ = client.extract(
3434
urls=["string"],
35-
advanced={
35+
advanced_settings={
3636
"excerpt_settings": {"max_chars_per_result": 0},
3737
"fetch_policy": {
3838
"disable_cache_fallback": True,
@@ -83,14 +83,15 @@ def test_method_search(self, client: Parallel) -> None:
8383
def test_method_search_with_all_params(self, client: Parallel) -> None:
8484
client_ = client.search(
8585
search_queries=["string"],
86-
advanced={
86+
advanced_settings={
8787
"excerpt_settings": {"max_chars_per_result": 0},
8888
"fetch_policy": {
8989
"disable_cache_fallback": True,
9090
"max_age_seconds": 86400,
9191
"timeout_seconds": 60,
9292
},
9393
"location": "us",
94+
"max_results": 0,
9495
"source_policy": {
9596
"after_date": parse_date("2024-01-01"),
9697
"exclude_domains": ["reddit.com", "x.com", ".ai"],
@@ -145,7 +146,7 @@ async def test_method_extract(self, async_client: AsyncParallel) -> None:
145146
async def test_method_extract_with_all_params(self, async_client: AsyncParallel) -> None:
146147
client = await async_client.extract(
147148
urls=["string"],
148-
advanced={
149+
advanced_settings={
149150
"excerpt_settings": {"max_chars_per_result": 0},
150151
"fetch_policy": {
151152
"disable_cache_fallback": True,
@@ -196,14 +197,15 @@ async def test_method_search(self, async_client: AsyncParallel) -> None:
196197
async def test_method_search_with_all_params(self, async_client: AsyncParallel) -> None:
197198
client = await async_client.search(
198199
search_queries=["string"],
199-
advanced={
200+
advanced_settings={
200201
"excerpt_settings": {"max_chars_per_result": 0},
201202
"fetch_policy": {
202203
"disable_cache_fallback": True,
203204
"max_age_seconds": 86400,
204205
"timeout_seconds": 60,
205206
},
206207
"location": "us",
208+
"max_results": 0,
207209
"source_policy": {
208210
"after_date": parse_date("2024-01-01"),
209211
"exclude_domains": ["reddit.com", "x.com", ".ai"],

0 commit comments

Comments
 (0)