Skip to content

Commit 7750ac1

Browse files
release: 0.3.3 (#16)
Automated Release PR --- ## 0.3.3 (2025-11-06) Full Changelog: [v0.3.2...v0.3.3](v0.3.2...v0.3.3) ### Features * **api:** add fetch_policy and mode to /v1beta/search ([1d7200a](1d7200a)) ### Bug Fixes * **api:** add back /v1/tasks/runs?=beta ([bdecee5](bdecee5)) * **api:** Make beta headers optional in /v1beta/extract ([bc9e1c2](bc9e1c2)) * **api:** re-add deprecated max_chars_per_result ([e0976a1](e0976a1)) * **api:** re-add deprecated processor to /v1beta/extract ([d656151](d656151)) * **api:** remove full_content from /v1beta/search output ([c13d6db](c13d6db)) * **client:** close streams without requiring full consumption ([e6ba5dc](e6ba5dc)) ### Chores * **internal/tests:** avoid race condition with implicit client cleanup ([4ec359d](4ec359d)) * **internal:** grammar fix (it's -&gt; its) ([fd8a351](fd8a351)) * **lint:** reorder imports ([901e4f1](901e4f1)) --- This pull request is managed by Stainless's [GitHub App](https://github.com/apps/stainless-app). The [semver version number](https://semver.org/#semantic-versioning-specification-semver) is based on included [commit messages](https://www.conventionalcommits.org/en/v1.0.0/). Alternatively, you can manually set the version number in the title of this pull request. For a better experience, it is recommended to use either rebase-merge or squash-merge when merging this pull request. 🔗 Stainless [website](https://www.stainlessapi.com) 📚 Read the [docs](https://app.stainlessapi.com/docs) 🙋 [Reach out](mailto:support@stainlessapi.com) for help or questions --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: Anshul Tomar <anshul@parallel.ai>
1 parent 1dcb41b commit 7750ac1

26 files changed

+399
-250
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.3.2"
2+
".": "0.3.3"
33
}

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 13
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/parallel-web%2Fparallel-sdk-9ec04ca53245a774513f3e178c29a560d6ecb3f88f936859e6311bf0d4ad1fb2.yml
3-
openapi_spec_hash: 022ed0f0e4ad23fd88f8d3a8fe003e14
4-
config_hash: 5c1316cf65d52fe3b23d4fe7acbb4baf
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/parallel-web%2Fparallel-sdk-a2d634b57a8ea2e6392d23d6fcc5d3cbdbb4aac3f372a3553a7d63c3f2fc884e.yml
3+
openapi_spec_hash: 021a33c8bbfe7b052b2d285867be258f
4+
config_hash: 677d555754b79eb922f6bf64bccd9559

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# Changelog
22

