diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bf7b733..da59f99 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.4" + ".": "0.4.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 49c5eaf..59e1516 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/parallel-web%2Fparallel-sdk-70ca78f3dbacd1f8145c633b64c2d9eec9f390db6110ce98705427248a22f19f.yml -openapi_spec_hash: 877617cbe6e7a48410632dbb57ff5488 -config_hash: 6a16116c579cf9a3739083c24b10534d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/parallel-web%2Fparallel-sdk-105d778ad64daf94bc1a8b074c609be5200c570c8a3e9fb646d418d572083dac.yml +openapi_spec_hash: b5d7390ed05ec6f332a1a91266a74ac3 +config_hash: a398d153133d8884bed4e5256a0ae818 diff --git a/CHANGELOG.md b/CHANGELOG.md index 63af32c..8dfd0b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ # Changelog +## 0.4.0 (2026-01-13) + +Full Changelog: [v0.3.4...v0.4.0](https://github.com/parallel-web/parallel-sdk-python/compare/v0.3.4...v0.4.0) + +### Features + +* **api:** add after_date, update findAll nomenclature ([3641ac6](https://github.com/parallel-web/parallel-sdk-python/commit/3641ac619abdf3f0acd9085c515f3bed19c9bdd2)) +* **api:** Update excerpt settings ([bafa464](https://github.com/parallel-web/parallel-sdk-python/commit/bafa464c3f124690387410b0d17bf8a1253e8e63)) + + +### Bug Fixes + +* ensure streams are always closed ([3251033](https://github.com/parallel-web/parallel-sdk-python/commit/325103322362df0fe730362841dbc0d4b3a60c18)) +* **types:** allow pyright to infer TypedDict types within SequenceNotStr ([f134f9b](https://github.com/parallel-web/parallel-sdk-python/commit/f134f9bf488bdcd80088fc7752b5d33d84fcca66)) +* use async_to_httpx_files in patch method ([b147da5](https://github.com/parallel-web/parallel-sdk-python/commit/b147da50e3d4b13868908c5c40e0ddecc5489e19)) + + +### Chores + +* add missing docstrings ([05118fc](https://github.com/parallel-web/parallel-sdk-python/commit/05118fc081e6907ac0cdde365e5ed364f49b769c)) +* add Python 3.14 classifier and testing ([5588224](https://github.com/parallel-web/parallel-sdk-python/commit/558822483f60eb430a795e0ee5c6ac780c5f56c1)) +* **api:** update default headers ([16949bf](https://github.com/parallel-web/parallel-sdk-python/commit/16949bfab087cf2f6e6e4f2dc3a503a4a7fa285f)) +* **deps:** mypy 1.18.1 has a regression, pin to 1.17 ([e327c6e](https://github.com/parallel-web/parallel-sdk-python/commit/e327c6e2ba27b3dd565c3f36537643889b4c43e8)) +* **docs:** use environment variables for authentication in code snippets ([e44bc95](https://github.com/parallel-web/parallel-sdk-python/commit/e44bc9528e5e16f243aa8dee4633730d2899c72d)) +* **internal:** add `--fix` argument to lint script ([8b25ed1](https://github.com/parallel-web/parallel-sdk-python/commit/8b25ed10edef5697bce6bc74a3f628029da28d12)) +* **internal:** add missing files argument to base client ([9bc7dc6](https://github.com/parallel-web/parallel-sdk-python/commit/9bc7dc653a4f75da0c5af3297170a16b1df91875)) +* **internal:** codegen related update ([2eb1adc](https://github.com/parallel-web/parallel-sdk-python/commit/2eb1adc9884c03202107eb5987b6ea0717dd3a6a)) +* speedup initial import ([2927603](https://github.com/parallel-web/parallel-sdk-python/commit/2927603782bc242da5b6d7622963452dd24154e7)) +* update lockfile ([37bb7a6](https://github.com/parallel-web/parallel-sdk-python/commit/37bb7a6d321646946f52d37455fc5ad1a2458154)) + ## 0.3.4 (2025-11-12) Full Changelog: [v0.3.3...v0.3.4](https://github.com/parallel-web/parallel-sdk-python/compare/v0.3.3...v0.3.4) diff --git a/LICENSE b/LICENSE index 50d0ab1..5083166 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2025 Parallel +Copyright 2026 Parallel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/api.md b/api.md index f5f5456..e00a252 100644 --- a/api.md +++ b/api.md @@ -103,35 +103,34 @@ Methods: - client.beta.task_group.events(task_group_id, \*\*params) -> TaskGroupEventsResponse - client.beta.task_group.get_runs(task_group_id, \*\*params) -> TaskGroupGetRunsResponse -## Findall +## FindAll Types: ```python from parallel.types.beta import ( - FindallCandidateMatchStatusEvent, - FindallEnrichInput, - FindallExtendInput, - FindallRun, - FindallRunInput, - FindallRunResult, - FindallRunStatusEvent, - FindallSchema, - FindallSchemaUpdatedEvent, + FindAllCandidateMatchStatusEvent, + FindAllEnrichInput, + FindAllExtendInput, + FindAllRun, + FindAllRunInput, + FindAllRunResult, + FindAllRunStatusEvent, + FindAllSchema, + FindAllSchemaUpdatedEvent, IngestInput, - FindallRetrieveResponse, - FindallEventsResponse, + FindAllEventsResponse, ) ``` Methods: -- client.beta.findall.create(\*\*params) -> FindallRun -- client.beta.findall.retrieve(findall_id) -> FindallRetrieveResponse +- client.beta.findall.create(\*\*params) -> FindAllRun +- client.beta.findall.retrieve(findall_id) -> FindAllRun - client.beta.findall.cancel(findall_id) -> object -- client.beta.findall.enrich(findall_id, \*\*params) -> FindallSchema -- client.beta.findall.events(findall_id, \*\*params) -> FindallEventsResponse -- client.beta.findall.extend(findall_id, \*\*params) -> FindallSchema -- client.beta.findall.ingest(\*\*params) -> FindallSchema -- client.beta.findall.result(findall_id) -> FindallRunResult -- client.beta.findall.schema(findall_id) -> FindallSchema +- client.beta.findall.enrich(findall_id, \*\*params) -> FindAllSchema +- client.beta.findall.events(findall_id, \*\*params) -> FindAllEventsResponse +- client.beta.findall.extend(findall_id, \*\*params) -> FindAllSchema +- client.beta.findall.ingest(\*\*params) -> FindAllSchema +- client.beta.findall.result(findall_id) -> FindAllRunResult +- client.beta.findall.schema(findall_id) -> FindAllSchema diff --git a/pyproject.toml b/pyproject.toml index 8d35e5f..d2da7dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,20 +1,22 @@ [project] name = "parallel-web" -version = "0.3.4" +version = "0.4.0" description = "The official Python library for the Parallel API" dynamic = ["readme"] license = "MIT" authors = [ { name = "Parallel", email = "support@parallel.ai" }, ] + dependencies = [ - "httpx>=0.23.0, <1", - "pydantic>=1.9.0, <3", - "typing-extensions>=4.10, <5", - "anyio>=3.5.0, <5", - "distro>=1.7.0, <2", - "sniffio", + "httpx>=0.23.0, <1", + "pydantic>=1.9.0, <3", + "typing-extensions>=4.10, <5", + "anyio>=3.5.0, <5", + "distro>=1.7.0, <2", + "sniffio", ] + requires-python = ">= 3.9" classifiers = [ "Typing :: Typed", @@ -24,6 +26,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Operating System :: OS Independent", "Operating System :: POSIX", "Operating System :: MacOS", @@ -45,7 +48,7 @@ managed = true # version pins are in requirements-dev.lock dev-dependencies = [ "pyright==1.1.399", - "mypy", + "mypy==1.17", "respx", "pytest", "pytest-asyncio", diff --git a/requirements-dev.lock b/requirements-dev.lock index 6192af5..6b24ce1 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,45 +12,50 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.12.8 +aiohttp==3.13.2 # via httpx-aiohttp # via parallel-web -aiosignal==1.3.2 +aiosignal==1.4.0 # via aiohttp -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic -anyio==4.4.0 +anyio==4.12.0 # via httpx # via parallel-web -argcomplete==3.1.2 +argcomplete==3.6.3 # via nox async-timeout==5.0.1 # via aiohttp -attrs==25.3.0 +attrs==25.4.0 # via aiohttp -certifi==2023.7.22 + # via nox +backports-asyncio-runner==1.2.0 + # via pytest-asyncio +certifi==2025.11.12 # via httpcore # via httpx colorama==0.4.6 # via griffe -colorlog==6.7.0 +colorlog==6.10.1 + # via nox +dependency-groups==1.3.1 # via nox -dirty-equals==0.6.0 -distlib==0.3.7 +dirty-equals==0.11 +distlib==0.4.0 # via virtualenv -distro==1.8.0 +distro==1.9.0 # via parallel-web -exceptiongroup==1.2.2 +exceptiongroup==1.3.1 # via anyio # via pytest -execnet==2.1.1 +execnet==2.1.2 # via pytest-xdist -filelock==3.12.4 +filelock==3.19.1 # via virtualenv -frozenlist==1.6.2 +frozenlist==1.8.0 # via aiohttp # via aiosignal -griffe==1.13.0 +griffe==1.14.0 h11==0.16.0 # via httpcore httpcore==1.0.9 @@ -61,80 +66,87 @@ httpx==0.28.1 # via respx httpx-aiohttp==0.1.9 # via parallel-web -idna==3.4 +humanize==4.13.0 + # via nox +idna==3.11 # via anyio # via httpx # via yarl -importlib-metadata==7.0.0 -iniconfig==2.0.0 +importlib-metadata==8.7.0 +iniconfig==2.1.0 # via pytest markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -multidict==6.4.4 +multidict==6.7.0 # via aiohttp # via yarl -mypy==1.14.1 -mypy-extensions==1.0.0 +mypy==1.17.0 +mypy-extensions==1.1.0 # via mypy -nodeenv==1.8.0 +nodeenv==1.9.1 # via pyright -nox==2023.4.22 -packaging==23.2 +nox==2025.11.12 +packaging==25.0 + # via dependency-groups # via nox # via pytest -platformdirs==3.11.0 +pathspec==0.12.1 + # via mypy +platformdirs==4.4.0 # via virtualenv -pluggy==1.5.0 +pluggy==1.6.0 # via pytest -propcache==0.3.1 +propcache==0.4.1 # via aiohttp # via yarl -pydantic==2.11.9 +pydantic==2.12.5 # via parallel-web -pydantic-core==2.33.2 +pydantic-core==2.41.5 # via pydantic -pygments==2.18.0 +pygments==2.19.2 + # via pytest # via rich pyright==1.1.399 -pytest==8.3.3 +pytest==8.4.2 # via pytest-asyncio # via pytest-xdist -pytest-asyncio==0.24.0 -pytest-xdist==3.7.0 -python-dateutil==2.8.2 +pytest-asyncio==1.2.0 +pytest-xdist==3.8.0 +python-dateutil==2.9.0.post0 # via time-machine -pytz==2023.3.post1 - # via dirty-equals respx==0.22.0 -rich==13.7.1 -ruff==0.9.4 -setuptools==68.2.2 - # via nodeenv -six==1.16.0 +rich==14.2.0 +ruff==0.14.7 +six==1.17.0 # via python-dateutil -sniffio==1.3.0 - # via anyio +sniffio==1.3.1 # via parallel-web -time-machine==2.9.0 -tomli==2.0.2 +time-machine==2.19.0 +tomli==2.3.0 + # via dependency-groups # via mypy + # via nox # via pytest -typing-extensions==4.12.2 +typing-extensions==4.15.0 + # via aiosignal # via anyio + # via exceptiongroup # via multidict # via mypy # via parallel-web # via pydantic # via pydantic-core # via pyright + # via pytest-asyncio # via typing-inspection -typing-inspection==0.4.1 + # via virtualenv +typing-inspection==0.4.2 # via pydantic -virtualenv==20.24.5 +virtualenv==20.35.4 # via nox -yarl==1.20.0 +yarl==1.22.0 # via aiohttp -zipp==3.17.0 +zipp==3.23.0 # via importlib-metadata diff --git a/requirements.lock b/requirements.lock index dfc4717..12e9e32 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,28 +12,28 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.12.8 +aiohttp==3.13.2 # via httpx-aiohttp # via parallel-web -aiosignal==1.3.2 +aiosignal==1.4.0 # via aiohttp -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic -anyio==4.4.0 +anyio==4.12.0 # via httpx # via parallel-web async-timeout==5.0.1 # via aiohttp -attrs==25.3.0 +attrs==25.4.0 # via aiohttp -certifi==2023.7.22 +certifi==2025.11.12 # via httpcore # via httpx -distro==1.8.0 +distro==1.9.0 # via parallel-web -exceptiongroup==1.2.2 +exceptiongroup==1.3.1 # via anyio -frozenlist==1.6.2 +frozenlist==1.8.0 # via aiohttp # via aiosignal h11==0.16.0 @@ -45,31 +45,32 @@ httpx==0.28.1 # via parallel-web httpx-aiohttp==0.1.9 # via parallel-web -idna==3.4 +idna==3.11 # via anyio # via httpx # via yarl -multidict==6.4.4 +multidict==6.7.0 # via aiohttp # via yarl -propcache==0.3.1 +propcache==0.4.1 # via aiohttp # via yarl -pydantic==2.11.9 +pydantic==2.12.5 # via parallel-web -pydantic-core==2.33.2 +pydantic-core==2.41.5 # via pydantic -sniffio==1.3.0 - # via anyio +sniffio==1.3.1 # via parallel-web -typing-extensions==4.12.2 +typing-extensions==4.15.0 + # via aiosignal # via anyio + # via exceptiongroup # via multidict # via parallel-web # via pydantic # via pydantic-core # via typing-inspection -typing-inspection==0.4.1 +typing-inspection==0.4.2 # via pydantic -yarl==1.20.0 +yarl==1.22.0 # via aiohttp diff --git a/scripts/lint b/scripts/lint index 1a961b7..5deb42d 100755 --- a/scripts/lint +++ b/scripts/lint @@ -4,8 +4,13 @@ set -e cd "$(dirname "$0")/.." -echo "==> Running lints" -rye run lint +if [ "$1" = "--fix" ]; then + echo "==> Running lints with --fix" + rye run fix:ruff +else + echo "==> Running lints" + rye run lint +fi echo "==> Making sure it imports" rye run python -c 'import parallel' diff --git a/src/parallel/_base_client.py b/src/parallel/_base_client.py index 97eea99..d7b9c23 100644 --- a/src/parallel/_base_client.py +++ b/src/parallel/_base_client.py @@ -1247,9 +1247,12 @@ def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + opts = FinalRequestOptions.construct( + method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + ) return self.request(cast_to, opts) def put( @@ -1767,9 +1770,12 @@ async def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + opts = FinalRequestOptions.construct( + method="patch", url=path, json_data=body, files=await async_to_httpx_files(files), **options + ) return await self.request(cast_to, opts) async def put( diff --git a/src/parallel/_client.py b/src/parallel/_client.py index 9580c5c..0e076cb 100644 --- a/src/parallel/_client.py +++ b/src/parallel/_client.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Mapping +from typing import TYPE_CHECKING, Any, Mapping from typing_extensions import Self, override import httpx @@ -20,8 +20,8 @@ not_given, ) from ._utils import is_given, get_async_library +from ._compat import cached_property from ._version import __version__ -from .resources import task_run from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import ParallelError, APIStatusError from ._base_client import ( @@ -29,7 +29,11 @@ SyncAPIClient, AsyncAPIClient, ) -from .resources.beta import beta + +if TYPE_CHECKING: + from .resources import beta, task_run + from .resources.task_run import TaskRunResource, AsyncTaskRunResource + from .resources.beta.beta import BetaResource, AsyncBetaResource __all__ = [ "Timeout", @@ -44,11 +48,6 @@ class Parallel(SyncAPIClient): - task_run: task_run.TaskRunResource - beta: beta.BetaResource - with_raw_response: ParallelWithRawResponse - with_streaming_response: ParallelWithStreamedResponse - # client options api_key: str @@ -103,10 +102,25 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.task_run = task_run.TaskRunResource(self) - self.beta = beta.BetaResource(self) - self.with_raw_response = ParallelWithRawResponse(self) - self.with_streaming_response = ParallelWithStreamedResponse(self) + @cached_property + def task_run(self) -> TaskRunResource: + from .resources.task_run import TaskRunResource + + return TaskRunResource(self) + + @cached_property + def beta(self) -> BetaResource: + from .resources.beta import BetaResource + + return BetaResource(self) + + @cached_property + def with_raw_response(self) -> ParallelWithRawResponse: + return ParallelWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ParallelWithStreamedResponse: + return ParallelWithStreamedResponse(self) @property @override @@ -214,11 +228,6 @@ def _make_status_error( class AsyncParallel(AsyncAPIClient): - task_run: task_run.AsyncTaskRunResource - beta: beta.AsyncBetaResource - with_raw_response: AsyncParallelWithRawResponse - with_streaming_response: AsyncParallelWithStreamedResponse - # client options api_key: str @@ -273,10 +282,25 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.task_run = task_run.AsyncTaskRunResource(self) - self.beta = beta.AsyncBetaResource(self) - self.with_raw_response = AsyncParallelWithRawResponse(self) - self.with_streaming_response = AsyncParallelWithStreamedResponse(self) + @cached_property + def task_run(self) -> AsyncTaskRunResource: + from .resources.task_run import AsyncTaskRunResource + + return AsyncTaskRunResource(self) + + @cached_property + def beta(self) -> AsyncBetaResource: + from .resources.beta import AsyncBetaResource + + return AsyncBetaResource(self) + + @cached_property + def with_raw_response(self) -> AsyncParallelWithRawResponse: + return AsyncParallelWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncParallelWithStreamedResponse: + return AsyncParallelWithStreamedResponse(self) @property @override @@ -384,27 +408,79 @@ def _make_status_error( class ParallelWithRawResponse: + _client: Parallel + def __init__(self, client: Parallel) -> None: - self.task_run = task_run.TaskRunResourceWithRawResponse(client.task_run) - self.beta = beta.BetaResourceWithRawResponse(client.beta) + self._client = client + + @cached_property + def task_run(self) -> task_run.TaskRunResourceWithRawResponse: + from .resources.task_run import TaskRunResourceWithRawResponse + + return TaskRunResourceWithRawResponse(self._client.task_run) + + @cached_property + def beta(self) -> beta.BetaResourceWithRawResponse: + from .resources.beta import BetaResourceWithRawResponse + + return BetaResourceWithRawResponse(self._client.beta) class AsyncParallelWithRawResponse: + _client: AsyncParallel + def __init__(self, client: AsyncParallel) -> None: - self.task_run = task_run.AsyncTaskRunResourceWithRawResponse(client.task_run) - self.beta = beta.AsyncBetaResourceWithRawResponse(client.beta) + self._client = client + + @cached_property + def task_run(self) -> task_run.AsyncTaskRunResourceWithRawResponse: + from .resources.task_run import AsyncTaskRunResourceWithRawResponse + + return AsyncTaskRunResourceWithRawResponse(self._client.task_run) + + @cached_property + def beta(self) -> beta.AsyncBetaResourceWithRawResponse: + from .resources.beta import AsyncBetaResourceWithRawResponse + + return AsyncBetaResourceWithRawResponse(self._client.beta) class ParallelWithStreamedResponse: + _client: Parallel + def __init__(self, client: Parallel) -> None: - self.task_run = task_run.TaskRunResourceWithStreamingResponse(client.task_run) - self.beta = beta.BetaResourceWithStreamingResponse(client.beta) + self._client = client + + @cached_property + def task_run(self) -> task_run.TaskRunResourceWithStreamingResponse: + from .resources.task_run import TaskRunResourceWithStreamingResponse + + return TaskRunResourceWithStreamingResponse(self._client.task_run) + + @cached_property + def beta(self) -> beta.BetaResourceWithStreamingResponse: + from .resources.beta import BetaResourceWithStreamingResponse + + return BetaResourceWithStreamingResponse(self._client.beta) class AsyncParallelWithStreamedResponse: + _client: AsyncParallel + def __init__(self, client: AsyncParallel) -> None: - self.task_run = task_run.AsyncTaskRunResourceWithStreamingResponse(client.task_run) - self.beta = beta.AsyncBetaResourceWithStreamingResponse(client.beta) + self._client = client + + @cached_property + def task_run(self) -> task_run.AsyncTaskRunResourceWithStreamingResponse: + from .resources.task_run import AsyncTaskRunResourceWithStreamingResponse + + return AsyncTaskRunResourceWithStreamingResponse(self._client.task_run) + + @cached_property + def beta(self) -> beta.AsyncBetaResourceWithStreamingResponse: + from .resources.beta import AsyncBetaResourceWithStreamingResponse + + return AsyncBetaResourceWithStreamingResponse(self._client.beta) Client = Parallel diff --git a/src/parallel/_streaming.py b/src/parallel/_streaming.py index daf80c4..e65969e 100644 --- a/src/parallel/_streaming.py +++ b/src/parallel/_streaming.py @@ -54,11 +54,12 @@ def __stream__(self) -> Iterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - response.close() + try: + for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + response.close() def __enter__(self) -> Self: return self @@ -117,11 +118,12 @@ async def __stream__(self) -> AsyncIterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - async for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - await response.aclose() + try: + async for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + await response.aclose() async def __aenter__(self) -> Self: return self diff --git a/src/parallel/_types.py b/src/parallel/_types.py index eb5f730..4a537e4 100644 --- a/src/parallel/_types.py +++ b/src/parallel/_types.py @@ -243,6 +243,9 @@ class HttpxSendArgs(TypedDict, total=False): if TYPE_CHECKING: # This works because str.__contains__ does not accept object (either in typeshed or at runtime) # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285 + # + # Note: index() and count() methods are intentionally omitted to allow pyright to properly + # infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr. class SequenceNotStr(Protocol[_T_co]): @overload def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... @@ -251,8 +254,6 @@ def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... def __contains__(self, value: object, /) -> bool: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T_co]: ... - def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ... - def count(self, value: Any, /) -> int: ... def __reversed__(self) -> Iterator[_T_co]: ... else: # just point this to a normal `Sequence` at runtime to avoid having to special case diff --git a/src/parallel/_version.py b/src/parallel/_version.py index 068e596..1d59426 100644 --- a/src/parallel/_version.py +++ b/src/parallel/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "parallel" -__version__ = "0.3.4" # x-release-please-version +__version__ = "0.4.0" # x-release-please-version diff --git a/src/parallel/resources/__init__.py b/src/parallel/resources/__init__.py index 9d1df4f..6fc7c06 100644 --- a/src/parallel/resources/__init__.py +++ b/src/parallel/resources/__init__.py @@ -1,13 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .beta import ( - BetaResource, - AsyncBetaResource, - BetaResourceWithRawResponse, - AsyncBetaResourceWithRawResponse, - BetaResourceWithStreamingResponse, - AsyncBetaResourceWithStreamingResponse, -) from .task_run import ( TaskRunResource, AsyncTaskRunResource, @@ -24,10 +16,4 @@ "AsyncTaskRunResourceWithRawResponse", "TaskRunResourceWithStreamingResponse", "AsyncTaskRunResourceWithStreamingResponse", - "BetaResource", - "AsyncBetaResource", - "BetaResourceWithRawResponse", - "AsyncBetaResourceWithRawResponse", - "BetaResourceWithStreamingResponse", - "AsyncBetaResourceWithStreamingResponse", ] diff --git a/src/parallel/resources/beta/__init__.py b/src/parallel/resources/beta/__init__.py index 167ada0..5488ddb 100644 --- a/src/parallel/resources/beta/__init__.py +++ b/src/parallel/resources/beta/__init__.py @@ -9,11 +9,17 @@ AsyncBetaResourceWithStreamingResponse, ) from .findall import ( + FindAllResource, FindallResource, + AsyncFindAllResource, AsyncFindallResource, + FindAllResourceWithRawResponse, FindallResourceWithRawResponse, + AsyncFindAllResourceWithRawResponse, AsyncFindallResourceWithRawResponse, + FindAllResourceWithStreamingResponse, FindallResourceWithStreamingResponse, + AsyncFindAllResourceWithStreamingResponse, AsyncFindallResourceWithStreamingResponse, ) from .task_run import ( @@ -46,6 +52,12 @@ "AsyncTaskGroupResourceWithRawResponse", "TaskGroupResourceWithStreamingResponse", "AsyncTaskGroupResourceWithStreamingResponse", + "FindAllResource", + "AsyncFindAllResource", + "FindAllResourceWithRawResponse", + "AsyncFindAllResourceWithRawResponse", + "FindAllResourceWithStreamingResponse", + "AsyncFindAllResourceWithStreamingResponse", "FindallResource", "AsyncFindallResource", "FindallResourceWithRawResponse", diff --git a/src/parallel/resources/beta/beta.py b/src/parallel/resources/beta/beta.py index ae9279c..8e4d4e9 100644 --- a/src/parallel/resources/beta/beta.py +++ b/src/parallel/resources/beta/beta.py @@ -9,12 +9,12 @@ import httpx from .findall import ( - FindallResource, - AsyncFindallResource, - FindallResourceWithRawResponse, - AsyncFindallResourceWithRawResponse, - FindallResourceWithStreamingResponse, - AsyncFindallResourceWithStreamingResponse, + FindAllResource, + AsyncFindAllResource, + FindAllResourceWithRawResponse, + AsyncFindAllResourceWithRawResponse, + FindAllResourceWithStreamingResponse, + AsyncFindAllResourceWithStreamingResponse, ) from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform @@ -64,8 +64,8 @@ def task_group(self) -> TaskGroupResource: return TaskGroupResource(self._client) @cached_property - def findall(self) -> FindallResource: - return FindallResource(self._client) + def findall(self) -> FindAllResource: + return FindAllResource(self._client) @cached_property def with_raw_response(self) -> BetaResourceWithRawResponse: @@ -90,12 +90,12 @@ def extract( self, *, urls: SequenceNotStr[str], + betas: List[ParallelBetaParam], excerpts: beta_extract_params.Excerpts | Omit = omit, fetch_policy: Optional[FetchPolicyParam] | Omit = omit, full_content: beta_extract_params.FullContent | Omit = omit, objective: Optional[str] | Omit = omit, search_queries: Optional[SequenceNotStr[str]] | Omit = omit, - betas: List[ParallelBetaParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -110,6 +110,8 @@ def extract( `search-extract-2025-10-10`. Args: + betas: Optional header to specify the beta version(s) to enable. + excerpts: Include excerpts from each URL relevant to the search objective and queries. Note that if neither objective nor search_queries is provided, excerpts are redundant with full content. @@ -123,8 +125,6 @@ def extract( search_queries: If provided, focuses extracted content on the specified keyword search queries. - betas: Optional header to specify the beta version(s) to enable. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -134,16 +134,10 @@ def extract( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given( - { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["search-extract-2025-10-10"])) - if is_given(betas) - else not_given - } - ), + "parallel-beta": ",".join(chain((str(e) for e in betas), ["search-extract-2025-10-10"])), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "search-extract-2025-10-10", **(extra_headers or {})} + extra_headers.update({"parallel-beta": "search-extract-2025-10-10"}) return self._post( "/v1beta/extract", body=maybe_transform( @@ -190,7 +184,7 @@ def search( `search-extract-2025-10-10`. Args: - excerpts: Optional settings for returning relevant excerpts. + excerpts: Optional settings to configure excerpt generation. fetch_policy: Policy for live fetching web results. @@ -272,8 +266,8 @@ def task_group(self) -> AsyncTaskGroupResource: return AsyncTaskGroupResource(self._client) @cached_property - def findall(self) -> AsyncFindallResource: - return AsyncFindallResource(self._client) + def findall(self) -> AsyncFindAllResource: + return AsyncFindAllResource(self._client) @cached_property def with_raw_response(self) -> AsyncBetaResourceWithRawResponse: @@ -298,12 +292,12 @@ async def extract( self, *, urls: SequenceNotStr[str], + betas: List[ParallelBetaParam], excerpts: beta_extract_params.Excerpts | Omit = omit, fetch_policy: Optional[FetchPolicyParam] | Omit = omit, full_content: beta_extract_params.FullContent | Omit = omit, objective: Optional[str] | Omit = omit, search_queries: Optional[SequenceNotStr[str]] | Omit = omit, - betas: List[ParallelBetaParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -318,6 +312,8 @@ async def extract( `search-extract-2025-10-10`. Args: + betas: Optional header to specify the beta version(s) to enable. + excerpts: Include excerpts from each URL relevant to the search objective and queries. Note that if neither objective nor search_queries is provided, excerpts are redundant with full content. @@ -331,8 +327,6 @@ async def extract( search_queries: If provided, focuses extracted content on the specified keyword search queries. - betas: Optional header to specify the beta version(s) to enable. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -342,16 +336,10 @@ async def extract( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given( - { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["search-extract-2025-10-10"])) - if is_given(betas) - else not_given - } - ), + "parallel-beta": ",".join(chain((str(e) for e in betas), ["search-extract-2025-10-10"])), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "search-extract-2025-10-10", **(extra_headers or {})} + extra_headers.update({"parallel-beta": "search-extract-2025-10-10"}) return await self._post( "/v1beta/extract", body=await async_maybe_transform( @@ -398,7 +386,7 @@ async def search( `search-extract-2025-10-10`. Args: - excerpts: Optional settings for returning relevant excerpts. + excerpts: Optional settings to configure excerpt generation. fetch_policy: Policy for live fetching web results. @@ -490,8 +478,8 @@ def task_group(self) -> TaskGroupResourceWithRawResponse: return TaskGroupResourceWithRawResponse(self._beta.task_group) @cached_property - def findall(self) -> FindallResourceWithRawResponse: - return FindallResourceWithRawResponse(self._beta.findall) + def findall(self) -> FindAllResourceWithRawResponse: + return FindAllResourceWithRawResponse(self._beta.findall) class AsyncBetaResourceWithRawResponse: @@ -514,8 +502,8 @@ def task_group(self) -> AsyncTaskGroupResourceWithRawResponse: return AsyncTaskGroupResourceWithRawResponse(self._beta.task_group) @cached_property - def findall(self) -> AsyncFindallResourceWithRawResponse: - return AsyncFindallResourceWithRawResponse(self._beta.findall) + def findall(self) -> AsyncFindAllResourceWithRawResponse: + return AsyncFindAllResourceWithRawResponse(self._beta.findall) class BetaResourceWithStreamingResponse: @@ -538,8 +526,8 @@ def task_group(self) -> TaskGroupResourceWithStreamingResponse: return TaskGroupResourceWithStreamingResponse(self._beta.task_group) @cached_property - def findall(self) -> FindallResourceWithStreamingResponse: - return FindallResourceWithStreamingResponse(self._beta.findall) + def findall(self) -> FindAllResourceWithStreamingResponse: + return FindAllResourceWithStreamingResponse(self._beta.findall) class AsyncBetaResourceWithStreamingResponse: @@ -562,5 +550,5 @@ def task_group(self) -> AsyncTaskGroupResourceWithStreamingResponse: return AsyncTaskGroupResourceWithStreamingResponse(self._beta.task_group) @cached_property - def findall(self) -> AsyncFindallResourceWithStreamingResponse: - return AsyncFindallResourceWithStreamingResponse(self._beta.findall) + def findall(self) -> AsyncFindAllResourceWithStreamingResponse: + return AsyncFindAllResourceWithStreamingResponse(self._beta.findall) diff --git a/src/parallel/resources/beta/findall.py b/src/parallel/resources/beta/findall.py index 2be0889..b2cf437 100644 --- a/src/parallel/resources/beta/findall.py +++ b/src/parallel/resources/beta/findall.py @@ -27,38 +27,50 @@ findall_ingest_params, ) from ..._base_client import make_request_options -from ...types.beta.findall_run import FindallRun +from ...types.beta.findall_run import FindAllRun from ...types.json_schema_param import JsonSchemaParam from ...types.beta.webhook_param import WebhookParam -from ...types.beta.findall_schema import FindallSchema +from ...types.beta.findall_schema import FindAllSchema from ...types.beta.mcp_server_param import McpServerParam -from ...types.beta.findall_run_result import FindallRunResult +from ...types.beta.findall_run_result import FindAllRunResult from ...types.beta.parallel_beta_param import ParallelBetaParam -from ...types.beta.findall_events_response import FindallEventsResponse -from ...types.beta.findall_retrieve_response import FindallRetrieveResponse - -__all__ = ["FindallResource", "AsyncFindallResource"] - - -class FindallResource(SyncAPIResource): +from ...types.beta.findall_events_response import FindAllEventsResponse + +__all__ = [ + "FindAllResource", + "AsyncFindAllResource", + "FindAllResourceWithRawResponse", + "AsyncFindAllResourceWithRawResponse", + "FindAllResourceWithStreamingResponse", + "AsyncFindAllResourceWithStreamingResponse", + "FindallResource", + "AsyncFindallResource", + "FindallResourceWithRawResponse", + "AsyncFindallResourceWithRawResponse", + "FindallResourceWithStreamingResponse", + "AsyncFindallResourceWithStreamingResponse", +] + + +class FindAllResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FindallResourceWithRawResponse: + def with_raw_response(self) -> FindAllResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/parallel-web/parallel-sdk-python#accessing-raw-response-data-eg-headers """ - return FindallResourceWithRawResponse(self) + return FindAllResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FindallResourceWithStreamingResponse: + def with_streaming_response(self) -> FindAllResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/parallel-web/parallel-sdk-python#with_streaming_response """ - return FindallResourceWithStreamingResponse(self) + return FindAllResourceWithStreamingResponse(self) def create( self, @@ -78,7 +90,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallRun: + ) -> FindAllRun: """ Starts a FindAll run. @@ -96,11 +108,12 @@ def create( Args: entity_type: Type of the entity for the FindAll run. - generator: Generator for the FindAll run. + generator: Generator for the FindAll run. One of base, core, pro, preview. match_conditions: List of match conditions for the FindAll run. - match_limit: Maximum number of matches to find for this FindAll run. + match_limit: Maximum number of matches to find for this FindAll run. Must be between 5 and + 1000 (inclusive). objective: Natural language objective of the FindAll run. @@ -123,14 +136,14 @@ def create( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return self._post( "/v1beta/findall/runs", body=maybe_transform( @@ -144,12 +157,12 @@ def create( "metadata": metadata, "webhook": webhook, }, - findall_create_params.FindallCreateParams, + findall_create_params.FindAllCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FindallRun, + cast_to=FindAllRun, ) def retrieve( @@ -163,7 +176,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallRetrieveResponse: + ) -> FindAllRun: """ Retrieve a FindAll run. @@ -183,25 +196,20 @@ def retrieve( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} - return cast( - FindallRetrieveResponse, - self._get( - f"/v1beta/findall/runs/{findall_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, FindallRetrieveResponse - ), # Union types cannot be passed in as arguments in the type system + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} + return self._get( + f"/v1beta/findall/runs/{findall_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=FindAllRun, ) def cancel( @@ -235,14 +243,14 @@ def cancel( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return self._post( f"/v1beta/findall/runs/{findall_id}/cancel", options=make_request_options( @@ -265,12 +273,12 @@ def enrich( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallSchema: + ) -> FindAllSchema: """ Add an enrichment to a FindAll run. Args: - output_schema: JSON schema for a task input or output. + output_schema: JSON schema for the enrichment output schema for the FindAll run. mcp_servers: List of MCP servers to use for the task. @@ -291,14 +299,14 @@ def enrich( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return self._post( f"/v1beta/findall/runs/{findall_id}/enrich", body=maybe_transform( @@ -307,12 +315,12 @@ def enrich( "mcp_servers": mcp_servers, "processor": processor, }, - findall_enrich_params.FindallEnrichParams, + findall_enrich_params.FindAllEnrichParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FindallSchema, + cast_to=FindAllSchema, ) def events( @@ -328,7 +336,7 @@ def events( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Stream[FindallEventsResponse]: + ) -> Stream[FindAllEventsResponse]: """ Stream events from a FindAll run. @@ -354,14 +362,14 @@ def events( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return self._get( f"/v1beta/findall/runs/{findall_id}/events", options=make_request_options( @@ -374,12 +382,12 @@ def events( "last_event_id": last_event_id, "api_timeout": api_timeout, }, - findall_events_params.FindallEventsParams, + findall_events_params.FindAllEventsParams, ), ), - cast_to=cast(Any, FindallEventsResponse), # Union types cannot be passed in as arguments in the type system + cast_to=cast(Any, FindAllEventsResponse), # Union types cannot be passed in as arguments in the type system stream=True, - stream_cls=Stream[FindallEventsResponse], + stream_cls=Stream[FindAllEventsResponse], ) def extend( @@ -394,7 +402,7 @@ def extend( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallSchema: + ) -> FindAllSchema: """ Extend a FindAll run by adding additional matches to the current match limit. @@ -418,23 +426,23 @@ def extend( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return self._post( f"/v1beta/findall/runs/{findall_id}/extend", body=maybe_transform( - {"additional_match_limit": additional_match_limit}, findall_extend_params.FindallExtendParams + {"additional_match_limit": additional_match_limit}, findall_extend_params.FindAllExtendParams ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FindallSchema, + cast_to=FindAllSchema, ) def ingest( @@ -448,7 +456,7 @@ def ingest( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallSchema: + ) -> FindAllSchema: """ Transforms a natural language search objective into a structured FindAll spec. @@ -473,21 +481,21 @@ def ingest( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return self._post( "/v1beta/findall/ingest", - body=maybe_transform({"objective": objective}, findall_ingest_params.FindallIngestParams), + body=maybe_transform({"objective": objective}, findall_ingest_params.FindAllIngestParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FindallSchema, + cast_to=FindAllSchema, ) def result( @@ -501,7 +509,7 @@ def result( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallRunResult: + ) -> FindAllRunResult: """ Retrieve the FindAll run result at the time of the request. @@ -521,20 +529,20 @@ def result( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return self._get( f"/v1beta/findall/runs/{findall_id}/result", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FindallRunResult, + cast_to=FindAllRunResult, ) def schema( @@ -548,7 +556,7 @@ def schema( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallSchema: + ) -> FindAllSchema: """ Get FindAll Run Schema @@ -568,42 +576,42 @@ def schema( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return self._get( f"/v1beta/findall/runs/{findall_id}/schema", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FindallSchema, + cast_to=FindAllSchema, ) -class AsyncFindallResource(AsyncAPIResource): +class AsyncFindAllResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFindallResourceWithRawResponse: + def with_raw_response(self) -> AsyncFindAllResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/parallel-web/parallel-sdk-python#accessing-raw-response-data-eg-headers """ - return AsyncFindallResourceWithRawResponse(self) + return AsyncFindAllResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFindallResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncFindAllResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/parallel-web/parallel-sdk-python#with_streaming_response """ - return AsyncFindallResourceWithStreamingResponse(self) + return AsyncFindAllResourceWithStreamingResponse(self) async def create( self, @@ -623,7 +631,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallRun: + ) -> FindAllRun: """ Starts a FindAll run. @@ -641,11 +649,12 @@ async def create( Args: entity_type: Type of the entity for the FindAll run. - generator: Generator for the FindAll run. + generator: Generator for the FindAll run. One of base, core, pro, preview. match_conditions: List of match conditions for the FindAll run. - match_limit: Maximum number of matches to find for this FindAll run. + match_limit: Maximum number of matches to find for this FindAll run. Must be between 5 and + 1000 (inclusive). objective: Natural language objective of the FindAll run. @@ -668,14 +677,14 @@ async def create( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return await self._post( "/v1beta/findall/runs", body=await async_maybe_transform( @@ -689,12 +698,12 @@ async def create( "metadata": metadata, "webhook": webhook, }, - findall_create_params.FindallCreateParams, + findall_create_params.FindAllCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FindallRun, + cast_to=FindAllRun, ) async def retrieve( @@ -708,7 +717,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallRetrieveResponse: + ) -> FindAllRun: """ Retrieve a FindAll run. @@ -728,25 +737,20 @@ async def retrieve( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} - return cast( - FindallRetrieveResponse, - await self._get( - f"/v1beta/findall/runs/{findall_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, FindallRetrieveResponse - ), # Union types cannot be passed in as arguments in the type system + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} + return await self._get( + f"/v1beta/findall/runs/{findall_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=FindAllRun, ) async def cancel( @@ -780,14 +784,14 @@ async def cancel( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return await self._post( f"/v1beta/findall/runs/{findall_id}/cancel", options=make_request_options( @@ -810,12 +814,12 @@ async def enrich( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallSchema: + ) -> FindAllSchema: """ Add an enrichment to a FindAll run. Args: - output_schema: JSON schema for a task input or output. + output_schema: JSON schema for the enrichment output schema for the FindAll run. mcp_servers: List of MCP servers to use for the task. @@ -836,14 +840,14 @@ async def enrich( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return await self._post( f"/v1beta/findall/runs/{findall_id}/enrich", body=await async_maybe_transform( @@ -852,12 +856,12 @@ async def enrich( "mcp_servers": mcp_servers, "processor": processor, }, - findall_enrich_params.FindallEnrichParams, + findall_enrich_params.FindAllEnrichParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FindallSchema, + cast_to=FindAllSchema, ) async def events( @@ -873,7 +877,7 @@ async def events( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncStream[FindallEventsResponse]: + ) -> AsyncStream[FindAllEventsResponse]: """ Stream events from a FindAll run. @@ -899,14 +903,14 @@ async def events( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return await self._get( f"/v1beta/findall/runs/{findall_id}/events", options=make_request_options( @@ -919,12 +923,12 @@ async def events( "last_event_id": last_event_id, "api_timeout": api_timeout, }, - findall_events_params.FindallEventsParams, + findall_events_params.FindAllEventsParams, ), ), - cast_to=cast(Any, FindallEventsResponse), # Union types cannot be passed in as arguments in the type system + cast_to=cast(Any, FindAllEventsResponse), # Union types cannot be passed in as arguments in the type system stream=True, - stream_cls=AsyncStream[FindallEventsResponse], + stream_cls=AsyncStream[FindAllEventsResponse], ) async def extend( @@ -939,7 +943,7 @@ async def extend( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallSchema: + ) -> FindAllSchema: """ Extend a FindAll run by adding additional matches to the current match limit. @@ -963,23 +967,23 @@ async def extend( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return await self._post( f"/v1beta/findall/runs/{findall_id}/extend", body=await async_maybe_transform( - {"additional_match_limit": additional_match_limit}, findall_extend_params.FindallExtendParams + {"additional_match_limit": additional_match_limit}, findall_extend_params.FindAllExtendParams ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FindallSchema, + cast_to=FindAllSchema, ) async def ingest( @@ -993,7 +997,7 @@ async def ingest( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallSchema: + ) -> FindAllSchema: """ Transforms a natural language search objective into a structured FindAll spec. @@ -1018,21 +1022,21 @@ async def ingest( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return await self._post( "/v1beta/findall/ingest", - body=await async_maybe_transform({"objective": objective}, findall_ingest_params.FindallIngestParams), + body=await async_maybe_transform({"objective": objective}, findall_ingest_params.FindAllIngestParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FindallSchema, + cast_to=FindAllSchema, ) async def result( @@ -1046,7 +1050,7 @@ async def result( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallRunResult: + ) -> FindAllRunResult: """ Retrieve the FindAll run result at the time of the request. @@ -1066,20 +1070,20 @@ async def result( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return await self._get( f"/v1beta/findall/runs/{findall_id}/result", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FindallRunResult, + cast_to=FindAllRunResult, ) async def schema( @@ -1093,7 +1097,7 @@ async def schema( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FindallSchema: + ) -> FindAllSchema: """ Get FindAll Run Schema @@ -1113,25 +1117,25 @@ async def schema( extra_headers = { **strip_not_given( { - "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-02-01"])) + "parallel-beta": ",".join(chain((str(e) for e in betas), ["findall-2025-09-15"])) if is_given(betas) else not_given } ), **(extra_headers or {}), } - extra_headers = {"parallel-beta": "findall-2025-02-01", **(extra_headers or {})} + extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})} return await self._get( f"/v1beta/findall/runs/{findall_id}/schema", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FindallSchema, + cast_to=FindAllSchema, ) -class FindallResourceWithRawResponse: - def __init__(self, findall: FindallResource) -> None: +class FindAllResourceWithRawResponse: + def __init__(self, findall: FindAllResource) -> None: self._findall = findall self.create = to_raw_response_wrapper( @@ -1163,8 +1167,8 @@ def __init__(self, findall: FindallResource) -> None: ) -class AsyncFindallResourceWithRawResponse: - def __init__(self, findall: AsyncFindallResource) -> None: +class AsyncFindAllResourceWithRawResponse: + def __init__(self, findall: AsyncFindAllResource) -> None: self._findall = findall self.create = async_to_raw_response_wrapper( @@ -1196,8 +1200,8 @@ def __init__(self, findall: AsyncFindallResource) -> None: ) -class FindallResourceWithStreamingResponse: - def __init__(self, findall: FindallResource) -> None: +class FindAllResourceWithStreamingResponse: + def __init__(self, findall: FindAllResource) -> None: self._findall = findall self.create = to_streamed_response_wrapper( @@ -1229,8 +1233,8 @@ def __init__(self, findall: FindallResource) -> None: ) -class AsyncFindallResourceWithStreamingResponse: - def __init__(self, findall: AsyncFindallResource) -> None: +class AsyncFindAllResourceWithStreamingResponse: + def __init__(self, findall: AsyncFindAllResource) -> None: self._findall = findall self.create = async_to_streamed_response_wrapper( @@ -1260,3 +1264,24 @@ def __init__(self, findall: AsyncFindallResource) -> None: self.schema = async_to_streamed_response_wrapper( findall.schema, ) + + +FindallResource = FindAllResource # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllResource` should be used instead""" + +AsyncFindallResource = AsyncFindAllResource # for backwards compatibility with v0.3.4 +"""This is deprecated, `AsyncFindAllResource` should be used instead""" + +FindallResourceWithRawResponse = FindAllResourceWithRawResponse # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllResourceWithRawResponse` should be used instead""" + +AsyncFindallResourceWithRawResponse = AsyncFindAllResourceWithRawResponse # for backwards compatibility with v0.3.4 +"""This is deprecated, `AsyncFindAllResourceWithRawResponse` should be used instead""" + +FindallResourceWithStreamingResponse = FindAllResourceWithStreamingResponse # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllResourceWithStreamingResponse` should be used instead""" + +AsyncFindallResourceWithStreamingResponse = ( + AsyncFindAllResourceWithStreamingResponse # for backwards compatibility with v0.3.4 +) +"""This is deprecated, `AsyncFindAllResourceWithStreamingResponse` should be used instead""" diff --git a/src/parallel/types/auto_schema.py b/src/parallel/types/auto_schema.py index 6ff429e..f32a610 100644 --- a/src/parallel/types/auto_schema.py +++ b/src/parallel/types/auto_schema.py @@ -9,5 +9,7 @@ class AutoSchema(BaseModel): + """Auto schema for a task input or output.""" + type: Optional[Literal["auto"]] = None """The type of schema being defined. Always `auto`.""" diff --git a/src/parallel/types/auto_schema_param.py b/src/parallel/types/auto_schema_param.py index 54d5196..7c3b336 100644 --- a/src/parallel/types/auto_schema_param.py +++ b/src/parallel/types/auto_schema_param.py @@ -8,5 +8,7 @@ class AutoSchemaParam(TypedDict, total=False): + """Auto schema for a task input or output.""" + type: Literal["auto"] """The type of schema being defined. Always `auto`.""" diff --git a/src/parallel/types/beta/__init__.py b/src/parallel/types/beta/__init__.py index 1ef2fe2..ef052aa 100644 --- a/src/parallel/types/beta/__init__.py +++ b/src/parallel/types/beta/__init__.py @@ -7,14 +7,14 @@ from .task_group import TaskGroup as TaskGroup from .usage_item import UsageItem as UsageItem from .error_event import ErrorEvent as ErrorEvent -from .findall_run import FindallRun as FindallRun +from .findall_run import FindAllRun as FindAllRun, FindallRun as FindallRun from .extract_error import ExtractError as ExtractError from .mcp_tool_call import McpToolCall as McpToolCall from .search_result import SearchResult as SearchResult from .webhook_param import WebhookParam as WebhookParam from .beta_run_input import BetaRunInput as BetaRunInput from .extract_result import ExtractResult as ExtractResult -from .findall_schema import FindallSchema as FindallSchema +from .findall_schema import FindAllSchema as FindAllSchema, FindallSchema as FindallSchema from .task_run_event import TaskRunEvent as TaskRunEvent from .extract_response import ExtractResponse as ExtractResponse from .mcp_server_param import McpServerParam as McpServerParam @@ -22,30 +22,56 @@ from .web_search_result import WebSearchResult as WebSearchResult from .beta_search_params import BetaSearchParams as BetaSearchParams from .fetch_policy_param import FetchPolicyParam as FetchPolicyParam -from .findall_run_result import FindallRunResult as FindallRunResult +from .findall_run_result import FindAllRunResult as FindAllRunResult, FindallRunResult as FindallRunResult from .beta_extract_params import BetaExtractParams as BetaExtractParams from .parallel_beta_param import ParallelBetaParam as ParallelBetaParam from .beta_run_input_param import BetaRunInputParam as BetaRunInputParam from .beta_task_run_result import BetaTaskRunResult as BetaTaskRunResult -from .findall_enrich_input import FindallEnrichInput as FindallEnrichInput -from .findall_create_params import FindallCreateParams as FindallCreateParams -from .findall_enrich_params import FindallEnrichParams as FindallEnrichParams -from .findall_events_params import FindallEventsParams as FindallEventsParams -from .findall_extend_params import FindallExtendParams as FindallExtendParams -from .findall_ingest_params import FindallIngestParams as FindallIngestParams +from .findall_enrich_input import FindAllEnrichInput as FindAllEnrichInput, FindallEnrichInput as FindallEnrichInput +from .findall_create_params import ( + FindAllCreateParams as FindAllCreateParams, + FindallCreateParams as FindallCreateParams, +) +from .findall_enrich_params import ( + FindAllEnrichParams as FindAllEnrichParams, + FindallEnrichParams as FindallEnrichParams, +) +from .findall_events_params import ( + FindAllEventsParams as FindAllEventsParams, + FindallEventsParams as FindallEventsParams, +) +from .findall_extend_params import ( + FindAllExtendParams as FindAllExtendParams, + FindallExtendParams as FindallExtendParams, +) +from .findall_ingest_params import ( + FindAllIngestParams as FindAllIngestParams, + FindallIngestParams as FindallIngestParams, +) from .excerpt_settings_param import ExcerptSettingsParam as ExcerptSettingsParam from .task_run_create_params import TaskRunCreateParams as TaskRunCreateParams from .task_run_result_params import TaskRunResultParams as TaskRunResultParams -from .findall_events_response import FindallEventsResponse as FindallEventsResponse +from .findall_events_response import ( + FindAllEventsResponse as FindAllEventsResponse, + FindallEventsResponse as FindallEventsResponse, +) from .task_group_run_response import TaskGroupRunResponse as TaskGroupRunResponse -from .findall_run_status_event import FindallRunStatusEvent as FindallRunStatusEvent +from .findall_run_status_event import ( + FindAllRunStatusEvent as FindAllRunStatusEvent, + FindallRunStatusEvent as FindallRunStatusEvent, +) from .task_group_create_params import TaskGroupCreateParams as TaskGroupCreateParams from .task_group_events_params import TaskGroupEventsParams as TaskGroupEventsParams from .task_run_events_response import TaskRunEventsResponse as TaskRunEventsResponse -from .findall_retrieve_response import FindallRetrieveResponse as FindallRetrieveResponse from .task_group_add_runs_params import TaskGroupAddRunsParams as TaskGroupAddRunsParams from .task_group_events_response import TaskGroupEventsResponse as TaskGroupEventsResponse from .task_group_get_runs_params import TaskGroupGetRunsParams as TaskGroupGetRunsParams -from .findall_schema_updated_event import FindallSchemaUpdatedEvent as FindallSchemaUpdatedEvent +from .findall_schema_updated_event import ( + FindAllSchemaUpdatedEvent as FindAllSchemaUpdatedEvent, + FindallSchemaUpdatedEvent as FindallSchemaUpdatedEvent, +) from .task_group_get_runs_response import TaskGroupGetRunsResponse as TaskGroupGetRunsResponse -from .findall_candidate_match_status_event import FindallCandidateMatchStatusEvent as FindallCandidateMatchStatusEvent +from .findall_candidate_match_status_event import ( + FindAllCandidateMatchStatusEvent as FindAllCandidateMatchStatusEvent, + FindallCandidateMatchStatusEvent as FindallCandidateMatchStatusEvent, +) diff --git a/src/parallel/types/beta/beta_extract_params.py b/src/parallel/types/beta/beta_extract_params.py index 965fe63..657bb72 100644 --- a/src/parallel/types/beta/beta_extract_params.py +++ b/src/parallel/types/beta/beta_extract_params.py @@ -17,6 +17,9 @@ class BetaExtractParams(TypedDict, total=False): urls: Required[SequenceNotStr[str]] + betas: Required[Annotated[List[ParallelBetaParam], PropertyInfo(alias="parallel-beta")]] + """Optional header to specify the beta version(s) to enable.""" + excerpts: Excerpts """Include excerpts from each URL relevant to the search objective and queries. @@ -40,14 +43,13 @@ class BetaExtractParams(TypedDict, total=False): search_queries: Optional[SequenceNotStr[str]] """If provided, focuses extracted content on the specified keyword search queries.""" - betas: Annotated[List[ParallelBetaParam], PropertyInfo(alias="parallel-beta")] - """Optional header to specify the beta version(s) to enable.""" - Excerpts: TypeAlias = Union[bool, ExcerptSettingsParam] class FullContentFullContentSettings(TypedDict, total=False): + """Optional settings for returning full content.""" + max_chars_per_result: Optional[int] """ Optional limit on the number of characters to include in the full content for diff --git a/src/parallel/types/beta/beta_run_input.py b/src/parallel/types/beta/beta_run_input.py index 8bed8c4..690ac46 100644 --- a/src/parallel/types/beta/beta_run_input.py +++ b/src/parallel/types/beta/beta_run_input.py @@ -12,6 +12,8 @@ class BetaRunInput(BaseModel): + """Task run input with additional beta fields.""" + input: Union[str, Dict[str, object]] """Input to the task, either text or a JSON object.""" diff --git a/src/parallel/types/beta/beta_run_input_param.py b/src/parallel/types/beta/beta_run_input_param.py index 553fa3c..e2578c5 100644 --- a/src/parallel/types/beta/beta_run_input_param.py +++ b/src/parallel/types/beta/beta_run_input_param.py @@ -14,6 +14,8 @@ class BetaRunInputParam(TypedDict, total=False): + """Task run input with additional beta fields.""" + input: Required[Union[str, Dict[str, object]]] """Input to the task, either text or a JSON object.""" diff --git a/src/parallel/types/beta/beta_search_params.py b/src/parallel/types/beta/beta_search_params.py index 661e588..58a8874 100644 --- a/src/parallel/types/beta/beta_search_params.py +++ b/src/parallel/types/beta/beta_search_params.py @@ -17,7 +17,7 @@ class BetaSearchParams(TypedDict, total=False): excerpts: ExcerptSettingsParam - """Optional settings for returning relevant excerpts.""" + """Optional settings to configure excerpt generation.""" fetch_policy: Optional[FetchPolicyParam] """Policy for live fetching web results.""" diff --git a/src/parallel/types/beta/beta_task_run_result.py b/src/parallel/types/beta/beta_task_run_result.py index 3db1c50..5bc7cf7 100644 --- a/src/parallel/types/beta/beta_task_run_result.py +++ b/src/parallel/types/beta/beta_task_run_result.py @@ -13,8 +13,14 @@ class OutputBetaTaskRunTextOutput(BaseModel): + """Output from a task that returns text.""" + basis: List[FieldBasis] - """Basis for the output.""" + """Basis for the output. + + To include per-list-element basis entries, send the `parallel-beta` header with + the value `field-basis-2025-11-25` when creating the run. + """ content: str """Text output from the task.""" @@ -33,8 +39,14 @@ class OutputBetaTaskRunTextOutput(BaseModel): class OutputBetaTaskRunJsonOutput(BaseModel): + """Output from a task that returns JSON.""" + basis: List[FieldBasis] - """Basis for the output.""" + """Basis for the output. + + To include per-list-element basis entries, send the `parallel-beta` header with + the value `field-basis-2025-11-25` when creating the run. + """ content: Dict[str, object] """ @@ -67,8 +79,10 @@ class OutputBetaTaskRunJsonOutput(BaseModel): class BetaTaskRunResult(BaseModel): + """Result of a beta task run. Available only if beta headers are specified.""" + output: Output """Output from the task conforming to the output schema.""" run: TaskRun - """Status of a task run.""" + """Beta task run object with status 'completed'.""" diff --git a/src/parallel/types/beta/error_event.py b/src/parallel/types/beta/error_event.py index aefa872..7ac7abc 100644 --- a/src/parallel/types/beta/error_event.py +++ b/src/parallel/types/beta/error_event.py @@ -9,8 +9,10 @@ class ErrorEvent(BaseModel): + """Event indicating an error.""" + error: ErrorObject - """An error message.""" + """Error.""" type: Literal["error"] """Event type; always 'error'.""" diff --git a/src/parallel/types/beta/excerpt_settings_param.py b/src/parallel/types/beta/excerpt_settings_param.py index 1a07f80..43ceb31 100644 --- a/src/parallel/types/beta/excerpt_settings_param.py +++ b/src/parallel/types/beta/excerpt_settings_param.py @@ -9,9 +9,19 @@ class ExcerptSettingsParam(TypedDict, total=False): + """Optional settings for returning relevant excerpts.""" + max_chars_per_result: Optional[int] """Optional upper bound on the total number of characters to include per url. Excerpts may contain fewer characters than this limit to maximize relevance and - token efficiency. + token efficiency, but will never contain fewer than 1000 characters per result. + """ + + max_chars_total: Optional[int] + """ + Optional upper bound on the total number of characters to include across all + urls. Results may contain fewer characters than this limit to maximize relevance + and token efficiency, but will never contain fewer than 1000 characters per + result.This overall limit applies in addition to max_chars_per_result. """ diff --git a/src/parallel/types/beta/extract_error.py b/src/parallel/types/beta/extract_error.py index 3e81daf..0c8a19f 100644 --- a/src/parallel/types/beta/extract_error.py +++ b/src/parallel/types/beta/extract_error.py @@ -8,6 +8,8 @@ class ExtractError(BaseModel): + """Extract error details.""" + content: Optional[str] = None """Content returned for http client or server errors, if any.""" diff --git a/src/parallel/types/beta/extract_response.py b/src/parallel/types/beta/extract_response.py index d3b666a..45717bc 100644 --- a/src/parallel/types/beta/extract_response.py +++ b/src/parallel/types/beta/extract_response.py @@ -12,6 +12,8 @@ class ExtractResponse(BaseModel): + """Fetch result.""" + errors: List[ExtractError] """Extract errors: requested URLs not in the results.""" diff --git a/src/parallel/types/beta/extract_result.py b/src/parallel/types/beta/extract_result.py index 59adca5..8d74038 100644 --- a/src/parallel/types/beta/extract_result.py +++ b/src/parallel/types/beta/extract_result.py @@ -8,6 +8,8 @@ class ExtractResult(BaseModel): + """Extract result for a single URL.""" + url: str """URL associated with the search result.""" diff --git a/src/parallel/types/beta/fetch_policy_param.py b/src/parallel/types/beta/fetch_policy_param.py index 82f9723..5bc4447 100644 --- a/src/parallel/types/beta/fetch_policy_param.py +++ b/src/parallel/types/beta/fetch_policy_param.py @@ -9,6 +9,8 @@ class FetchPolicyParam(TypedDict, total=False): + """Policy for live fetching web results.""" + disable_cache_fallback: bool """ If false, fallback to cached content older than max-age if live fetch fails or diff --git a/src/parallel/types/beta/findall_candidate_match_status_event.py b/src/parallel/types/beta/findall_candidate_match_status_event.py index 9133376..01ebf20 100644 --- a/src/parallel/types/beta/findall_candidate_match_status_event.py +++ b/src/parallel/types/beta/findall_candidate_match_status_event.py @@ -7,10 +7,12 @@ from ..._models import BaseModel from ..field_basis import FieldBasis -__all__ = ["FindallCandidateMatchStatusEvent", "Data"] +__all__ = ["FindAllCandidateMatchStatusEvent", "FindallCandidateMatchStatusEvent", "Data"] class Data(BaseModel): + """The candidate whose match status has been updated.""" + candidate_id: str """ID of the candidate.""" @@ -40,13 +42,11 @@ class Data(BaseModel): """ -class FindallCandidateMatchStatusEvent(BaseModel): - data: Data - """Candidate for a find all run that may end up as a match. +class FindAllCandidateMatchStatusEvent(BaseModel): + """Event containing a candidate whose match status has changed.""" - Contains all the candidate's metadata and the output of the match conditions. A - candidate is a match if all match conditions are satisfied. - """ + data: Data + """The candidate whose match status has been updated.""" event_id: str """Unique event identifier for the event.""" @@ -66,3 +66,7 @@ class FindallCandidateMatchStatusEvent(BaseModel): findall.candidate.unmatched, findall.candidate.discarded, findall.candidate.enriched. """ + + +FindallCandidateMatchStatusEvent = FindAllCandidateMatchStatusEvent # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllCandidateMatchStatusEvent` should be used instead""" diff --git a/src/parallel/types/beta/findall_create_params.py b/src/parallel/types/beta/findall_create_params.py index ee618cf..d4dbed2 100644 --- a/src/parallel/types/beta/findall_create_params.py +++ b/src/parallel/types/beta/findall_create_params.py @@ -9,21 +9,24 @@ from .webhook_param import WebhookParam from .parallel_beta_param import ParallelBetaParam -__all__ = ["FindallCreateParams", "MatchCondition", "ExcludeList"] +__all__ = ["FindAllCreateParams", "FindallCreateParams", "MatchCondition", "ExcludeList"] -class FindallCreateParams(TypedDict, total=False): +class FindAllCreateParams(TypedDict, total=False): entity_type: Required[str] """Type of the entity for the FindAll run.""" generator: Required[Literal["base", "core", "pro", "preview"]] - """Generator for the FindAll run.""" + """Generator for the FindAll run. One of base, core, pro, preview.""" match_conditions: Required[Iterable[MatchCondition]] """List of match conditions for the FindAll run.""" match_limit: Required[int] - """Maximum number of matches to find for this FindAll run.""" + """Maximum number of matches to find for this FindAll run. + + Must be between 5 and 1000 (inclusive). + """ objective: Required[str] """Natural language objective of the FindAll run.""" @@ -42,6 +45,8 @@ class FindallCreateParams(TypedDict, total=False): class MatchCondition(TypedDict, total=False): + """Match condition model for FindAll ingest.""" + description: Required[str] """Detailed description of the match condition. @@ -54,8 +59,14 @@ class MatchCondition(TypedDict, total=False): class ExcludeList(TypedDict, total=False): + """Exclude candidate input model for FindAll run.""" + name: Required[str] """Name of the entity to exclude from results.""" url: Required[str] """URL of the entity to exclude from results.""" + + +FindallCreateParams = FindAllCreateParams # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllCreateParams` should be used instead""" diff --git a/src/parallel/types/beta/findall_enrich_input.py b/src/parallel/types/beta/findall_enrich_input.py index 6b84ea8..8b16a9e 100644 --- a/src/parallel/types/beta/findall_enrich_input.py +++ b/src/parallel/types/beta/findall_enrich_input.py @@ -6,15 +6,21 @@ from .mcp_server import McpServer from ..json_schema import JsonSchema -__all__ = ["FindallEnrichInput"] +__all__ = ["FindAllEnrichInput", "FindallEnrichInput"] -class FindallEnrichInput(BaseModel): +class FindAllEnrichInput(BaseModel): + """Input model for FindAll enrich.""" + output_schema: JsonSchema - """JSON schema for a task input or output.""" + """JSON schema for the enrichment output schema for the FindAll run.""" mcp_servers: Optional[List[McpServer]] = None """List of MCP servers to use for the task.""" processor: Optional[str] = None """Processor to use for the task.""" + + +FindallEnrichInput = FindAllEnrichInput # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllEnrichInput` should be used instead""" diff --git a/src/parallel/types/beta/findall_enrich_params.py b/src/parallel/types/beta/findall_enrich_params.py index 22860fe..f2e3490 100644 --- a/src/parallel/types/beta/findall_enrich_params.py +++ b/src/parallel/types/beta/findall_enrich_params.py @@ -10,12 +10,12 @@ from ..json_schema_param import JsonSchemaParam from .parallel_beta_param import ParallelBetaParam -__all__ = ["FindallEnrichParams"] +__all__ = ["FindAllEnrichParams", "FindallEnrichParams"] -class FindallEnrichParams(TypedDict, total=False): +class FindAllEnrichParams(TypedDict, total=False): output_schema: Required[JsonSchemaParam] - """JSON schema for a task input or output.""" + """JSON schema for the enrichment output schema for the FindAll run.""" mcp_servers: Optional[Iterable[McpServerParam]] """List of MCP servers to use for the task.""" @@ -25,3 +25,7 @@ class FindallEnrichParams(TypedDict, total=False): betas: Annotated[List[ParallelBetaParam], PropertyInfo(alias="parallel-beta")] """Optional header to specify the beta version(s) to enable.""" + + +FindallEnrichParams = FindAllEnrichParams # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllEnrichParams` should be used instead""" diff --git a/src/parallel/types/beta/findall_events_params.py b/src/parallel/types/beta/findall_events_params.py index 5b44129..f818b1b 100644 --- a/src/parallel/types/beta/findall_events_params.py +++ b/src/parallel/types/beta/findall_events_params.py @@ -8,13 +8,17 @@ from ..._utils import PropertyInfo from .parallel_beta_param import ParallelBetaParam -__all__ = ["FindallEventsParams"] +__all__ = ["FindAllEventsParams", "FindallEventsParams"] -class FindallEventsParams(TypedDict, total=False): +class FindAllEventsParams(TypedDict, total=False): last_event_id: Optional[str] api_timeout: Annotated[Optional[float], PropertyInfo(alias="timeout")] betas: Annotated[List[ParallelBetaParam], PropertyInfo(alias="parallel-beta")] """Optional header to specify the beta version(s) to enable.""" + + +FindallEventsParams = FindAllEventsParams # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllEventsParams` should be used instead""" diff --git a/src/parallel/types/beta/findall_events_response.py b/src/parallel/types/beta/findall_events_response.py index eb4c3ed..f3cd93e 100644 --- a/src/parallel/types/beta/findall_events_response.py +++ b/src/parallel/types/beta/findall_events_response.py @@ -5,13 +5,17 @@ from ..._utils import PropertyInfo from .error_event import ErrorEvent -from .findall_run_status_event import FindallRunStatusEvent -from .findall_schema_updated_event import FindallSchemaUpdatedEvent -from .findall_candidate_match_status_event import FindallCandidateMatchStatusEvent +from .findall_run_status_event import FindAllRunStatusEvent +from .findall_schema_updated_event import FindAllSchemaUpdatedEvent +from .findall_candidate_match_status_event import FindAllCandidateMatchStatusEvent -__all__ = ["FindallEventsResponse"] +__all__ = ["FindAllEventsResponse", "FindallEventsResponse"] -FindallEventsResponse: TypeAlias = Annotated[ - Union[FindallSchemaUpdatedEvent, FindallRunStatusEvent, FindallCandidateMatchStatusEvent, ErrorEvent], +FindAllEventsResponse: TypeAlias = Annotated[ + Union[FindAllSchemaUpdatedEvent, FindAllRunStatusEvent, FindAllCandidateMatchStatusEvent, ErrorEvent], PropertyInfo(discriminator="type"), ] + + +FindallEventsResponse = FindAllEventsResponse # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllEventsResponse` should be used instead""" diff --git a/src/parallel/types/beta/findall_extend_params.py b/src/parallel/types/beta/findall_extend_params.py index 72577a9..41b2d88 100644 --- a/src/parallel/types/beta/findall_extend_params.py +++ b/src/parallel/types/beta/findall_extend_params.py @@ -8,10 +8,10 @@ from ..._utils import PropertyInfo from .parallel_beta_param import ParallelBetaParam -__all__ = ["FindallExtendParams"] +__all__ = ["FindAllExtendParams", "FindallExtendParams"] -class FindallExtendParams(TypedDict, total=False): +class FindAllExtendParams(TypedDict, total=False): additional_match_limit: Required[int] """Additional number of matches to find for this FindAll run. @@ -21,3 +21,7 @@ class FindallExtendParams(TypedDict, total=False): betas: Annotated[List[ParallelBetaParam], PropertyInfo(alias="parallel-beta")] """Optional header to specify the beta version(s) to enable.""" + + +FindallExtendParams = FindAllExtendParams # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllExtendParams` should be used instead""" diff --git a/src/parallel/types/beta/findall_ingest_params.py b/src/parallel/types/beta/findall_ingest_params.py index 498dece..fec1a52 100644 --- a/src/parallel/types/beta/findall_ingest_params.py +++ b/src/parallel/types/beta/findall_ingest_params.py @@ -8,12 +8,16 @@ from ..._utils import PropertyInfo from .parallel_beta_param import ParallelBetaParam -__all__ = ["FindallIngestParams"] +__all__ = ["FindAllIngestParams", "FindallIngestParams"] -class FindallIngestParams(TypedDict, total=False): +class FindAllIngestParams(TypedDict, total=False): objective: Required[str] """Natural language objective to create a FindAll run spec.""" betas: Annotated[List[ParallelBetaParam], PropertyInfo(alias="parallel-beta")] """Optional header to specify the beta version(s) to enable.""" + + +FindallIngestParams = FindAllIngestParams # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllIngestParams` should be used instead""" diff --git a/src/parallel/types/beta/findall_retrieve_response.py b/src/parallel/types/beta/findall_retrieve_response.py deleted file mode 100644 index bbdef51..0000000 --- a/src/parallel/types/beta/findall_retrieve_response.py +++ /dev/null @@ -1,262 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from ..._models import BaseModel -from .findall_run import FindallRun - -__all__ = [ - "FindallRetrieveResponse", - "FindAllPollResponse", - "FindAllPollResponseBillingMetrics", - "FindAllPollResponseCandidate", - "FindAllPollResponseEnrichment", - "FindAllPollResponseFilter", - "FindAllPollResponseResult", - "FindAllPollResponseResultEnrichmentResult", - "FindAllPollResponseResultEnrichmentResultEnhancedCitation", - "FindAllPollResponseResultFilterResult", - "FindAllPollResponseResultFilterResultEnhancedCitation", - "FindAllPollResponseSpec", - "FindAllPollResponseSpecColumn", - "FindAllPollResponseStep", - "FindAllPollResponseEnrichmentRecommendation", -] - - -class FindAllPollResponseBillingMetrics(BaseModel): - enrichment_cells: int - """Number of enrichment cells processed""" - - rows_processed: int - """Number of rows processed""" - - cost_mode: Optional[Literal["lite", "base", "pro", "preview"]] = None - - -class FindAllPollResponseCandidate(BaseModel): - entity_id: str - """Unique entity identifier""" - - name: str - """Entity name""" - - -class FindAllPollResponseEnrichment(BaseModel): - description: str - """Human-readable description of the column""" - - name: str - """Column identifier""" - - type: str - """Column type ('enrichment' or 'filter')""" - - status: Optional[str] = None - """Status of the column ('running', 'done', 'failed')""" - - -class FindAllPollResponseFilter(BaseModel): - description: str - """Human-readable description of the column""" - - name: str - """Column identifier""" - - type: str - """Column type ('enrichment' or 'filter')""" - - status: Optional[str] = None - """Status of the column ('running', 'done', 'failed')""" - - -class FindAllPollResponseResultEnrichmentResultEnhancedCitation(BaseModel): - url: str - """Citation URL""" - - excerpts: Optional[List[str]] = None - """List of relevant excerpts from the cited page""" - - title: Optional[str] = None - """Title of the cited page""" - - -class FindAllPollResponseResultEnrichmentResult(BaseModel): - key: str - """Name of column""" - - value: str - """Result of column""" - - citations: Optional[str] = None - """Space separated list of citation urls""" - - confidence: Optional[str] = None - """Confidence score (e.g. 'high', 'medium', 'low')""" - - enhanced_citations: Optional[List[FindAllPollResponseResultEnrichmentResultEnhancedCitation]] = None - """List of enhanced citations with title and excerpts""" - - reasoning: Optional[str] = None - """Reasoning behind the value""" - - -class FindAllPollResponseResultFilterResultEnhancedCitation(BaseModel): - url: str - """Citation URL""" - - excerpts: Optional[List[str]] = None - """List of relevant excerpts from the cited page""" - - title: Optional[str] = None - """Title of the cited page""" - - -class FindAllPollResponseResultFilterResult(BaseModel): - key: str - """Name of column""" - - value: str - """Result of column""" - - citations: Optional[str] = None - """Space separated list of citation urls""" - - confidence: Optional[str] = None - """Confidence score (e.g. 'high', 'medium', 'low')""" - - enhanced_citations: Optional[List[FindAllPollResponseResultFilterResultEnhancedCitation]] = None - """List of enhanced citations with title and excerpts""" - - reasoning: Optional[str] = None - """Reasoning behind the value""" - - -class FindAllPollResponseResult(BaseModel): - entity_id: str - """Unique entity identifier""" - - name: str - """Entity name""" - - description: Optional[str] = None - """Entity description if available""" - - enrichment_results: Optional[List[FindAllPollResponseResultEnrichmentResult]] = None - """List of enrichment results""" - - filter_results: Optional[List[FindAllPollResponseResultFilterResult]] = None - """List of filter results""" - - score: Optional[float] = None - """Confidence score (positive real number)""" - - url: Optional[str] = None - """Entity URL if available""" - - -class FindAllPollResponseSpecColumn(BaseModel): - description: str - """Human-readable description of the column""" - - name: str - """Column identifier""" - - type: str - """Column type ('enrichment' or 'filter')""" - - status: Optional[str] = None - """Status of the column ('running', 'done', 'failed')""" - - -class FindAllPollResponseSpec(BaseModel): - columns: List[FindAllPollResponseSpecColumn] - """List of columns in the view""" - - name: str - """Name of the view""" - - -class FindAllPollResponseStep(BaseModel): - description: str - """Human-readable description of the step""" - - name: str - """Step identifier""" - - status: str - """Current status of the step""" - - -class FindAllPollResponseEnrichmentRecommendation(BaseModel): - column_name: str - """Recommended column name""" - - description: str - """Description of the recommended enrichment""" - - recommendation_run_id: str - """Run ID that generated this recommendation""" - - recommendation_task_id: str - """Task ID that generated this recommendation""" - - -class FindAllPollResponse(BaseModel): - billing_metrics: FindAllPollResponseBillingMetrics - """Billing metrics for the run.""" - - candidates: List[FindAllPollResponseCandidate] - """List of candidates being processed""" - - enrichments: List[FindAllPollResponseEnrichment] - """List of enrichments derived from the query""" - - filters: List[FindAllPollResponseFilter] - """List of filters derived from the query""" - - is_active: bool - """True if the run is still processing candidates""" - - max_results: int - """Max results processed for the run""" - - query: str - """Query for the run""" - - results: List[FindAllPollResponseResult] - """List of entities which are fully processed""" - - spec: FindAllPollResponseSpec - """View model for the run.""" - - status: str - """Derived overall status (e.g., 'running', 'completed', 'failed')""" - - steps: List[FindAllPollResponseStep] - """List of processing steps undertaken with their status""" - - title: str - """Title of the run""" - - are_enrichments_active: Optional[bool] = None - """True if enrichments are still being processed""" - - created_at: Optional[str] = None - """Timestamp of the request""" - - enrichment_recommendations: Optional[List[FindAllPollResponseEnrichmentRecommendation]] = None - """List of recommended enrichments that could be added""" - - modified_at: Optional[str] = None - """Timestamp of the last status update""" - - pages_considered: Optional[int] = None - """Number of web pages considered for this entity""" - - pages_read: Optional[int] = None - """Number of web pages read for this entity""" - - -FindallRetrieveResponse: TypeAlias = Union[FindallRun, FindAllPollResponse] diff --git a/src/parallel/types/beta/findall_run.py b/src/parallel/types/beta/findall_run.py index e5e61f7..9cbe080 100644 --- a/src/parallel/types/beta/findall_run.py +++ b/src/parallel/types/beta/findall_run.py @@ -5,10 +5,12 @@ from ..._models import BaseModel -__all__ = ["FindallRun", "Status", "StatusMetrics"] +__all__ = ["FindAllRun", "FindallRun", "Status", "StatusMetrics"] class StatusMetrics(BaseModel): + """Candidate metrics for the FindAll run.""" + generated_candidates_count: Optional[int] = None """Number of candidates that were selected.""" @@ -17,20 +19,28 @@ class StatusMetrics(BaseModel): class Status(BaseModel): + """Status object for the FindAll run.""" + is_active: bool """Whether the FindAll run is active""" metrics: StatusMetrics - """Metrics object for FindAll run.""" + """Candidate metrics for the FindAll run.""" status: Literal["queued", "action_required", "running", "completed", "failed", "cancelling", "cancelled"] """Status of the FindAll run.""" - termination_reason: Optional[str] = None + termination_reason: Optional[ + Literal[ + "low_match_rate", "match_limit_met", "candidates_exhausted", "user_cancelled", "error_occurred", "timeout" + ] + ] = None """Reason for termination when FindAll run is in terminal status.""" -class FindallRun(BaseModel): +class FindAllRun(BaseModel): + """FindAll run object with status and metadata.""" + findall_id: str """ID of the FindAll run.""" @@ -38,7 +48,7 @@ class FindallRun(BaseModel): """Generator for the FindAll run.""" status: Status - """Status object for FindAll run.""" + """Status object for the FindAll run.""" created_at: Optional[str] = None """Timestamp of the creation of the run, in RFC 3339 format.""" @@ -51,3 +61,7 @@ class FindallRun(BaseModel): Timestamp of the latest modification to the FindAll run result, in RFC 3339 format. """ + + +FindallRun = FindAllRun # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllRun` should be used instead""" diff --git a/src/parallel/types/beta/findall_run_result.py b/src/parallel/types/beta/findall_run_result.py index b738459..d1851a9 100644 --- a/src/parallel/types/beta/findall_run_result.py +++ b/src/parallel/types/beta/findall_run_result.py @@ -4,13 +4,19 @@ from typing_extensions import Literal from ..._models import BaseModel -from .findall_run import FindallRun +from .findall_run import FindAllRun from ..field_basis import FieldBasis -__all__ = ["FindallRunResult", "Candidate"] +__all__ = ["FindAllRunResult", "FindallRunResult", "Candidate"] class Candidate(BaseModel): + """Candidate for a find all run that may end up as a match. + + Contains all the candidate's metadata and the output of the match conditions. + A candidate is a match if all match conditions are satisfied. + """ + candidate_id: str """ID of the candidate.""" @@ -40,15 +46,26 @@ class Candidate(BaseModel): """ -class FindallRunResult(BaseModel): +class FindAllRunResult(BaseModel): + """Complete FindAll search results. + + Represents a snapshot of a FindAll run, including run metadata and a list of + candidate entities with their match status and details at the time the snapshot was + taken. + """ + candidates: List[Candidate] """All evaluated candidates at the time of the snapshot.""" - run: FindallRun - """FindAll run object with status and metadata.""" + run: FindAllRun + """FindAll run object.""" last_event_id: Optional[str] = None """ID of the last event of the run at the time of the request. This can be used to resume streaming from the last event. """ + + +FindallRunResult = FindAllRunResult # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllRunResult` should be used instead""" diff --git a/src/parallel/types/beta/findall_run_status_event.py b/src/parallel/types/beta/findall_run_status_event.py index a39be11..fe3ce34 100644 --- a/src/parallel/types/beta/findall_run_status_event.py +++ b/src/parallel/types/beta/findall_run_status_event.py @@ -4,14 +4,16 @@ from typing_extensions import Literal from ..._models import BaseModel -from .findall_run import FindallRun +from .findall_run import FindAllRun -__all__ = ["FindallRunStatusEvent"] +__all__ = ["FindAllRunStatusEvent", "FindallRunStatusEvent"] -class FindallRunStatusEvent(BaseModel): - data: FindallRun - """FindAll run object with status and metadata.""" +class FindAllRunStatusEvent(BaseModel): + """Event containing status update for FindAll run.""" + + data: FindAllRun + """Updated FindAll run information.""" event_id: str """Unique event identifier for the event.""" @@ -21,3 +23,7 @@ class FindallRunStatusEvent(BaseModel): type: Literal["findall.status"] """Event type; always 'findall.status'.""" + + +FindallRunStatusEvent = FindAllRunStatusEvent # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllRunStatusEvent` should be used instead""" diff --git a/src/parallel/types/beta/findall_schema.py b/src/parallel/types/beta/findall_schema.py index 5749a29..d214db7 100644 --- a/src/parallel/types/beta/findall_schema.py +++ b/src/parallel/types/beta/findall_schema.py @@ -4,12 +4,14 @@ from typing_extensions import Literal from ..._models import BaseModel -from .findall_enrich_input import FindallEnrichInput +from .findall_enrich_input import FindAllEnrichInput -__all__ = ["FindallSchema", "MatchCondition"] +__all__ = ["FindAllSchema", "FindallSchema", "MatchCondition"] class MatchCondition(BaseModel): + """Match condition model for FindAll ingest.""" + description: str """Detailed description of the match condition. @@ -21,7 +23,9 @@ class MatchCondition(BaseModel): """Name of the match condition.""" -class FindallSchema(BaseModel): +class FindAllSchema(BaseModel): + """Response model for FindAll ingest.""" + entity_type: str """Type of the entity for the FindAll run.""" @@ -31,7 +35,7 @@ class FindallSchema(BaseModel): objective: str """Natural language objective of the FindAll run.""" - enrichments: Optional[List[FindallEnrichInput]] = None + enrichments: Optional[List[FindAllEnrichInput]] = None """List of enrichment inputs for the FindAll run.""" generator: Optional[Literal["base", "core", "pro", "preview"]] = None @@ -39,3 +43,7 @@ class FindallSchema(BaseModel): match_limit: Optional[int] = None """Max number of candidates to evaluate""" + + +FindallSchema = FindAllSchema # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllSchema` should be used instead""" diff --git a/src/parallel/types/beta/findall_schema_updated_event.py b/src/parallel/types/beta/findall_schema_updated_event.py index 1d56d56..7eab28c 100644 --- a/src/parallel/types/beta/findall_schema_updated_event.py +++ b/src/parallel/types/beta/findall_schema_updated_event.py @@ -4,14 +4,16 @@ from typing_extensions import Literal from ..._models import BaseModel -from .findall_schema import FindallSchema +from .findall_schema import FindAllSchema -__all__ = ["FindallSchemaUpdatedEvent"] +__all__ = ["FindAllSchemaUpdatedEvent", "FindallSchemaUpdatedEvent"] -class FindallSchemaUpdatedEvent(BaseModel): - data: FindallSchema - """Response model for FindAll ingest.""" +class FindAllSchemaUpdatedEvent(BaseModel): + """Event containing full snapshot of FindAll run state.""" + + data: FindAllSchema + """Updated FindAll schema.""" event_id: str """Unique event identifier for the event.""" @@ -21,3 +23,7 @@ class FindallSchemaUpdatedEvent(BaseModel): type: Literal["findall.schema.updated"] """Event type; always 'findall.schema.updated'.""" + + +FindallSchemaUpdatedEvent = FindAllSchemaUpdatedEvent # for backwards compatibility with v0.3.4 +"""This is deprecated, `FindAllSchemaUpdatedEvent` should be used instead""" diff --git a/src/parallel/types/beta/mcp_server.py b/src/parallel/types/beta/mcp_server.py index 192493f..f0d8d12 100644 --- a/src/parallel/types/beta/mcp_server.py +++ b/src/parallel/types/beta/mcp_server.py @@ -9,6 +9,8 @@ class McpServer(BaseModel): + """MCP server configuration.""" + name: str """Name of the MCP server.""" diff --git a/src/parallel/types/beta/mcp_server_param.py b/src/parallel/types/beta/mcp_server_param.py index e29bea8..02052a2 100644 --- a/src/parallel/types/beta/mcp_server_param.py +++ b/src/parallel/types/beta/mcp_server_param.py @@ -11,6 +11,8 @@ class McpServerParam(TypedDict, total=False): + """MCP server configuration.""" + name: Required[str] """Name of the MCP server.""" diff --git a/src/parallel/types/beta/mcp_tool_call.py b/src/parallel/types/beta/mcp_tool_call.py index daa7cca..d04b217 100644 --- a/src/parallel/types/beta/mcp_tool_call.py +++ b/src/parallel/types/beta/mcp_tool_call.py @@ -8,6 +8,8 @@ class McpToolCall(BaseModel): + """Result of an MCP tool call.""" + arguments: str """Arguments used to call the MCP tool.""" diff --git a/src/parallel/types/beta/parallel_beta_param.py b/src/parallel/types/beta/parallel_beta_param.py index e723503..03e848e 100644 --- a/src/parallel/types/beta/parallel_beta_param.py +++ b/src/parallel/types/beta/parallel_beta_param.py @@ -14,6 +14,7 @@ "webhook-2025-08-12", "findall-2025-09-15", "search-extract-2025-10-10", + "field-basis-2025-11-25", ], str, ] diff --git a/src/parallel/types/beta/search_result.py b/src/parallel/types/beta/search_result.py index 440df65..c7dd935 100644 --- a/src/parallel/types/beta/search_result.py +++ b/src/parallel/types/beta/search_result.py @@ -11,6 +11,8 @@ class SearchResult(BaseModel): + """Output for the Search API.""" + results: List[WebSearchResult] """A list of WebSearchResult objects, ordered by decreasing relevance.""" diff --git a/src/parallel/types/beta/task_group.py b/src/parallel/types/beta/task_group.py index 247bddb..ba452dc 100644 --- a/src/parallel/types/beta/task_group.py +++ b/src/parallel/types/beta/task_group.py @@ -11,11 +11,13 @@ class TaskGroup(BaseModel): + """Response object for a task group, including its status and metadata.""" + created_at: Optional[str] = None """Timestamp of the creation of the group, as an RFC 3339 string.""" status: TaskGroupStatus - """Status of a task group.""" + """Status of the group.""" task_group_id: str = FieldInfo(alias="taskgroup_id") """ID of the group.""" diff --git a/src/parallel/types/beta/task_group_events_response.py b/src/parallel/types/beta/task_group_events_response.py index cbb6522..c1db25b 100644 --- a/src/parallel/types/beta/task_group_events_response.py +++ b/src/parallel/types/beta/task_group_events_response.py @@ -13,11 +13,13 @@ class TaskGroupStatusEvent(BaseModel): + """Event indicating an update to group status.""" + event_id: str """Cursor to resume the event stream.""" status: TaskGroupStatus - """Status of a task group.""" + """Task group status object.""" type: Literal["task_group_status"] """Event type; always 'task_group_status'.""" diff --git a/src/parallel/types/beta/task_group_run_response.py b/src/parallel/types/beta/task_group_run_response.py index 98161bb..59acedf 100644 --- a/src/parallel/types/beta/task_group_run_response.py +++ b/src/parallel/types/beta/task_group_run_response.py @@ -9,6 +9,8 @@ class TaskGroupRunResponse(BaseModel): + """Response from adding new task runs to a task group.""" + event_cursor: Optional[str] = None """ Cursor for these runs in the event stream at @@ -27,4 +29,4 @@ class TaskGroupRunResponse(BaseModel): """IDs of the newly created runs.""" status: TaskGroupStatus - """Status of a task group.""" + """Status of the group.""" diff --git a/src/parallel/types/beta/task_group_status.py b/src/parallel/types/beta/task_group_status.py index 221b527..0628c5d 100644 --- a/src/parallel/types/beta/task_group_status.py +++ b/src/parallel/types/beta/task_group_status.py @@ -8,6 +8,8 @@ class TaskGroupStatus(BaseModel): + """Status of a task group.""" + is_active: bool """True if at least one run in the group is currently active, i.e. diff --git a/src/parallel/types/beta/task_run_event.py b/src/parallel/types/beta/task_run_event.py index 7d809fe..c4c6c2f 100644 --- a/src/parallel/types/beta/task_run_event.py +++ b/src/parallel/types/beta/task_run_event.py @@ -16,11 +16,16 @@ class TaskRunEvent(BaseModel): + """Event when a task run transitions to a non-active status. + + May indicate completion, cancellation, or failure. + """ + event_id: Optional[str] = None """Cursor to resume the event stream. Always empty for non Task Group runs.""" run: TaskRun - """Status of a task run.""" + """Task run object.""" type: Literal["task_run.state"] """Event type; always 'task_run.state'.""" diff --git a/src/parallel/types/beta/task_run_events_response.py b/src/parallel/types/beta/task_run_events_response.py index e344ef1..79088f5 100644 --- a/src/parallel/types/beta/task_run_events_response.py +++ b/src/parallel/types/beta/task_run_events_response.py @@ -17,6 +17,8 @@ class TaskRunProgressStatsEventSourceStats(BaseModel): + """Source stats describing progress so far.""" + num_sources_considered: Optional[int] = None """Number of sources considered in processing the task.""" @@ -28,6 +30,8 @@ class TaskRunProgressStatsEventSourceStats(BaseModel): class TaskRunProgressStatsEvent(BaseModel): + """A progress update for a task run.""" + progress_meter: float """Completion percentage of the task run. @@ -35,13 +39,15 @@ class TaskRunProgressStatsEvent(BaseModel): """ source_stats: TaskRunProgressStatsEventSourceStats - """Source stats for a task run.""" + """Source stats describing progress so far.""" type: Literal["task_run.progress_stats"] """Event type; always 'task_run.progress_stats'.""" class TaskRunProgressMessageEvent(BaseModel): + """A message for a task run progress update.""" + message: str """Progress update message.""" diff --git a/src/parallel/types/beta/usage_item.py b/src/parallel/types/beta/usage_item.py index 325b27c..b3584bd 100644 --- a/src/parallel/types/beta/usage_item.py +++ b/src/parallel/types/beta/usage_item.py @@ -6,6 +6,8 @@ class UsageItem(BaseModel): + """Usage item for a single operation.""" + count: int """Count of the SKU.""" diff --git a/src/parallel/types/beta/web_search_result.py b/src/parallel/types/beta/web_search_result.py index 54952e2..aaf78ec 100644 --- a/src/parallel/types/beta/web_search_result.py +++ b/src/parallel/types/beta/web_search_result.py @@ -8,6 +8,8 @@ class WebSearchResult(BaseModel): + """A single search result from the web search API.""" + url: str """URL associated with the search result.""" diff --git a/src/parallel/types/beta/webhook.py b/src/parallel/types/beta/webhook.py index afa1b5b..6741b89 100644 --- a/src/parallel/types/beta/webhook.py +++ b/src/parallel/types/beta/webhook.py @@ -9,6 +9,8 @@ class Webhook(BaseModel): + """Webhooks for Task Runs.""" + url: str """URL for the webhook.""" diff --git a/src/parallel/types/beta/webhook_param.py b/src/parallel/types/beta/webhook_param.py index b7e6cd6..90a667d 100644 --- a/src/parallel/types/beta/webhook_param.py +++ b/src/parallel/types/beta/webhook_param.py @@ -9,6 +9,8 @@ class WebhookParam(TypedDict, total=False): + """Webhooks for Task Runs.""" + url: Required[str] """URL for the webhook.""" diff --git a/src/parallel/types/citation.py b/src/parallel/types/citation.py index 2a3abb5..8f01b2c 100644 --- a/src/parallel/types/citation.py +++ b/src/parallel/types/citation.py @@ -8,6 +8,8 @@ class Citation(BaseModel): + """A citation for a task output.""" + url: str """URL of the citation.""" diff --git a/src/parallel/types/field_basis.py b/src/parallel/types/field_basis.py index de4d4a1..df288f3 100644 --- a/src/parallel/types/field_basis.py +++ b/src/parallel/types/field_basis.py @@ -9,6 +9,8 @@ class FieldBasis(BaseModel): + """Citations and reasoning supporting one field of a task output.""" + field: str """Name of the output field.""" diff --git a/src/parallel/types/json_schema.py b/src/parallel/types/json_schema.py index 7bff20b..44e8fd3 100644 --- a/src/parallel/types/json_schema.py +++ b/src/parallel/types/json_schema.py @@ -9,6 +9,8 @@ class JsonSchema(BaseModel): + """JSON schema for a task input or output.""" + json_schema: Dict[str, object] """A JSON Schema object. Only a subset of JSON Schema is supported.""" diff --git a/src/parallel/types/json_schema_param.py b/src/parallel/types/json_schema_param.py index 90bae27..e2599bb 100644 --- a/src/parallel/types/json_schema_param.py +++ b/src/parallel/types/json_schema_param.py @@ -9,6 +9,8 @@ class JsonSchemaParam(TypedDict, total=False): + """JSON schema for a task input or output.""" + json_schema: Required[Dict[str, object]] """A JSON Schema object. Only a subset of JSON Schema is supported.""" diff --git a/src/parallel/types/shared/error_object.py b/src/parallel/types/shared/error_object.py index 52b9656..d328532 100644 --- a/src/parallel/types/shared/error_object.py +++ b/src/parallel/types/shared/error_object.py @@ -8,6 +8,8 @@ class ErrorObject(BaseModel): + """An error message.""" + message: str """Human-readable message.""" diff --git a/src/parallel/types/shared/error_response.py b/src/parallel/types/shared/error_response.py index 4a72af6..14ebe29 100644 --- a/src/parallel/types/shared/error_response.py +++ b/src/parallel/types/shared/error_response.py @@ -9,8 +9,10 @@ class ErrorResponse(BaseModel): + """Response object used for non-200 status codes.""" + error: ErrorObject - """An error message.""" + """Error.""" type: Literal["error"] """Always 'error'.""" diff --git a/src/parallel/types/shared/source_policy.py b/src/parallel/types/shared/source_policy.py index 19daba9..7ea1deb 100644 --- a/src/parallel/types/shared/source_policy.py +++ b/src/parallel/types/shared/source_policy.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Optional +from datetime import date from ..._models import BaseModel @@ -8,6 +9,18 @@ class SourcePolicy(BaseModel): + """Source policy for web search results. + + This policy governs which sources are allowed/disallowed in results. + """ + + after_date: Optional[date] = None + """Optional start date for filtering search results. + + Results will be limited to content published on or after this date. Provided as + an RFC 3339 date string (YYYY-MM-DD). + """ + exclude_domains: Optional[List[str]] = None """List of domains to exclude from results. diff --git a/src/parallel/types/shared/warning.py b/src/parallel/types/shared/warning.py index 84a2b84..e9856ec 100644 --- a/src/parallel/types/shared/warning.py +++ b/src/parallel/types/shared/warning.py @@ -9,6 +9,8 @@ class Warning(BaseModel): + """Human-readable message for a task.""" + message: str """Human-readable message.""" diff --git a/src/parallel/types/shared_params/source_policy.py b/src/parallel/types/shared_params/source_policy.py index 8330dd0..c3da049 100644 --- a/src/parallel/types/shared_params/source_policy.py +++ b/src/parallel/types/shared_params/source_policy.py @@ -2,14 +2,29 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing import Union +from datetime import date +from typing_extensions import Annotated, TypedDict from ..._types import SequenceNotStr +from ..._utils import PropertyInfo __all__ = ["SourcePolicy"] class SourcePolicy(TypedDict, total=False): + """Source policy for web search results. + + This policy governs which sources are allowed/disallowed in results. + """ + + after_date: Annotated[Union[str, date, None], PropertyInfo(format="iso8601")] + """Optional start date for filtering search results. + + Results will be limited to content published on or after this date. Provided as + an RFC 3339 date string (YYYY-MM-DD). + """ + exclude_domains: SequenceNotStr[str] """List of domains to exclude from results. diff --git a/src/parallel/types/task_run.py b/src/parallel/types/task_run.py index 8ac2d93..fceb400 100644 --- a/src/parallel/types/task_run.py +++ b/src/parallel/types/task_run.py @@ -16,6 +16,8 @@ class TaskRun(BaseModel): + """Status of a task run.""" + created_at: Optional[str] = None """Timestamp of the creation of the task, as an RFC 3339 string.""" diff --git a/src/parallel/types/task_run_json_output.py b/src/parallel/types/task_run_json_output.py index ee63e60..8541b61 100644 --- a/src/parallel/types/task_run_json_output.py +++ b/src/parallel/types/task_run_json_output.py @@ -10,8 +10,14 @@ class TaskRunJsonOutput(BaseModel): + """Output from a task that returns JSON.""" + basis: List[FieldBasis] - """Basis for each top-level field in the JSON output.""" + """Basis for each top-level field in the JSON output. + + Per-list-element basis entries are available only when the + `parallel-beta: field-basis-2025-11-25` header is supplied. + """ content: Dict[str, object] """ diff --git a/src/parallel/types/task_run_result.py b/src/parallel/types/task_run_result.py index 087cdce..fb9d39e 100644 --- a/src/parallel/types/task_run_result.py +++ b/src/parallel/types/task_run_result.py @@ -45,8 +45,10 @@ class TaskRunResult(BaseModel): + """Result of a task run.""" + output: Output """Output from the task conforming to the output schema.""" run: TaskRun - """Status of a task run.""" + """Task run object with status 'completed'.""" diff --git a/src/parallel/types/task_run_text_output.py b/src/parallel/types/task_run_text_output.py index ef38d7e..5d7e4c6 100644 --- a/src/parallel/types/task_run_text_output.py +++ b/src/parallel/types/task_run_text_output.py @@ -10,6 +10,8 @@ class TaskRunTextOutput(BaseModel): + """Output from a task that returns text.""" + basis: List[FieldBasis] """Basis for the output. The basis has a single field 'output'.""" diff --git a/src/parallel/types/task_spec.py b/src/parallel/types/task_spec.py index fc7aefe..91bddfb 100644 --- a/src/parallel/types/task_spec.py +++ b/src/parallel/types/task_spec.py @@ -16,6 +16,14 @@ class TaskSpec(BaseModel): + """Specification for a task. + + Auto output schemas can be specified by setting `output_schema={"type":"auto"}`. Not + specifying a TaskSpec is the same as setting an auto output schema. + + For convenience bare strings are also accepted as input or output schemas. + """ + output_schema: OutputSchema """JSON schema or text fully describing the desired output from the task. diff --git a/src/parallel/types/task_spec_param.py b/src/parallel/types/task_spec_param.py index ae434bf..e625263 100644 --- a/src/parallel/types/task_spec_param.py +++ b/src/parallel/types/task_spec_param.py @@ -21,6 +21,14 @@ class TaskSpecParam(TypedDict, total=False): + """Specification for a task. + + Auto output schemas can be specified by setting `output_schema={"type":"auto"}`. Not + specifying a TaskSpec is the same as setting an auto output schema. + + For convenience bare strings are also accepted as input or output schemas. + """ + output_schema: Required[OutputSchema] """JSON schema or text fully describing the desired output from the task. diff --git a/src/parallel/types/text_schema.py b/src/parallel/types/text_schema.py index 0c658e8..10b2e8f 100644 --- a/src/parallel/types/text_schema.py +++ b/src/parallel/types/text_schema.py @@ -9,6 +9,8 @@ class TextSchema(BaseModel): + """Text description for a task input or output.""" + description: Optional[str] = None """A text description of the desired output from the task.""" diff --git a/src/parallel/types/text_schema_param.py b/src/parallel/types/text_schema_param.py index d200099..d333015 100644 --- a/src/parallel/types/text_schema_param.py +++ b/src/parallel/types/text_schema_param.py @@ -9,6 +9,8 @@ class TextSchemaParam(TypedDict, total=False): + """Text description for a task input or output.""" + description: Optional[str] """A text description of the desired output from the task.""" diff --git a/tests/api_resources/beta/test_findall.py b/tests/api_resources/beta/test_findall.py index 4eacbca..b4bb063 100644 --- a/tests/api_resources/beta/test_findall.py +++ b/tests/api_resources/beta/test_findall.py @@ -10,16 +10,15 @@ from parallel import Parallel, AsyncParallel from tests.utils import assert_matches_type from parallel.types.beta import ( - FindallRun, - FindallSchema, - FindallRunResult, - FindallRetrieveResponse, + FindAllRun, + FindAllSchema, + FindAllRunResult, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestFindall: +class TestFindAll: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize @@ -36,7 +35,7 @@ def test_method_create(self, client: Parallel) -> None: match_limit=0, objective="objective", ) - assert_matches_type(FindallRun, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Parallel) -> None: @@ -64,7 +63,7 @@ def test_method_create_with_all_params(self, client: Parallel) -> None: }, betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallRun, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) @parametrize def test_raw_response_create(self, client: Parallel) -> None: @@ -84,7 +83,7 @@ def test_raw_response_create(self, client: Parallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallRun, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) @parametrize def test_streaming_response_create(self, client: Parallel) -> None: @@ -104,7 +103,7 @@ def test_streaming_response_create(self, client: Parallel) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallRun, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -113,7 +112,7 @@ def test_method_retrieve(self, client: Parallel) -> None: findall = client.beta.findall.retrieve( findall_id="findall_id", ) - assert_matches_type(FindallRetrieveResponse, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) @parametrize def test_method_retrieve_with_all_params(self, client: Parallel) -> None: @@ -121,7 +120,7 @@ def test_method_retrieve_with_all_params(self, client: Parallel) -> None: findall_id="findall_id", betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallRetrieveResponse, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Parallel) -> None: @@ -132,7 +131,7 @@ def test_raw_response_retrieve(self, client: Parallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallRetrieveResponse, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: Parallel) -> None: @@ -143,7 +142,7 @@ def test_streaming_response_retrieve(self, client: Parallel) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallRetrieveResponse, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -213,7 +212,7 @@ def test_method_enrich(self, client: Parallel) -> None: } }, ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize def test_method_enrich_with_all_params(self, client: Parallel) -> None: @@ -240,7 +239,7 @@ def test_method_enrich_with_all_params(self, client: Parallel) -> None: processor="processor", betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize def test_raw_response_enrich(self, client: Parallel) -> None: @@ -259,7 +258,7 @@ def test_raw_response_enrich(self, client: Parallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize def test_streaming_response_enrich(self, client: Parallel) -> None: @@ -278,7 +277,7 @@ def test_streaming_response_enrich(self, client: Parallel) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -355,7 +354,7 @@ def test_method_extend(self, client: Parallel) -> None: findall_id="findall_id", additional_match_limit=0, ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize def test_method_extend_with_all_params(self, client: Parallel) -> None: @@ -364,7 +363,7 @@ def test_method_extend_with_all_params(self, client: Parallel) -> None: additional_match_limit=0, betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize def test_raw_response_extend(self, client: Parallel) -> None: @@ -376,7 +375,7 @@ def test_raw_response_extend(self, client: Parallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize def test_streaming_response_extend(self, client: Parallel) -> None: @@ -388,7 +387,7 @@ def test_streaming_response_extend(self, client: Parallel) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -405,7 +404,7 @@ def test_method_ingest(self, client: Parallel) -> None: findall = client.beta.findall.ingest( objective="Find all AI companies that raised Series A funding in 2024", ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize def test_method_ingest_with_all_params(self, client: Parallel) -> None: @@ -413,7 +412,7 @@ def test_method_ingest_with_all_params(self, client: Parallel) -> None: objective="Find all AI companies that raised Series A funding in 2024", betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize def test_raw_response_ingest(self, client: Parallel) -> None: @@ -424,7 +423,7 @@ def test_raw_response_ingest(self, client: Parallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize def test_streaming_response_ingest(self, client: Parallel) -> None: @@ -435,7 +434,7 @@ def test_streaming_response_ingest(self, client: Parallel) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -444,7 +443,7 @@ def test_method_result(self, client: Parallel) -> None: findall = client.beta.findall.result( findall_id="findall_id", ) - assert_matches_type(FindallRunResult, findall, path=["response"]) + assert_matches_type(FindAllRunResult, findall, path=["response"]) @parametrize def test_method_result_with_all_params(self, client: Parallel) -> None: @@ -452,7 +451,7 @@ def test_method_result_with_all_params(self, client: Parallel) -> None: findall_id="findall_id", betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallRunResult, findall, path=["response"]) + assert_matches_type(FindAllRunResult, findall, path=["response"]) @parametrize def test_raw_response_result(self, client: Parallel) -> None: @@ -463,7 +462,7 @@ def test_raw_response_result(self, client: Parallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallRunResult, findall, path=["response"]) + assert_matches_type(FindAllRunResult, findall, path=["response"]) @parametrize def test_streaming_response_result(self, client: Parallel) -> None: @@ -474,7 +473,7 @@ def test_streaming_response_result(self, client: Parallel) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallRunResult, findall, path=["response"]) + assert_matches_type(FindAllRunResult, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -490,7 +489,7 @@ def test_method_schema(self, client: Parallel) -> None: findall = client.beta.findall.schema( findall_id="findall_id", ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize def test_method_schema_with_all_params(self, client: Parallel) -> None: @@ -498,7 +497,7 @@ def test_method_schema_with_all_params(self, client: Parallel) -> None: findall_id="findall_id", betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize def test_raw_response_schema(self, client: Parallel) -> None: @@ -509,7 +508,7 @@ def test_raw_response_schema(self, client: Parallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize def test_streaming_response_schema(self, client: Parallel) -> None: @@ -520,7 +519,7 @@ def test_streaming_response_schema(self, client: Parallel) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -532,7 +531,7 @@ def test_path_params_schema(self, client: Parallel) -> None: ) -class TestAsyncFindall: +class TestAsyncFindAll: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @@ -551,7 +550,7 @@ async def test_method_create(self, async_client: AsyncParallel) -> None: match_limit=0, objective="objective", ) - assert_matches_type(FindallRun, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncParallel) -> None: @@ -579,7 +578,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncParallel) }, betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallRun, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncParallel) -> None: @@ -599,7 +598,7 @@ async def test_raw_response_create(self, async_client: AsyncParallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallRun, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncParallel) -> None: @@ -619,7 +618,7 @@ async def test_streaming_response_create(self, async_client: AsyncParallel) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallRun, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -628,7 +627,7 @@ async def test_method_retrieve(self, async_client: AsyncParallel) -> None: findall = await async_client.beta.findall.retrieve( findall_id="findall_id", ) - assert_matches_type(FindallRetrieveResponse, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncParallel) -> None: @@ -636,7 +635,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncParallel findall_id="findall_id", betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallRetrieveResponse, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncParallel) -> None: @@ -647,7 +646,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncParallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallRetrieveResponse, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncParallel) -> None: @@ -658,7 +657,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncParallel) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallRetrieveResponse, findall, path=["response"]) + assert_matches_type(FindAllRun, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -728,7 +727,7 @@ async def test_method_enrich(self, async_client: AsyncParallel) -> None: } }, ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize async def test_method_enrich_with_all_params(self, async_client: AsyncParallel) -> None: @@ -755,7 +754,7 @@ async def test_method_enrich_with_all_params(self, async_client: AsyncParallel) processor="processor", betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize async def test_raw_response_enrich(self, async_client: AsyncParallel) -> None: @@ -774,7 +773,7 @@ async def test_raw_response_enrich(self, async_client: AsyncParallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize async def test_streaming_response_enrich(self, async_client: AsyncParallel) -> None: @@ -793,7 +792,7 @@ async def test_streaming_response_enrich(self, async_client: AsyncParallel) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -870,7 +869,7 @@ async def test_method_extend(self, async_client: AsyncParallel) -> None: findall_id="findall_id", additional_match_limit=0, ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize async def test_method_extend_with_all_params(self, async_client: AsyncParallel) -> None: @@ -879,7 +878,7 @@ async def test_method_extend_with_all_params(self, async_client: AsyncParallel) additional_match_limit=0, betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize async def test_raw_response_extend(self, async_client: AsyncParallel) -> None: @@ -891,7 +890,7 @@ async def test_raw_response_extend(self, async_client: AsyncParallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize async def test_streaming_response_extend(self, async_client: AsyncParallel) -> None: @@ -903,7 +902,7 @@ async def test_streaming_response_extend(self, async_client: AsyncParallel) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -920,7 +919,7 @@ async def test_method_ingest(self, async_client: AsyncParallel) -> None: findall = await async_client.beta.findall.ingest( objective="Find all AI companies that raised Series A funding in 2024", ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize async def test_method_ingest_with_all_params(self, async_client: AsyncParallel) -> None: @@ -928,7 +927,7 @@ async def test_method_ingest_with_all_params(self, async_client: AsyncParallel) objective="Find all AI companies that raised Series A funding in 2024", betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize async def test_raw_response_ingest(self, async_client: AsyncParallel) -> None: @@ -939,7 +938,7 @@ async def test_raw_response_ingest(self, async_client: AsyncParallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize async def test_streaming_response_ingest(self, async_client: AsyncParallel) -> None: @@ -950,7 +949,7 @@ async def test_streaming_response_ingest(self, async_client: AsyncParallel) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -959,7 +958,7 @@ async def test_method_result(self, async_client: AsyncParallel) -> None: findall = await async_client.beta.findall.result( findall_id="findall_id", ) - assert_matches_type(FindallRunResult, findall, path=["response"]) + assert_matches_type(FindAllRunResult, findall, path=["response"]) @parametrize async def test_method_result_with_all_params(self, async_client: AsyncParallel) -> None: @@ -967,7 +966,7 @@ async def test_method_result_with_all_params(self, async_client: AsyncParallel) findall_id="findall_id", betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallRunResult, findall, path=["response"]) + assert_matches_type(FindAllRunResult, findall, path=["response"]) @parametrize async def test_raw_response_result(self, async_client: AsyncParallel) -> None: @@ -978,7 +977,7 @@ async def test_raw_response_result(self, async_client: AsyncParallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallRunResult, findall, path=["response"]) + assert_matches_type(FindAllRunResult, findall, path=["response"]) @parametrize async def test_streaming_response_result(self, async_client: AsyncParallel) -> None: @@ -989,7 +988,7 @@ async def test_streaming_response_result(self, async_client: AsyncParallel) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallRunResult, findall, path=["response"]) + assert_matches_type(FindAllRunResult, findall, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1005,7 +1004,7 @@ async def test_method_schema(self, async_client: AsyncParallel) -> None: findall = await async_client.beta.findall.schema( findall_id="findall_id", ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize async def test_method_schema_with_all_params(self, async_client: AsyncParallel) -> None: @@ -1013,7 +1012,7 @@ async def test_method_schema_with_all_params(self, async_client: AsyncParallel) findall_id="findall_id", betas=["mcp-server-2025-07-17"], ) - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize async def test_raw_response_schema(self, async_client: AsyncParallel) -> None: @@ -1024,7 +1023,7 @@ async def test_raw_response_schema(self, async_client: AsyncParallel) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) @parametrize async def test_streaming_response_schema(self, async_client: AsyncParallel) -> None: @@ -1035,7 +1034,7 @@ async def test_streaming_response_schema(self, async_client: AsyncParallel) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" findall = await response.parse() - assert_matches_type(FindallSchema, findall, path=["response"]) + assert_matches_type(FindAllSchema, findall, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/beta/test_task_group.py b/tests/api_resources/beta/test_task_group.py index 664b2f7..321e47e 100644 --- a/tests/api_resources/beta/test_task_group.py +++ b/tests/api_resources/beta/test_task_group.py @@ -9,6 +9,7 @@ from parallel import Parallel, AsyncParallel from tests.utils import assert_matches_type +from parallel._utils import parse_date from parallel.types.beta import ( TaskGroup, TaskGroupRunResponse, @@ -123,6 +124,7 @@ def test_method_add_runs_with_all_params(self, client: Parallel) -> None: ], "metadata": {"foo": "string"}, "source_policy": { + "after_date": parse_date("2024-01-01"), "exclude_domains": ["reddit.com", "x.com", ".ai"], "include_domains": ["wikipedia.org", "usa.gov", ".edu"], }, @@ -422,6 +424,7 @@ async def test_method_add_runs_with_all_params(self, async_client: AsyncParallel ], "metadata": {"foo": "string"}, "source_policy": { + "after_date": parse_date("2024-01-01"), "exclude_domains": ["reddit.com", "x.com", ".ai"], "include_domains": ["wikipedia.org", "usa.gov", ".edu"], }, diff --git a/tests/api_resources/beta/test_task_run.py b/tests/api_resources/beta/test_task_run.py index 766ea43..6728cbd 100644 --- a/tests/api_resources/beta/test_task_run.py +++ b/tests/api_resources/beta/test_task_run.py @@ -10,6 +10,7 @@ from parallel import Parallel, AsyncParallel from tests.utils import assert_matches_type from parallel.types import TaskRun +from parallel._utils import parse_date from parallel.types.beta import BetaTaskRunResult base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -43,6 +44,7 @@ def test_method_create_with_all_params(self, client: Parallel) -> None: ], metadata={"foo": "string"}, source_policy={ + "after_date": parse_date("2024-01-01"), "exclude_domains": ["reddit.com", "x.com", ".ai"], "include_domains": ["wikipedia.org", "usa.gov", ".edu"], }, @@ -211,6 +213,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncParallel) ], metadata={"foo": "string"}, source_policy={ + "after_date": parse_date("2024-01-01"), "exclude_domains": ["reddit.com", "x.com", ".ai"], "include_domains": ["wikipedia.org", "usa.gov", ".edu"], }, diff --git a/tests/api_resources/test_beta.py b/tests/api_resources/test_beta.py index 216a30f..02f4f66 100644 --- a/tests/api_resources/test_beta.py +++ b/tests/api_resources/test_beta.py @@ -9,6 +9,7 @@ from parallel import Parallel, AsyncParallel from tests.utils import assert_matches_type +from parallel._utils import parse_date from parallel.types.beta import ( SearchResult, ExtractResponse, @@ -24,6 +25,7 @@ class TestBeta: def test_method_extract(self, client: Parallel) -> None: beta = client.beta.extract( urls=["string"], + betas=["mcp-server-2025-07-17"], ) assert_matches_type(ExtractResponse, beta, path=["response"]) @@ -31,6 +33,7 @@ def test_method_extract(self, client: Parallel) -> None: def test_method_extract_with_all_params(self, client: Parallel) -> None: beta = client.beta.extract( urls=["string"], + betas=["mcp-server-2025-07-17"], excerpts=True, fetch_policy={ "disable_cache_fallback": True, @@ -40,7 +43,6 @@ def test_method_extract_with_all_params(self, client: Parallel) -> None: full_content=True, objective="objective", search_queries=["string"], - betas=["mcp-server-2025-07-17"], ) assert_matches_type(ExtractResponse, beta, path=["response"]) @@ -48,6 +50,7 @@ def test_method_extract_with_all_params(self, client: Parallel) -> None: def test_raw_response_extract(self, client: Parallel) -> None: response = client.beta.with_raw_response.extract( urls=["string"], + betas=["mcp-server-2025-07-17"], ) assert response.is_closed is True @@ -59,6 +62,7 @@ def test_raw_response_extract(self, client: Parallel) -> None: def test_streaming_response_extract(self, client: Parallel) -> None: with client.beta.with_streaming_response.extract( urls=["string"], + betas=["mcp-server-2025-07-17"], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -76,7 +80,10 @@ def test_method_search(self, client: Parallel) -> None: @parametrize def test_method_search_with_all_params(self, client: Parallel) -> None: beta = client.beta.search( - excerpts={"max_chars_per_result": 0}, + excerpts={ + "max_chars_per_result": 0, + "max_chars_total": 0, + }, fetch_policy={ "disable_cache_fallback": True, "max_age_seconds": 86400, @@ -89,6 +96,7 @@ def test_method_search_with_all_params(self, client: Parallel) -> None: processor="base", search_queries=["string"], source_policy={ + "after_date": parse_date("2024-01-01"), "exclude_domains": ["reddit.com", "x.com", ".ai"], "include_domains": ["wikipedia.org", "usa.gov", ".edu"], }, @@ -126,6 +134,7 @@ class TestAsyncBeta: async def test_method_extract(self, async_client: AsyncParallel) -> None: beta = await async_client.beta.extract( urls=["string"], + betas=["mcp-server-2025-07-17"], ) assert_matches_type(ExtractResponse, beta, path=["response"]) @@ -133,6 +142,7 @@ async def test_method_extract(self, async_client: AsyncParallel) -> None: async def test_method_extract_with_all_params(self, async_client: AsyncParallel) -> None: beta = await async_client.beta.extract( urls=["string"], + betas=["mcp-server-2025-07-17"], excerpts=True, fetch_policy={ "disable_cache_fallback": True, @@ -142,7 +152,6 @@ async def test_method_extract_with_all_params(self, async_client: AsyncParallel) full_content=True, objective="objective", search_queries=["string"], - betas=["mcp-server-2025-07-17"], ) assert_matches_type(ExtractResponse, beta, path=["response"]) @@ -150,6 +159,7 @@ async def test_method_extract_with_all_params(self, async_client: AsyncParallel) async def test_raw_response_extract(self, async_client: AsyncParallel) -> None: response = await async_client.beta.with_raw_response.extract( urls=["string"], + betas=["mcp-server-2025-07-17"], ) assert response.is_closed is True @@ -161,6 +171,7 @@ async def test_raw_response_extract(self, async_client: AsyncParallel) -> None: async def test_streaming_response_extract(self, async_client: AsyncParallel) -> None: async with async_client.beta.with_streaming_response.extract( urls=["string"], + betas=["mcp-server-2025-07-17"], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -178,7 +189,10 @@ async def test_method_search(self, async_client: AsyncParallel) -> None: @parametrize async def test_method_search_with_all_params(self, async_client: AsyncParallel) -> None: beta = await async_client.beta.search( - excerpts={"max_chars_per_result": 0}, + excerpts={ + "max_chars_per_result": 0, + "max_chars_total": 0, + }, fetch_policy={ "disable_cache_fallback": True, "max_age_seconds": 86400, @@ -191,6 +205,7 @@ async def test_method_search_with_all_params(self, async_client: AsyncParallel) processor="base", search_queries=["string"], source_policy={ + "after_date": parse_date("2024-01-01"), "exclude_domains": ["reddit.com", "x.com", ".ai"], "include_domains": ["wikipedia.org", "usa.gov", ".edu"], }, diff --git a/tests/api_resources/test_task_run.py b/tests/api_resources/test_task_run.py index 93d2982..197c31b 100644 --- a/tests/api_resources/test_task_run.py +++ b/tests/api_resources/test_task_run.py @@ -10,6 +10,7 @@ from parallel import Parallel, AsyncParallel from tests.utils import assert_matches_type from parallel.types import TaskRun, TaskRunResult +from parallel._utils import parse_date base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -32,6 +33,7 @@ def test_method_create_with_all_params(self, client: Parallel) -> None: processor="base", metadata={"foo": "string"}, source_policy={ + "after_date": parse_date("2024-01-01"), "exclude_domains": ["reddit.com", "x.com", ".ai"], "include_domains": ["wikipedia.org", "usa.gov", ".edu"], }, @@ -181,6 +183,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncParallel) processor="base", metadata={"foo": "string"}, source_policy={ + "after_date": parse_date("2024-01-01"), "exclude_domains": ["reddit.com", "x.com", ".ai"], "include_domains": ["wikipedia.org", "usa.gov", ".edu"], },