Skip to content

Commit 3b30030

Browse files
feat(api): api update
1 parent 30596c1 commit 3b30030

File tree

4 files changed

+314
-19
lines changed

4 files changed

+314
-19
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 16
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/reducto%2Freductoai-601f912c5d88e67d153f65a76f164ec90fbbe25335cd3714f803940d942a3b02.yml
3-
openapi_spec_hash: bf297fbdb7a16b1b9de02ecb34e6a779
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/reducto%2Freductoai-40a8492dc679a1650ddac779da720bf381f4a957064de8a8129b549acfe0a466.yml
3+
openapi_spec_hash: 0bd5676e6af83241ac9878d5d19d506d
44
config_hash: 12c16025a3b7554fa6377191d68b1903

src/reducto/resources/split.py

Lines changed: 73 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from ..types.split_run_job_response import SplitRunJobResponse
2323
from ..types.shared_params.parse_options import ParseOptions
2424
from ..types.shared_params.split_category import SplitCategory
25+
from ..types.shared_params.config_v3_async_config import ConfigV3AsyncConfig
2526

2627
__all__ = ["SplitResource", "AsyncSplitResource"]
2728

@@ -109,18 +110,40 @@ def run(
109110
def run_job(
110111
self,
111112
*,
112-
body: object,
113+
input: split_run_job_params.Input,
114+
split_description: Iterable[SplitCategory],
115+
async_: ConfigV3AsyncConfig | Omit = omit,
116+
parsing: ParseOptions | Omit = omit,
117+
settings: split_run_job_params.Settings | Omit = omit,
118+
split_rules: str | Omit = omit,
113119
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
114120
# The extra values given here take precedence over values defined on the client or passed to this method.
115121
extra_headers: Headers | None = None,
116122
extra_query: Query | None = None,
117123
extra_body: Body | None = None,
118124
timeout: float | httpx.Timeout | None | NotGiven = not_given,
119125
) -> SplitRunJobResponse:
120-
"""
121-
Split Async
126+
"""Split Async
122127
123128
Args:
129+
input: The URL of the document to be processed.
130+
131+
You can provide one of the
132+
following: 1. A publicly available URL 2. A presigned S3 URL 3. A reducto://
133+
prefixed URL obtained from the /upload endpoint after directly uploading a
134+
document 4. A jobid:// prefixed URL obtained from a previous /parse invocation
135+
136+
split_description: The configuration options for processing the document.
137+
138+
async_: The configuration options for asynchronous processing (default synchronous).
139+
140+
parsing: The configuration options for parsing the document. If you are passing in a
141+
jobid:// URL for the file, then this configuration will be ignored.
142+
143+
settings: The settings for split processing.
144+
145+
split_rules: The prompt that describes rules for splitting the document.
146+
124147
extra_headers: Send extra headers
125148
126149
extra_query: Add additional query parameters to the request
@@ -131,7 +154,17 @@ def run_job(
131154
"""
132155
return self._post(
133156
"/split_async",
134-
body=maybe_transform(body, split_run_job_params.SplitRunJobParams),
157+
body=maybe_transform(
158+
{
159+
"input": input,
160+
"split_description": split_description,
161+
"async_": async_,
162+
"parsing": parsing,
163+
"settings": settings,
164+
"split_rules": split_rules,
165+
},
166+
split_run_job_params.SplitRunJobParams,
167+
),
135168
options=make_request_options(
136169
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
137170
),
@@ -222,18 +255,40 @@ async def run(
222255
async def run_job(
223256
self,
224257
*,
225-
body: object,
258+
input: split_run_job_params.Input,
259+
split_description: Iterable[SplitCategory],
260+
async_: ConfigV3AsyncConfig | Omit = omit,
261+
parsing: ParseOptions | Omit = omit,
262+
settings: split_run_job_params.Settings | Omit = omit,
263+
split_rules: str | Omit = omit,
226264
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
227265
# The extra values given here take precedence over values defined on the client or passed to this method.
228266
extra_headers: Headers | None = None,
229267
extra_query: Query | None = None,
230268
extra_body: Body | None = None,
231269
timeout: float | httpx.Timeout | None | NotGiven = not_given,
232270
) -> SplitRunJobResponse:
233-
"""
234-
Split Async
271+
"""Split Async
235272
236273
Args:
274+
input: The URL of the document to be processed.
275+
276+
You can provide one of the
277+
following: 1. A publicly available URL 2. A presigned S3 URL 3. A reducto://
278+
prefixed URL obtained from the /upload endpoint after directly uploading a
279+
document 4. A jobid:// prefixed URL obtained from a previous /parse invocation
280+
281+
split_description: The configuration options for processing the document.
282+
283+
async_: The configuration options for asynchronous processing (default synchronous).
284+
285+
parsing: The configuration options for parsing the document. If you are passing in a
286+
jobid:// URL for the file, then this configuration will be ignored.
287+
288+
settings: The settings for split processing.
289+
290+
split_rules: The prompt that describes rules for splitting the document.
291+
237292
extra_headers: Send extra headers
238293
239294
extra_query: Add additional query parameters to the request
@@ -244,7 +299,17 @@ async def run_job(
244299
"""
245300
return await self._post(
246301
"/split_async",
247-
body=await async_maybe_transform(body, split_run_job_params.SplitRunJobParams),
302+
body=await async_maybe_transform(
303+
{
304+
"input": input,
305+
"split_description": split_description,
306+
"async_": async_,
307+
"parsing": parsing,
308+
"settings": settings,
309+
"split_rules": split_rules,
310+
},
311+
split_run_job_params.SplitRunJobParams,
312+
),
248313
options=make_request_options(
249314
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
250315
),

src/reducto/types/split_run_job_params.py

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,56 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing import Union, Iterable
6+
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
67

7-
__all__ = ["SplitRunJobParams"]
8+
from .._utils import PropertyInfo
9+
from .shared_params.upload import Upload
10+
from .shared_params.parse_options import ParseOptions
11+
from .shared_params.split_category import SplitCategory
12+
from .shared_params.config_v3_async_config import ConfigV3AsyncConfig
13+
14+
__all__ = ["SplitRunJobParams", "Input", "Settings"]
815

916

1017
class SplitRunJobParams(TypedDict, total=False):
11-
body: Required[object]
18+
input: Required[Input]
19+
"""The URL of the document to be processed.
20+
21+
You can provide one of the following: 1. A publicly available URL 2. A presigned
22+
S3 URL 3. A reducto:// prefixed URL obtained from the /upload endpoint after
23+
directly uploading a document 4. A jobid:// prefixed URL obtained from a
24+
previous /parse invocation
25+
"""
26+
27+
split_description: Required[Iterable[SplitCategory]]
28+
"""The configuration options for processing the document."""
29+
30+
async_: Annotated[ConfigV3AsyncConfig, PropertyInfo(alias="async")]
31+
"""The configuration options for asynchronous processing (default synchronous)."""
32+
33+
parsing: ParseOptions
34+
"""The configuration options for parsing the document.
35+
36+
If you are passing in a jobid:// URL for the file, then this configuration will
37+
be ignored.
38+
"""
39+
40+
settings: Settings
41+
"""The settings for split processing."""
42+
43+
split_rules: str
44+
"""The prompt that describes rules for splitting the document."""
45+
46+
47+
Input: TypeAlias = Union[str, Upload]
48+
49+
50+
class Settings(TypedDict, total=False):
51+
table_cutoff: Literal["truncate", "preserve"]
52+
"""
53+
If tables should be truncated to the first few rows or if all content should be
54+
preserved. truncate improves latency, preserve is recommended for cases where
55+
partition_key is being used and the partition_key may be included within the
56+
table. Defaults to truncate
57+
"""

0 commit comments

Comments
 (0)