Skip to content

Commit bafa464

Browse files
feat(api): Update excerpt settings
1 parent 5588224 commit bafa464

30 files changed

+115
-365
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 22
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/parallel-web%2Fparallel-sdk-70ca78f3dbacd1f8145c633b64c2d9eec9f390db6110ce98705427248a22f19f.yml
3-
openapi_spec_hash: 877617cbe6e7a48410632dbb57ff5488
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/parallel-web%2Fparallel-sdk-e6afa27fc86492ffa6ee5f929f2d1eb8166750c3a9652a393aede2ca467c49ef.yml
3+
openapi_spec_hash: 12e9b47405451f5286c199d7ee26c3cc
44
config_hash: 6a16116c579cf9a3739083c24b10534d

api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,14 @@ from parallel.types.beta import (
119119
FindallSchema,
120120
FindallSchemaUpdatedEvent,
121121
IngestInput,
122-
FindallRetrieveResponse,
123122
FindallEventsResponse,
124123
)
125124
```
126125

127126
Methods:
128127

129128
- <code title="post /v1beta/findall/runs">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">create</a>(\*\*<a href="src/parallel/types/beta/findall_create_params.py">params</a>) -> <a href="./src/parallel/types/beta/findall_run.py">FindallRun</a></code>
130-
- <code title="get /v1beta/findall/runs/{findall_id}">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">retrieve</a>(findall_id) -> <a href="./src/parallel/types/beta/findall_retrieve_response.py">FindallRetrieveResponse</a></code>
129+
- <code title="get /v1beta/findall/runs/{findall_id}">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">retrieve</a>(findall_id) -> <a href="./src/parallel/types/beta/findall_run.py">FindallRun</a></code>
131130
- <code title="post /v1beta/findall/runs/{findall_id}/cancel">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">cancel</a>(findall_id) -> object</code>
132131
- <code title="post /v1beta/findall/runs/{findall_id}/enrich">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">enrich</a>(findall_id, \*\*<a href="src/parallel/types/beta/findall_enrich_params.py">params</a>) -> <a href="./src/parallel/types/beta/findall_schema.py">FindallSchema</a></code>
133132
- <code title="get /v1beta/findall/runs/{findall_id}/events">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">events</a>(findall_id, \*\*<a href="src/parallel/types/beta/findall_events_params.py">params</a>) -> <a href="./src/parallel/types/beta/findall_events_response.py">FindallEventsResponse</a></code>

src/parallel/resources/beta/beta.py

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ def extract(
9090
self,
9191
*,
9292
urls: SequenceNotStr[str],
93+
betas: List[ParallelBetaParam],
9394
excerpts: beta_extract_params.Excerpts | Omit = omit,
9495
fetch_policy: Optional[FetchPolicyParam] | Omit = omit,
9596
full_content: beta_extract_params.FullContent | Omit = omit,
9697
objective: Optional[str] | Omit = omit,
9798
search_queries: Optional[SequenceNotStr[str]] | Omit = omit,
98-
betas: List[ParallelBetaParam] | Omit = omit,
9999
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
100100
# The extra values given here take precedence over values defined on the client or passed to this method.
101101
extra_headers: Headers | None = None,
@@ -110,6 +110,8 @@ def extract(
110110
`search-extract-2025-10-10`.
111111
112112
Args:
113+
betas: Optional header to specify the beta version(s) to enable.
114+
113115
excerpts: Include excerpts from each URL relevant to the search objective and queries.
114116
Note that if neither objective nor search_queries is provided, excerpts are
115117
redundant with full content.
@@ -123,8 +125,6 @@ def extract(
123125
124126
search_queries: If provided, focuses extracted content on the specified keyword search queries.
125127
126-
betas: Optional header to specify the beta version(s) to enable.
127-
128128
extra_headers: Send extra headers
129129
130130
extra_query: Add additional query parameters to the request
@@ -134,16 +134,10 @@ def extract(
134134
timeout: Override the client-level default timeout for this request, in seconds
135135
"""
136136
extra_headers = {
137-
**strip_not_given(
138-
{
139-
"parallel-beta": ",".join(chain((str(e) for e in betas), ["search-extract-2025-10-10"]))
140-
if is_given(betas)
141-
else not_given
142-
}
143-
),
137+
"parallel-beta": ",".join(chain((str(e) for e in betas), ["search-extract-2025-10-10"])),
144138
**(extra_headers or {}),
145139
}
146-
extra_headers = {"parallel-beta": "search-extract-2025-10-10", **(extra_headers or {})}
140+
extra_headers.update({"parallel-beta": "search-extract-2025-10-10"})
147141
return self._post(
148142
"/v1beta/extract",
149143
body=maybe_transform(
@@ -190,7 +184,7 @@ def search(
190184
`search-extract-2025-10-10`.
191185
192186
Args:
193-
excerpts: Optional settings for returning relevant excerpts.
187+
excerpts: Optional settings to configure excerpt generation.
194188
195189
fetch_policy: Policy for live fetching web results.
196190
@@ -298,12 +292,12 @@ async def extract(
298292
self,
299293
*,
300294
urls: SequenceNotStr[str],
295+
betas: List[ParallelBetaParam],
301296
excerpts: beta_extract_params.Excerpts | Omit = omit,
302297
fetch_policy: Optional[FetchPolicyParam] | Omit = omit,
303298
full_content: beta_extract_params.FullContent | Omit = omit,
304299
objective: Optional[str] | Omit = omit,
305300
search_queries: Optional[SequenceNotStr[str]] | Omit = omit,
306-
betas: List[ParallelBetaParam] | Omit = omit,
307301
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
308302
# The extra values given here take precedence over values defined on the client or passed to this method.
309303
extra_headers: Headers | None = None,
@@ -318,6 +312,8 @@ async def extract(
318312
`search-extract-2025-10-10`.
319313
320314
Args:
315+
betas: Optional header to specify the beta version(s) to enable.
316+
321317
excerpts: Include excerpts from each URL relevant to the search objective and queries.
322318
Note that if neither objective nor search_queries is provided, excerpts are
323319
redundant with full content.
@@ -331,8 +327,6 @@ async def extract(
331327
332328
search_queries: If provided, focuses extracted content on the specified keyword search queries.
333329
334-
betas: Optional header to specify the beta version(s) to enable.
335-
336330
extra_headers: Send extra headers
337331
338332
extra_query: Add additional query parameters to the request
@@ -342,16 +336,10 @@ async def extract(
342336
timeout: Override the client-level default timeout for this request, in seconds
343337
"""
344338
extra_headers = {
345-
**strip_not_given(
346-
{
347-
"parallel-beta": ",".join(chain((str(e) for e in betas), ["search-extract-2025-10-10"]))
348-
if is_given(betas)
349-
else not_given
350-
}
351-
),
339+
"parallel-beta": ",".join(chain((str(e) for e in betas), ["search-extract-2025-10-10"])),
352340
**(extra_headers or {}),
353341
}
354-
extra_headers = {"parallel-beta": "search-extract-2025-10-10", **(extra_headers or {})}
342+
extra_headers.update({"parallel-beta": "search-extract-2025-10-10"})
355343
return await self._post(
356344
"/v1beta/extract",
357345
body=await async_maybe_transform(
@@ -398,7 +386,7 @@ async def search(
398386
`search-extract-2025-10-10`.
399387
400388
Args:
401-
excerpts: Optional settings for returning relevant excerpts.
389+
excerpts: Optional settings to configure excerpt generation.
402390
403391
fetch_policy: Policy for live fetching web results.
404392

src/parallel/resources/beta/findall.py

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
from ...types.beta.findall_run_result import FindallRunResult
3636
from ...types.beta.parallel_beta_param import ParallelBetaParam
3737
from ...types.beta.findall_events_response import FindallEventsResponse
38-
from ...types.beta.findall_retrieve_response import FindallRetrieveResponse
3938

4039
__all__ = ["FindallResource", "AsyncFindallResource"]
4140

@@ -96,11 +95,12 @@ def create(
9695
Args:
9796
entity_type: Type of the entity for the FindAll run.
9897
99-
generator: Generator for the FindAll run.
98+
generator: Generator for the FindAll run. One of base, core, pro, preview.
10099
101100
match_conditions: List of match conditions for the FindAll run.
102101
103-
match_limit: Maximum number of matches to find for this FindAll run.
102+
match_limit: Maximum number of matches to find for this FindAll run. Must be between 5 and
103+
1000 (inclusive).
104104
105105
objective: Natural language objective of the FindAll run.
106106
@@ -163,7 +163,7 @@ def retrieve(
163163
extra_query: Query | None = None,
164164
extra_body: Body | None = None,
165165
timeout: float | httpx.Timeout | None | NotGiven = not_given,
166-
) -> FindallRetrieveResponse:
166+
) -> FindallRun:
167167
"""
168168
Retrieve a FindAll run.
169169
@@ -191,17 +191,12 @@ def retrieve(
191191
**(extra_headers or {}),
192192
}
193193
extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})}
194-
return cast(
195-
FindallRetrieveResponse,
196-
self._get(
197-
f"/v1beta/findall/runs/{findall_id}",
198-
options=make_request_options(
199-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
200-
),
201-
cast_to=cast(
202-
Any, FindallRetrieveResponse
203-
), # Union types cannot be passed in as arguments in the type system
194+
return self._get(
195+
f"/v1beta/findall/runs/{findall_id}",
196+
options=make_request_options(
197+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
204198
),
199+
cast_to=FindallRun,
205200
)
206201

207202
def cancel(
@@ -270,7 +265,7 @@ def enrich(
270265
Add an enrichment to a FindAll run.
271266
272267
Args:
273-
output_schema: JSON schema for a task input or output.
268+
output_schema: JSON schema for the enrichment output schema for the FindAll run.
274269
275270
mcp_servers: List of MCP servers to use for the task.
276271
@@ -641,11 +636,12 @@ async def create(
641636
Args:
642637
entity_type: Type of the entity for the FindAll run.
643638
644-
generator: Generator for the FindAll run.
639+
generator: Generator for the FindAll run. One of base, core, pro, preview.
645640
646641
match_conditions: List of match conditions for the FindAll run.
647642
648-
match_limit: Maximum number of matches to find for this FindAll run.
643+
match_limit: Maximum number of matches to find for this FindAll run. Must be between 5 and
644+
1000 (inclusive).
649645
650646
objective: Natural language objective of the FindAll run.
651647
@@ -708,7 +704,7 @@ async def retrieve(
708704
extra_query: Query | None = None,
709705
extra_body: Body | None = None,
710706
timeout: float | httpx.Timeout | None | NotGiven = not_given,
711-
) -> FindallRetrieveResponse:
707+
) -> FindallRun:
712708
"""
713709
Retrieve a FindAll run.
714710
@@ -736,17 +732,12 @@ async def retrieve(
736732
**(extra_headers or {}),
737733
}
738734
extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})}
739-
return cast(
740-
FindallRetrieveResponse,
741-
await self._get(
742-
f"/v1beta/findall/runs/{findall_id}",
743-
options=make_request_options(
744-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
745-
),
746-
cast_to=cast(
747-
Any, FindallRetrieveResponse
748-
), # Union types cannot be passed in as arguments in the type system
735+
return await self._get(
736+
f"/v1beta/findall/runs/{findall_id}",
737+
options=make_request_options(
738+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
749739
),
740+
cast_to=FindallRun,
750741
)
751742

752743
async def cancel(
@@ -815,7 +806,7 @@ async def enrich(
815806
Add an enrichment to a FindAll run.
816807
817808
Args:
818-
output_schema: JSON schema for a task input or output.
809+
output_schema: JSON schema for the enrichment output schema for the FindAll run.
819810
820811
mcp_servers: List of MCP servers to use for the task.
821812

src/parallel/types/beta/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
from .task_group_create_params import TaskGroupCreateParams as TaskGroupCreateParams
4343
from .task_group_events_params import TaskGroupEventsParams as TaskGroupEventsParams
4444
from .task_run_events_response import TaskRunEventsResponse as TaskRunEventsResponse
45-
from .findall_retrieve_response import FindallRetrieveResponse as FindallRetrieveResponse
4645
from .task_group_add_runs_params import TaskGroupAddRunsParams as TaskGroupAddRunsParams
4746
from .task_group_events_response import TaskGroupEventsResponse as TaskGroupEventsResponse
4847
from .task_group_get_runs_params import TaskGroupGetRunsParams as TaskGroupGetRunsParams

src/parallel/types/beta/beta_extract_params.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
class BetaExtractParams(TypedDict, total=False):
1818
urls: Required[SequenceNotStr[str]]
1919

20+
betas: Required[Annotated[List[ParallelBetaParam], PropertyInfo(alias="parallel-beta")]]
21+
"""Optional header to specify the beta version(s) to enable."""
22+
2023
excerpts: Excerpts
2124
"""Include excerpts from each URL relevant to the search objective and queries.
2225
@@ -40,9 +43,6 @@ class BetaExtractParams(TypedDict, total=False):
4043
search_queries: Optional[SequenceNotStr[str]]
4144
"""If provided, focuses extracted content on the specified keyword search queries."""
4245

43-
betas: Annotated[List[ParallelBetaParam], PropertyInfo(alias="parallel-beta")]
44-
"""Optional header to specify the beta version(s) to enable."""
45-
4646

4747
Excerpts: TypeAlias = Union[bool, ExcerptSettingsParam]
4848

src/parallel/types/beta/beta_search_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class BetaSearchParams(TypedDict, total=False):
1919
excerpts: ExcerptSettingsParam
20-
"""Optional settings for returning relevant excerpts."""
20+
"""Optional settings to configure excerpt generation."""
2121

2222
fetch_policy: Optional[FetchPolicyParam]
2323
"""Policy for live fetching web results."""

src/parallel/types/beta/beta_task_run_result.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414

1515
class OutputBetaTaskRunTextOutput(BaseModel):
1616
basis: List[FieldBasis]
17-
"""Basis for the output."""
17+
"""Basis for the output.
18+
19+
To include per-list-element basis entries, send the `parallel-beta` header with
20+
the value `field-basis-2025-11-25` when creating the run.
21+
"""
1822

1923
content: str
2024
"""Text output from the task."""
@@ -34,7 +38,11 @@ class OutputBetaTaskRunTextOutput(BaseModel):
3438

3539
class OutputBetaTaskRunJsonOutput(BaseModel):
3640
basis: List[FieldBasis]
37-
"""Basis for the output."""
41+
"""Basis for the output.
42+
43+
To include per-list-element basis entries, send the `parallel-beta` header with
44+
the value `field-basis-2025-11-25` when creating the run.
45+
"""
3846

3947
content: Dict[str, object]
4048
"""
@@ -71,4 +79,4 @@ class BetaTaskRunResult(BaseModel):
7179
"""Output from the task conforming to the output schema."""
7280

7381
run: TaskRun
74-
"""Status of a task run."""
82+
"""Beta task run object with status 'completed'."""

src/parallel/types/beta/error_event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class ErrorEvent(BaseModel):
1212
error: ErrorObject
13-
"""An error message."""
13+
"""Error."""
1414

1515
type: Literal["error"]
1616
"""Event type; always 'error'."""

src/parallel/types/beta/excerpt_settings_param.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,13 @@ class ExcerptSettingsParam(TypedDict, total=False):
1313
"""Optional upper bound on the total number of characters to include per url.
1414
1515
Excerpts may contain fewer characters than this limit to maximize relevance and
16-
token efficiency.
16+
token efficiency, but will never contain fewer than 1000 characters per result.
17+
"""
18+
19+
max_chars_total: Optional[int]
20+
"""
21+
Optional upper bound on the total number of characters to include across all
22+
urls. Results may contain fewer characters than this limit to maximize relevance
23+
and token efficiency, but will never contain fewer than 1000 characters per
24+
result.This overall limit applies in addition to max_chars_per_result.
1725
"""

0 commit comments

Comments
 (0)