3+
## 0.3.3 (2025-11-06)
4+
5+
Full Changelog: [v0.3.2...v0.3.3](https://github.com/parallel-web/parallel-sdk-python/compare/v0.3.2...v0.3.3)
6+
7+
### Features
8+
9+
* **api:** add fetch_policy and mode to /v1beta/search ([1d7200a](https://github.com/parallel-web/parallel-sdk-python/commit/1d7200a56264719ea109e352c3ef0a02609495fd))
10+
11+
12+
### Bug Fixes
13+
14+
* **api:** add back /v1/tasks/runs?=beta ([bdecee5](https://github.com/parallel-web/parallel-sdk-python/commit/bdecee5bfd3811751c340ef4ac38e76cdf264c29))
15+
* **api:** Make beta headers optional in /v1beta/extract ([bc9e1c2](https://github.com/parallel-web/parallel-sdk-python/commit/bc9e1c205267203806d09cf52c0a30482fff40b8))
16+
* **api:** re-add deprecated max_chars_per_result ([e0976a1](https://github.com/parallel-web/parallel-sdk-python/commit/e0976a12f85f88c82d40ee8129963c483d53cf3b))
17+
* **api:** re-add deprecated processor to /v1beta/extract ([d656151](https://github.com/parallel-web/parallel-sdk-python/commit/d6561513ed508f4337b650269090c55eea00d7f9))
18+
* **api:** remove full_content from /v1beta/search output ([c13d6db](https://github.com/parallel-web/parallel-sdk-python/commit/c13d6db25c054a91d0a4c0fa0ad09c051cf0a92a))
19+
* **client:** close streams without requiring full consumption ([e6ba5dc](https://github.com/parallel-web/parallel-sdk-python/commit/e6ba5dc8bb4cc3ad283540e46375e799e5a10cea))
20+
21+
22+
### Chores
23+
24+
* **internal/tests:** avoid race condition with implicit client cleanup ([4ec359d](https://github.com/parallel-web/parallel-sdk-python/commit/4ec359dbc78ec6bf64780fcf7499d684205442a8))
25+
* **internal:** grammar fix (it's -&gt; its) ([fd8a351](https://github.com/parallel-web/parallel-sdk-python/commit/fd8a3518051b452c6e9aff121592c67f60e1be13))
26+
* **lint:** reorder imports ([901e4f1](https://github.com/parallel-web/parallel-sdk-python/commit/901e4f1a5597a662764ce9d4a890d3075f484984))
27+
328
## 0.3.2 (2025-10-22)
429

530
Full Changelog: [v0.3.1...v0.3.2](https://github.com/parallel-web/parallel-sdk-python/compare/v0.3.1...v0.3.2)

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ from parallel.types.beta import (
4747
ExtractResult,
4848
FetchPolicy,
4949
SearchResult,
50+
UsageItem,
5051
WebSearchResult,
5152
)
5253
```

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "parallel-web"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
description = "The official Python library for the Parallel API"
55
dynamic = ["readme"]
66
license = "MIT"

src/parallel/_streaming.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ def __stream__(self) -> Iterator[_T]:
5757
for sse in iterator:
5858
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
5959

60-
# Ensure the entire stream is consumed
61-
for _sse in iterator:
62-
...
60+
# As we might not fully consume the response stream, we need to close it explicitly
61+
response.close()
6362

6463
def __enter__(self) -> Self:
6564
return self
@@ -121,9 +120,8 @@ async def __stream__(self) -> AsyncIterator[_T]:
121120
async for sse in iterator:
122121
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
123122

124-
# Ensure the entire stream is consumed
125-
async for _sse in iterator:
126-
...
123+
# As we might not fully consume the response stream, we need to close it explicitly
124+
await response.aclose()
127125

128126
async def __aenter__(self) -> Self:
129127
return self

src/parallel/_utils/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
133133
# Type safe methods for narrowing types with TypeVars.
134134
# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
135135
# however this cause Pyright to rightfully report errors. As we know we don't
136-
# care about the contained types we can safely use `object` in it's place.
136+
# care about the contained types we can safely use `object` in its place.
137137
#
138138
# There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
139139
# `is_*` is for when you're dealing with an unknown input

src/parallel/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "parallel"
4-
__version__ = "0.3.2" # x-release-please-version
4+
__version__ = "0.3.3" # x-release-please-version

src/parallel/resources/beta/beta.py

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from ...types.beta.extract_response import ExtractResponse
4141
from ...types.beta.fetch_policy_param import FetchPolicyParam
4242
from ...types.beta.parallel_beta_param import ParallelBetaParam
43+
from ...types.beta.excerpt_settings_param import ExcerptSettingsParam
4344
from ...types.shared_params.source_policy import SourcePolicy
4445

4546
__all__ = ["BetaResource", "AsyncBetaResource"]
@@ -101,10 +102,7 @@ def extract(
101102
Note that if neither objective nor search_queries is provided, excerpts are
102103
redundant with full content.
103104
104-
fetch_policy: Fetch policy.
105-
106-
Determines when to return content from the cache (faster) vs fetching live
107-
content (fresher).
105+
fetch_policy: Policy for live fetching web results.
108106
109107
full_content: Include full content from each URL. Note that if neither objective nor
110108
search_queries is provided, excerpts are redundant with full content.
@@ -156,8 +154,11 @@ def extract(
156154
def search(
157155
self,
158156
*,
157+
excerpts: ExcerptSettingsParam | Omit = omit,
158+
fetch_policy: Optional[FetchPolicyParam] | Omit = omit,
159159
max_chars_per_result: Optional[int] | Omit = omit,
160160
max_results: Optional[int] | Omit = omit,
161+
mode: Optional[Literal["one-shot", "agentic"]] | Omit = omit,
161162
objective: Optional[str] | Omit = omit,
162163
processor: Optional[Literal["base", "pro"]] | Omit = omit,
163164
search_queries: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -173,18 +174,29 @@ def search(
173174
"""
174175
Searches the web.
175176
177+
To access this endpoint, pass the `parallel-beta` header with the value
178+
`search-extract-2025-10-10`.
179+
176180
Args:
177-
max_chars_per_result: Upper bound on the number of characters to include in excerpts for each search
178-
result.
181+
excerpts: Optional settings for returning relevant excerpts.
182+
183+
fetch_policy: Policy for live fetching web results.
184+
185+
max_chars_per_result: DEPRECATED: Use `excerpts.max_chars_per_result` instead.
179186
180187
max_results: Upper bound on the number of results to return. May be limited by the processor.
181188
Defaults to 10 if not provided.
182189
190+
mode: Presets default values for parameters for different use cases. `one-shot`
191+
returns more comprehensive results and longer excerpts to answer questions from
192+
a single response, while `agentic` returns more concise, token-efficient results
193+
for use in an agentic loop.
194+
183195
objective: Natural-language description of what the web search is trying to find. May
184196
include guidance about preferred sources or freshness. At least one of objective
185197
or search_queries must be provided.
186198
187-
processor: Search processor.
199+
processor: DEPRECATED: use `mode` instead.
188200
189201
search_queries: Optional list of traditional keyword search queries to guide the search. May
190202
contain search operators. At least one of objective or search_queries must be
@@ -219,8 +231,11 @@ def search(
219231
"/v1beta/search",
220232
body=maybe_transform(
221233
{
234+
"excerpts": excerpts,
235+
"fetch_policy": fetch_policy,
222236
"max_chars_per_result": max_chars_per_result,
223237
"max_results": max_results,
238+
"mode": mode,
224239
"objective": objective,
225240
"processor": processor,
226241
"search_queries": search_queries,
@@ -291,10 +306,7 @@ async def extract(
291306
Note that if neither objective nor search_queries is provided, excerpts are
292307
redundant with full content.
293308
294-
fetch_policy: Fetch policy.
295-
296-
Determines when to return content from the cache (faster) vs fetching live
297-
content (fresher).
309+
fetch_policy: Policy for live fetching web results.
298310
299311
full_content: Include full content from each URL. Note that if neither objective nor
300312
search_queries is provided, excerpts are redundant with full content.
@@ -346,8 +358,11 @@ async def extract(
346358
async def search(
347359
self,
348360
*,
361+
excerpts: ExcerptSettingsParam | Omit = omit,
362+
fetch_policy: Optional[FetchPolicyParam] | Omit = omit,
349363
max_chars_per_result: Optional[int] | Omit = omit,
350364
max_results: Optional[int] | Omit = omit,
365+
mode: Optional[Literal["one-shot", "agentic"]] | Omit = omit,
351366
objective: Optional[str] | Omit = omit,
352367
processor: Optional[Literal["base", "pro"]] | Omit = omit,
353368
search_queries: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -363,18 +378,29 @@ async def search(
363378
"""
364379
Searches the web.
365380
381+
To access this endpoint, pass the `parallel-beta` header with the value
382+
`search-extract-2025-10-10`.
383+
366384
Args:
367-
max_chars_per_result: Upper bound on the number of characters to include in excerpts for each search
368-
result.
385+
excerpts: Optional settings for returning relevant excerpts.
386+
387+
fetch_policy: Policy for live fetching web results.
388+
389+
max_chars_per_result: DEPRECATED: Use `excerpts.max_chars_per_result` instead.
369390
370391
max_results: Upper bound on the number of results to return. May be limited by the processor.
371392
Defaults to 10 if not provided.
372393
394+
mode: Presets default values for parameters for different use cases. `one-shot`
395+
returns more comprehensive results and longer excerpts to answer questions from
396+
a single response, while `agentic` returns more concise, token-efficient results
397+
for use in an agentic loop.
398+
373399
objective: Natural-language description of what the web search is trying to find. May
374400
include guidance about preferred sources or freshness. At least one of objective
375401
or search_queries must be provided.
376402
377-
processor: Search processor.
403+
processor: DEPRECATED: use `mode` instead.
378404
379405
search_queries: Optional list of traditional keyword search queries to guide the search. May
380406
contain search operators. At least one of objective or search_queries must be
@@ -409,8 +435,11 @@ async def search(
409435
"/v1beta/search",
410436
body=await async_maybe_transform(
411437
{
438+
"excerpts": excerpts,
439+
"fetch_policy": fetch_policy,
412440
"max_chars_per_result": max_chars_per_result,
413441
"max_results": max_results,
442+
"mode": mode,
414443
"objective": objective,
415444
"processor": processor,
416445
"search_queries": search_queries,

src/parallel/types/beta/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from .webhook import Webhook as Webhook
66
from .mcp_server import McpServer as McpServer
77
from .task_group import TaskGroup as TaskGroup
8+
from .usage_item import UsageItem as UsageItem
89
from .error_event import ErrorEvent as ErrorEvent
910
from .extract_error import ExtractError as ExtractError
1011
from .mcp_tool_call import McpToolCall as McpToolCall

0 commit comments

Comments
 (0)