parallel-web 0.1.3__py3-none-any.whl → 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of parallel-web might be problematic. Click here for more details.
- parallel/__init__.py +2 -1
- parallel/_base_client.py +37 -5
- parallel/_client.py +9 -0
- parallel/_compat.py +55 -54
- parallel/_files.py +4 -4
- parallel/_models.py +70 -46
- parallel/_types.py +35 -1
- parallel/_utils/__init__.py +9 -2
- parallel/_utils/_compat.py +45 -0
- parallel/_utils/_datetime_parse.py +136 -0
- parallel/_utils/_transform.py +11 -1
- parallel/_utils/_typing.py +6 -1
- parallel/_utils/_utils.py +0 -1
- parallel/_version.py +1 -1
- parallel/lib/_pydantic.py +4 -3
- parallel/resources/__init__.py +14 -0
- parallel/resources/beta/__init__.py +47 -0
- parallel/resources/beta/beta.py +301 -0
- parallel/resources/beta/task_group.py +632 -0
- parallel/resources/beta/task_run.py +499 -0
- parallel/resources/task_run.py +47 -18
- parallel/types/__init__.py +15 -0
- parallel/types/auto_schema.py +13 -0
- parallel/types/auto_schema_param.py +12 -0
- parallel/types/beta/__init__.py +30 -0
- parallel/types/beta/beta_run_input.py +63 -0
- parallel/types/beta/beta_run_input_param.py +65 -0
- parallel/types/beta/beta_search_params.py +48 -0
- parallel/types/beta/beta_task_run_result.py +74 -0
- parallel/types/beta/error_event.py +16 -0
- parallel/types/beta/mcp_server.py +25 -0
- parallel/types/beta/mcp_server_param.py +27 -0
- parallel/types/beta/mcp_tool_call.py +27 -0
- parallel/types/beta/parallel_beta_param.py +12 -0
- parallel/types/beta/search_result.py +16 -0
- parallel/types/beta/task_group.py +24 -0
- parallel/types/beta/task_group_add_runs_params.py +30 -0
- parallel/types/beta/task_group_create_params.py +13 -0
- parallel/types/beta/task_group_events_params.py +16 -0
- parallel/types/beta/task_group_events_response.py +28 -0
- parallel/types/beta/task_group_get_runs_params.py +18 -0
- parallel/types/beta/task_group_get_runs_response.py +12 -0
- parallel/types/beta/task_group_run_response.py +30 -0
- parallel/types/beta/task_group_status.py +27 -0
- parallel/types/beta/task_run_create_params.py +70 -0
- parallel/types/beta/task_run_event.py +32 -0
- parallel/types/beta/task_run_events_response.py +58 -0
- parallel/types/beta/task_run_result_params.py +18 -0
- parallel/types/beta/web_search_result.py +18 -0
- parallel/types/beta/webhook.py +16 -0
- parallel/types/beta/webhook_param.py +16 -0
- parallel/types/citation.py +21 -0
- parallel/types/field_basis.py +25 -0
- parallel/types/json_schema.py +16 -0
- parallel/types/json_schema_param.py +2 -1
- parallel/types/parsed_task_run_result.py +13 -4
- parallel/types/shared/__init__.py +6 -0
- parallel/types/shared/error_object.py +18 -0
- parallel/types/shared/error_response.py +16 -0
- parallel/types/shared/source_policy.py +21 -0
- parallel/types/shared/warning.py +22 -0
- parallel/types/shared_params/__init__.py +3 -0
- parallel/types/shared_params/source_policy.py +23 -0
- parallel/types/task_run.py +17 -18
- parallel/types/task_run_create_params.py +12 -3
- parallel/types/task_run_json_output.py +46 -0
- parallel/types/task_run_result.py +24 -94
- parallel/types/task_run_text_output.py +37 -0
- parallel/types/task_spec.py +31 -0
- parallel/types/task_spec_param.py +3 -2
- parallel/types/text_schema.py +16 -0
- parallel/types/text_schema_param.py +3 -2
- {parallel_web-0.1.3.dist-info → parallel_web-0.2.1.dist-info}/METADATA +23 -159
- parallel_web-0.2.1.dist-info/RECORD +96 -0
- parallel_web-0.1.3.dist-info/RECORD +0 -47
- {parallel_web-0.1.3.dist-info → parallel_web-0.2.1.dist-info}/WHEEL +0 -0
- {parallel_web-0.1.3.dist-info → parallel_web-0.2.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
|
|
11
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
|
12
|
+
from .task_run import (
|
|
13
|
+
TaskRunResource,
|
|
14
|
+
AsyncTaskRunResource,
|
|
15
|
+
TaskRunResourceWithRawResponse,
|
|
16
|
+
AsyncTaskRunResourceWithRawResponse,
|
|
17
|
+
TaskRunResourceWithStreamingResponse,
|
|
18
|
+
AsyncTaskRunResourceWithStreamingResponse,
|
|
19
|
+
)
|
|
20
|
+
from ..._compat import cached_property
|
|
21
|
+
from .task_group import (
|
|
22
|
+
TaskGroupResource,
|
|
23
|
+
AsyncTaskGroupResource,
|
|
24
|
+
TaskGroupResourceWithRawResponse,
|
|
25
|
+
AsyncTaskGroupResourceWithRawResponse,
|
|
26
|
+
TaskGroupResourceWithStreamingResponse,
|
|
27
|
+
AsyncTaskGroupResourceWithStreamingResponse,
|
|
28
|
+
)
|
|
29
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
30
|
+
from ..._response import (
|
|
31
|
+
to_raw_response_wrapper,
|
|
32
|
+
to_streamed_response_wrapper,
|
|
33
|
+
async_to_raw_response_wrapper,
|
|
34
|
+
async_to_streamed_response_wrapper,
|
|
35
|
+
)
|
|
36
|
+
from ...types.beta import beta_search_params
|
|
37
|
+
from ..._base_client import make_request_options
|
|
38
|
+
from ...types.beta.search_result import SearchResult
|
|
39
|
+
from ...types.shared_params.source_policy import SourcePolicy
|
|
40
|
+
|
|
41
|
+
__all__ = ["BetaResource", "AsyncBetaResource"]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class BetaResource(SyncAPIResource):
|
|
45
|
+
@cached_property
|
|
46
|
+
def task_run(self) -> TaskRunResource:
|
|
47
|
+
return TaskRunResource(self._client)
|
|
48
|
+
|
|
49
|
+
@cached_property
|
|
50
|
+
def task_group(self) -> TaskGroupResource:
|
|
51
|
+
return TaskGroupResource(self._client)
|
|
52
|
+
|
|
53
|
+
@cached_property
|
|
54
|
+
def with_raw_response(self) -> BetaResourceWithRawResponse:
|
|
55
|
+
"""
|
|
56
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
57
|
+
the raw response object instead of the parsed content.
|
|
58
|
+
|
|
59
|
+
For more information, see https://www.github.com/parallel-web/parallel-sdk-python#accessing-raw-response-data-eg-headers
|
|
60
|
+
"""
|
|
61
|
+
return BetaResourceWithRawResponse(self)
|
|
62
|
+
|
|
63
|
+
@cached_property
|
|
64
|
+
def with_streaming_response(self) -> BetaResourceWithStreamingResponse:
|
|
65
|
+
"""
|
|
66
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
67
|
+
|
|
68
|
+
For more information, see https://www.github.com/parallel-web/parallel-sdk-python#with_streaming_response
|
|
69
|
+
"""
|
|
70
|
+
return BetaResourceWithStreamingResponse(self)
|
|
71
|
+
|
|
72
|
+
def search(
|
|
73
|
+
self,
|
|
74
|
+
*,
|
|
75
|
+
max_chars_per_result: Optional[int] | NotGiven = NOT_GIVEN,
|
|
76
|
+
max_results: Optional[int] | NotGiven = NOT_GIVEN,
|
|
77
|
+
objective: Optional[str] | NotGiven = NOT_GIVEN,
|
|
78
|
+
processor: Literal["base", "pro"] | NotGiven = NOT_GIVEN,
|
|
79
|
+
search_queries: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
80
|
+
source_policy: Optional[SourcePolicy] | NotGiven = NOT_GIVEN,
|
|
81
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
82
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
83
|
+
extra_headers: Headers | None = None,
|
|
84
|
+
extra_query: Query | None = None,
|
|
85
|
+
extra_body: Body | None = None,
|
|
86
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
87
|
+
) -> SearchResult:
|
|
88
|
+
"""
|
|
89
|
+
Searches the web.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
max_chars_per_result: Upper bound on the number of characters to include in excerpts for each search
|
|
93
|
+
result.
|
|
94
|
+
|
|
95
|
+
max_results: Upper bound on the number of results to return. May be limited by the processor.
|
|
96
|
+
Defaults to 10 if not provided.
|
|
97
|
+
|
|
98
|
+
objective: Natural-language description of what the web search is trying to find. May
|
|
99
|
+
include guidance about preferred sources or freshness. At least one of objective
|
|
100
|
+
or search_queries must be provided.
|
|
101
|
+
|
|
102
|
+
processor: Search processor.
|
|
103
|
+
|
|
104
|
+
search_queries: Optional list of traditional keyword search queries to guide the search. May
|
|
105
|
+
contain search operators. At least one of objective or search_queries must be
|
|
106
|
+
provided.
|
|
107
|
+
|
|
108
|
+
source_policy: Source policy for web search results.
|
|
109
|
+
|
|
110
|
+
This policy governs which sources are allowed/disallowed in results.
|
|
111
|
+
|
|
112
|
+
extra_headers: Send extra headers
|
|
113
|
+
|
|
114
|
+
extra_query: Add additional query parameters to the request
|
|
115
|
+
|
|
116
|
+
extra_body: Add additional JSON properties to the request
|
|
117
|
+
|
|
118
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
119
|
+
"""
|
|
120
|
+
return self._post(
|
|
121
|
+
"/v1beta/search",
|
|
122
|
+
body=maybe_transform(
|
|
123
|
+
{
|
|
124
|
+
"max_chars_per_result": max_chars_per_result,
|
|
125
|
+
"max_results": max_results,
|
|
126
|
+
"objective": objective,
|
|
127
|
+
"processor": processor,
|
|
128
|
+
"search_queries": search_queries,
|
|
129
|
+
"source_policy": source_policy,
|
|
130
|
+
},
|
|
131
|
+
beta_search_params.BetaSearchParams,
|
|
132
|
+
),
|
|
133
|
+
options=make_request_options(
|
|
134
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
135
|
+
),
|
|
136
|
+
cast_to=SearchResult,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class AsyncBetaResource(AsyncAPIResource):
|
|
141
|
+
@cached_property
|
|
142
|
+
def task_run(self) -> AsyncTaskRunResource:
|
|
143
|
+
return AsyncTaskRunResource(self._client)
|
|
144
|
+
|
|
145
|
+
@cached_property
|
|
146
|
+
def task_group(self) -> AsyncTaskGroupResource:
|
|
147
|
+
return AsyncTaskGroupResource(self._client)
|
|
148
|
+
|
|
149
|
+
@cached_property
|
|
150
|
+
def with_raw_response(self) -> AsyncBetaResourceWithRawResponse:
|
|
151
|
+
"""
|
|
152
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
153
|
+
the raw response object instead of the parsed content.
|
|
154
|
+
|
|
155
|
+
For more information, see https://www.github.com/parallel-web/parallel-sdk-python#accessing-raw-response-data-eg-headers
|
|
156
|
+
"""
|
|
157
|
+
return AsyncBetaResourceWithRawResponse(self)
|
|
158
|
+
|
|
159
|
+
@cached_property
|
|
160
|
+
def with_streaming_response(self) -> AsyncBetaResourceWithStreamingResponse:
|
|
161
|
+
"""
|
|
162
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
163
|
+
|
|
164
|
+
For more information, see https://www.github.com/parallel-web/parallel-sdk-python#with_streaming_response
|
|
165
|
+
"""
|
|
166
|
+
return AsyncBetaResourceWithStreamingResponse(self)
|
|
167
|
+
|
|
168
|
+
async def search(
|
|
169
|
+
self,
|
|
170
|
+
*,
|
|
171
|
+
max_chars_per_result: Optional[int] | NotGiven = NOT_GIVEN,
|
|
172
|
+
max_results: Optional[int] | NotGiven = NOT_GIVEN,
|
|
173
|
+
objective: Optional[str] | NotGiven = NOT_GIVEN,
|
|
174
|
+
processor: Literal["base", "pro"] | NotGiven = NOT_GIVEN,
|
|
175
|
+
search_queries: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
176
|
+
source_policy: Optional[SourcePolicy] | NotGiven = NOT_GIVEN,
|
|
177
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
178
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
179
|
+
extra_headers: Headers | None = None,
|
|
180
|
+
extra_query: Query | None = None,
|
|
181
|
+
extra_body: Body | None = None,
|
|
182
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
183
|
+
) -> SearchResult:
|
|
184
|
+
"""
|
|
185
|
+
Searches the web.
|
|
186
|
+
|
|
187
|
+
Args:
|
|
188
|
+
max_chars_per_result: Upper bound on the number of characters to include in excerpts for each search
|
|
189
|
+
result.
|
|
190
|
+
|
|
191
|
+
max_results: Upper bound on the number of results to return. May be limited by the processor.
|
|
192
|
+
Defaults to 10 if not provided.
|
|
193
|
+
|
|
194
|
+
objective: Natural-language description of what the web search is trying to find. May
|
|
195
|
+
include guidance about preferred sources or freshness. At least one of objective
|
|
196
|
+
or search_queries must be provided.
|
|
197
|
+
|
|
198
|
+
processor: Search processor.
|
|
199
|
+
|
|
200
|
+
search_queries: Optional list of traditional keyword search queries to guide the search. May
|
|
201
|
+
contain search operators. At least one of objective or search_queries must be
|
|
202
|
+
provided.
|
|
203
|
+
|
|
204
|
+
source_policy: Source policy for web search results.
|
|
205
|
+
|
|
206
|
+
This policy governs which sources are allowed/disallowed in results.
|
|
207
|
+
|
|
208
|
+
extra_headers: Send extra headers
|
|
209
|
+
|
|
210
|
+
extra_query: Add additional query parameters to the request
|
|
211
|
+
|
|
212
|
+
extra_body: Add additional JSON properties to the request
|
|
213
|
+
|
|
214
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
215
|
+
"""
|
|
216
|
+
return await self._post(
|
|
217
|
+
"/v1beta/search",
|
|
218
|
+
body=await async_maybe_transform(
|
|
219
|
+
{
|
|
220
|
+
"max_chars_per_result": max_chars_per_result,
|
|
221
|
+
"max_results": max_results,
|
|
222
|
+
"objective": objective,
|
|
223
|
+
"processor": processor,
|
|
224
|
+
"search_queries": search_queries,
|
|
225
|
+
"source_policy": source_policy,
|
|
226
|
+
},
|
|
227
|
+
beta_search_params.BetaSearchParams,
|
|
228
|
+
),
|
|
229
|
+
options=make_request_options(
|
|
230
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
231
|
+
),
|
|
232
|
+
cast_to=SearchResult,
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
class BetaResourceWithRawResponse:
|
|
237
|
+
def __init__(self, beta: BetaResource) -> None:
|
|
238
|
+
self._beta = beta
|
|
239
|
+
|
|
240
|
+
self.search = to_raw_response_wrapper(
|
|
241
|
+
beta.search,
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
@cached_property
|
|
245
|
+
def task_run(self) -> TaskRunResourceWithRawResponse:
|
|
246
|
+
return TaskRunResourceWithRawResponse(self._beta.task_run)
|
|
247
|
+
|
|
248
|
+
@cached_property
|
|
249
|
+
def task_group(self) -> TaskGroupResourceWithRawResponse:
|
|
250
|
+
return TaskGroupResourceWithRawResponse(self._beta.task_group)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
class AsyncBetaResourceWithRawResponse:
|
|
254
|
+
def __init__(self, beta: AsyncBetaResource) -> None:
|
|
255
|
+
self._beta = beta
|
|
256
|
+
|
|
257
|
+
self.search = async_to_raw_response_wrapper(
|
|
258
|
+
beta.search,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
@cached_property
|
|
262
|
+
def task_run(self) -> AsyncTaskRunResourceWithRawResponse:
|
|
263
|
+
return AsyncTaskRunResourceWithRawResponse(self._beta.task_run)
|
|
264
|
+
|
|
265
|
+
@cached_property
|
|
266
|
+
def task_group(self) -> AsyncTaskGroupResourceWithRawResponse:
|
|
267
|
+
return AsyncTaskGroupResourceWithRawResponse(self._beta.task_group)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
class BetaResourceWithStreamingResponse:
|
|
271
|
+
def __init__(self, beta: BetaResource) -> None:
|
|
272
|
+
self._beta = beta
|
|
273
|
+
|
|
274
|
+
self.search = to_streamed_response_wrapper(
|
|
275
|
+
beta.search,
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
@cached_property
|
|
279
|
+
def task_run(self) -> TaskRunResourceWithStreamingResponse:
|
|
280
|
+
return TaskRunResourceWithStreamingResponse(self._beta.task_run)
|
|
281
|
+
|
|
282
|
+
@cached_property
|
|
283
|
+
def task_group(self) -> TaskGroupResourceWithStreamingResponse:
|
|
284
|
+
return TaskGroupResourceWithStreamingResponse(self._beta.task_group)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
class AsyncBetaResourceWithStreamingResponse:
|
|
288
|
+
def __init__(self, beta: AsyncBetaResource) -> None:
|
|
289
|
+
self._beta = beta
|
|
290
|
+
|
|
291
|
+
self.search = async_to_streamed_response_wrapper(
|
|
292
|
+
beta.search,
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
@cached_property
|
|
296
|
+
def task_run(self) -> AsyncTaskRunResourceWithStreamingResponse:
|
|
297
|
+
return AsyncTaskRunResourceWithStreamingResponse(self._beta.task_run)
|
|
298
|
+
|
|
299
|
+
@cached_property
|
|
300
|
+
def task_group(self) -> AsyncTaskGroupResourceWithStreamingResponse:
|
|
301
|
+
return AsyncTaskGroupResourceWithStreamingResponse(self._beta.task_group)
|