chunkr-ai 0.1.0a1__py3-none-any.whl → 0.1.0a3__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.
- chunkr_ai/_client.py +18 -9
- chunkr_ai/_files.py +1 -1
- chunkr_ai/_version.py +1 -1
- chunkr_ai/pagination.py +61 -1
- chunkr_ai/resources/__init__.py +27 -13
- chunkr_ai/resources/files.py +712 -0
- chunkr_ai/resources/tasks/__init__.py +33 -0
- chunkr_ai/resources/tasks/parse.py +612 -0
- chunkr_ai/resources/tasks/tasks.py +596 -0
- chunkr_ai/types/__init__.py +7 -19
- chunkr_ai/types/delete.py +10 -0
- chunkr_ai/types/file.py +30 -0
- chunkr_ai/types/file_create_params.py +17 -0
- chunkr_ai/types/file_list_params.py +28 -0
- chunkr_ai/types/file_url.py +15 -0
- chunkr_ai/types/file_url_params.py +15 -0
- chunkr_ai/types/files_page_response.py +20 -0
- chunkr_ai/types/task.py +866 -27
- chunkr_ai/types/tasks/__init__.py +6 -0
- chunkr_ai/types/tasks/parse_create_params.py +844 -0
- chunkr_ai/types/tasks/parse_update_params.py +838 -0
- {chunkr_ai-0.1.0a1.dist-info → chunkr_ai-0.1.0a3.dist-info}/METADATA +39 -21
- chunkr_ai-0.1.0a3.dist-info/RECORD +52 -0
- chunkr_ai/resources/task.py +0 -1166
- chunkr_ai/types/auto_generation_config.py +0 -39
- chunkr_ai/types/auto_generation_config_param.py +0 -39
- chunkr_ai/types/bounding_box.py +0 -19
- chunkr_ai/types/chunk_processing.py +0 -40
- chunkr_ai/types/chunk_processing_param.py +0 -42
- chunkr_ai/types/ignore_generation_config.py +0 -39
- chunkr_ai/types/ignore_generation_config_param.py +0 -39
- chunkr_ai/types/llm_generation_config.py +0 -39
- chunkr_ai/types/llm_generation_config_param.py +0 -39
- chunkr_ai/types/llm_processing.py +0 -36
- chunkr_ai/types/llm_processing_param.py +0 -36
- chunkr_ai/types/picture_generation_config.py +0 -39
- chunkr_ai/types/picture_generation_config_param.py +0 -39
- chunkr_ai/types/segment_processing.py +0 -280
- chunkr_ai/types/segment_processing_param.py +0 -281
- chunkr_ai/types/table_generation_config.py +0 -39
- chunkr_ai/types/table_generation_config_param.py +0 -39
- chunkr_ai/types/task_parse_params.py +0 -90
- chunkr_ai/types/task_update_params.py +0 -90
- chunkr_ai-0.1.0a1.dist-info/RECORD +0 -58
- {chunkr_ai-0.1.0a1.dist-info → chunkr_ai-0.1.0a3.dist-info}/WHEEL +0 -0
- {chunkr_ai-0.1.0a1.dist-info → chunkr_ai-0.1.0a3.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,596 @@
|
|
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 Union, Optional
|
6
|
+
from datetime import datetime
|
7
|
+
from typing_extensions import Literal
|
8
|
+
|
9
|
+
import httpx
|
10
|
+
|
11
|
+
from .parse import (
|
12
|
+
ParseResource,
|
13
|
+
AsyncParseResource,
|
14
|
+
ParseResourceWithRawResponse,
|
15
|
+
AsyncParseResourceWithRawResponse,
|
16
|
+
ParseResourceWithStreamingResponse,
|
17
|
+
AsyncParseResourceWithStreamingResponse,
|
18
|
+
)
|
19
|
+
from ...types import task_get_params, task_list_params
|
20
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
21
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
22
|
+
from ..._compat import cached_property
|
23
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
24
|
+
from ..._response import (
|
25
|
+
to_raw_response_wrapper,
|
26
|
+
to_streamed_response_wrapper,
|
27
|
+
async_to_raw_response_wrapper,
|
28
|
+
async_to_streamed_response_wrapper,
|
29
|
+
)
|
30
|
+
from ...pagination import SyncTasksPage, AsyncTasksPage
|
31
|
+
from ...types.task import Task
|
32
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
33
|
+
|
34
|
+
__all__ = ["TasksResource", "AsyncTasksResource"]
|
35
|
+
|
36
|
+
|
37
|
+
class TasksResource(SyncAPIResource):
|
38
|
+
@cached_property
|
39
|
+
def parse(self) -> ParseResource:
|
40
|
+
return ParseResource(self._client)
|
41
|
+
|
42
|
+
@cached_property
|
43
|
+
def with_raw_response(self) -> TasksResourceWithRawResponse:
|
44
|
+
"""
|
45
|
+
This property can be used as a prefix for any HTTP method call to return
|
46
|
+
the raw response object instead of the parsed content.
|
47
|
+
|
48
|
+
For more information, see https://www.github.com/lumina-ai-inc/chunkr-python#accessing-raw-response-data-eg-headers
|
49
|
+
"""
|
50
|
+
return TasksResourceWithRawResponse(self)
|
51
|
+
|
52
|
+
@cached_property
|
53
|
+
def with_streaming_response(self) -> TasksResourceWithStreamingResponse:
|
54
|
+
"""
|
55
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
56
|
+
|
57
|
+
For more information, see https://www.github.com/lumina-ai-inc/chunkr-python#with_streaming_response
|
58
|
+
"""
|
59
|
+
return TasksResourceWithStreamingResponse(self)
|
60
|
+
|
61
|
+
def list(
|
62
|
+
self,
|
63
|
+
*,
|
64
|
+
base64_urls: bool | NotGiven = NOT_GIVEN,
|
65
|
+
cursor: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
66
|
+
end: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
67
|
+
include_chunks: bool | NotGiven = NOT_GIVEN,
|
68
|
+
limit: int | NotGiven = NOT_GIVEN,
|
69
|
+
sort: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
70
|
+
start: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
71
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
72
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
73
|
+
extra_headers: Headers | None = None,
|
74
|
+
extra_query: Query | None = None,
|
75
|
+
extra_body: Body | None = None,
|
76
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
77
|
+
) -> SyncTasksPage[Task]:
|
78
|
+
"""
|
79
|
+
Lists tasks for the authenticated user with cursor-based pagination and optional
|
80
|
+
filtering by date range. Supports ascending or descending sort order and
|
81
|
+
optional inclusion of chunks/base64 URLs.
|
82
|
+
|
83
|
+
Args:
|
84
|
+
base64_urls: Whether to return base64 encoded URLs. If false, the URLs will be returned as
|
85
|
+
presigned URLs.
|
86
|
+
|
87
|
+
cursor: Cursor for pagination (timestamp)
|
88
|
+
|
89
|
+
end: End date
|
90
|
+
|
91
|
+
include_chunks: Whether to include chunks in the output response
|
92
|
+
|
93
|
+
limit: Number of tasks per page
|
94
|
+
|
95
|
+
sort: Sort order: 'asc' for ascending, 'desc' for descending (default)
|
96
|
+
|
97
|
+
start: Start date
|
98
|
+
|
99
|
+
extra_headers: Send extra headers
|
100
|
+
|
101
|
+
extra_query: Add additional query parameters to the request
|
102
|
+
|
103
|
+
extra_body: Add additional JSON properties to the request
|
104
|
+
|
105
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
106
|
+
"""
|
107
|
+
return self._get_api_list(
|
108
|
+
"/tasks",
|
109
|
+
page=SyncTasksPage[Task],
|
110
|
+
options=make_request_options(
|
111
|
+
extra_headers=extra_headers,
|
112
|
+
extra_query=extra_query,
|
113
|
+
extra_body=extra_body,
|
114
|
+
timeout=timeout,
|
115
|
+
query=maybe_transform(
|
116
|
+
{
|
117
|
+
"base64_urls": base64_urls,
|
118
|
+
"cursor": cursor,
|
119
|
+
"end": end,
|
120
|
+
"include_chunks": include_chunks,
|
121
|
+
"limit": limit,
|
122
|
+
"sort": sort,
|
123
|
+
"start": start,
|
124
|
+
},
|
125
|
+
task_list_params.TaskListParams,
|
126
|
+
),
|
127
|
+
),
|
128
|
+
model=Task,
|
129
|
+
)
|
130
|
+
|
131
|
+
def delete(
|
132
|
+
self,
|
133
|
+
task_id: Optional[str],
|
134
|
+
*,
|
135
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
136
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
137
|
+
extra_headers: Headers | None = None,
|
138
|
+
extra_query: Query | None = None,
|
139
|
+
extra_body: Body | None = None,
|
140
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
141
|
+
) -> None:
|
142
|
+
"""
|
143
|
+
Delete a task by its ID.
|
144
|
+
|
145
|
+
Requirements:
|
146
|
+
|
147
|
+
- Task must have status `Succeeded` or `Failed`
|
148
|
+
|
149
|
+
Args:
|
150
|
+
extra_headers: Send extra headers
|
151
|
+
|
152
|
+
extra_query: Add additional query parameters to the request
|
153
|
+
|
154
|
+
extra_body: Add additional JSON properties to the request
|
155
|
+
|
156
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
157
|
+
"""
|
158
|
+
if not task_id:
|
159
|
+
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
160
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
161
|
+
return self._delete(
|
162
|
+
f"/tasks/{task_id}",
|
163
|
+
options=make_request_options(
|
164
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
165
|
+
),
|
166
|
+
cast_to=NoneType,
|
167
|
+
)
|
168
|
+
|
169
|
+
def cancel(
|
170
|
+
self,
|
171
|
+
task_id: Optional[str],
|
172
|
+
*,
|
173
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
174
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
175
|
+
extra_headers: Headers | None = None,
|
176
|
+
extra_query: Query | None = None,
|
177
|
+
extra_body: Body | None = None,
|
178
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
179
|
+
) -> None:
|
180
|
+
"""
|
181
|
+
Cancel a task that hasn't started processing yet:
|
182
|
+
|
183
|
+
- For new tasks: Status will be updated to `Cancelled`
|
184
|
+
- For updating tasks: Task will revert to the previous state
|
185
|
+
|
186
|
+
Requirements:
|
187
|
+
|
188
|
+
- Task must have status `Starting`
|
189
|
+
|
190
|
+
Args:
|
191
|
+
extra_headers: Send extra headers
|
192
|
+
|
193
|
+
extra_query: Add additional query parameters to the request
|
194
|
+
|
195
|
+
extra_body: Add additional JSON properties to the request
|
196
|
+
|
197
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
198
|
+
"""
|
199
|
+
if not task_id:
|
200
|
+
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
201
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
202
|
+
return self._get(
|
203
|
+
f"/tasks/{task_id}/cancel",
|
204
|
+
options=make_request_options(
|
205
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
206
|
+
),
|
207
|
+
cast_to=NoneType,
|
208
|
+
)
|
209
|
+
|
210
|
+
def get(
|
211
|
+
self,
|
212
|
+
task_id: Optional[str],
|
213
|
+
*,
|
214
|
+
base64_urls: bool | NotGiven = NOT_GIVEN,
|
215
|
+
include_chunks: bool | NotGiven = NOT_GIVEN,
|
216
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
217
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
218
|
+
extra_headers: Headers | None = None,
|
219
|
+
extra_query: Query | None = None,
|
220
|
+
extra_body: Body | None = None,
|
221
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
222
|
+
) -> Task:
|
223
|
+
"""
|
224
|
+
Retrieves detailed information about a task by its ID, including:
|
225
|
+
|
226
|
+
- Processing status
|
227
|
+
- Task configuration
|
228
|
+
- Output data (if processing is complete)
|
229
|
+
- File metadata (name, page count)
|
230
|
+
- Timestamps (created, started, finished)
|
231
|
+
- Presigned URLs for accessing files
|
232
|
+
|
233
|
+
This endpoint can be used to:
|
234
|
+
|
235
|
+
1. Poll the task status during processing
|
236
|
+
2. Retrieve the final output once processing is complete
|
237
|
+
3. Access task metadata and configuration
|
238
|
+
|
239
|
+
Args:
|
240
|
+
base64_urls: Whether to return base64 encoded URLs. If false, the URLs will be returned as
|
241
|
+
presigned URLs.
|
242
|
+
|
243
|
+
include_chunks: Whether to include chunks in the output response
|
244
|
+
|
245
|
+
extra_headers: Send extra headers
|
246
|
+
|
247
|
+
extra_query: Add additional query parameters to the request
|
248
|
+
|
249
|
+
extra_body: Add additional JSON properties to the request
|
250
|
+
|
251
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
252
|
+
"""
|
253
|
+
if not task_id:
|
254
|
+
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
255
|
+
return self._get(
|
256
|
+
f"/tasks/{task_id}",
|
257
|
+
options=make_request_options(
|
258
|
+
extra_headers=extra_headers,
|
259
|
+
extra_query=extra_query,
|
260
|
+
extra_body=extra_body,
|
261
|
+
timeout=timeout,
|
262
|
+
query=maybe_transform(
|
263
|
+
{
|
264
|
+
"base64_urls": base64_urls,
|
265
|
+
"include_chunks": include_chunks,
|
266
|
+
},
|
267
|
+
task_get_params.TaskGetParams,
|
268
|
+
),
|
269
|
+
),
|
270
|
+
cast_to=Task,
|
271
|
+
)
|
272
|
+
|
273
|
+
|
274
|
+
class AsyncTasksResource(AsyncAPIResource):
|
275
|
+
@cached_property
|
276
|
+
def parse(self) -> AsyncParseResource:
|
277
|
+
return AsyncParseResource(self._client)
|
278
|
+
|
279
|
+
@cached_property
|
280
|
+
def with_raw_response(self) -> AsyncTasksResourceWithRawResponse:
|
281
|
+
"""
|
282
|
+
This property can be used as a prefix for any HTTP method call to return
|
283
|
+
the raw response object instead of the parsed content.
|
284
|
+
|
285
|
+
For more information, see https://www.github.com/lumina-ai-inc/chunkr-python#accessing-raw-response-data-eg-headers
|
286
|
+
"""
|
287
|
+
return AsyncTasksResourceWithRawResponse(self)
|
288
|
+
|
289
|
+
@cached_property
|
290
|
+
def with_streaming_response(self) -> AsyncTasksResourceWithStreamingResponse:
|
291
|
+
"""
|
292
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
293
|
+
|
294
|
+
For more information, see https://www.github.com/lumina-ai-inc/chunkr-python#with_streaming_response
|
295
|
+
"""
|
296
|
+
return AsyncTasksResourceWithStreamingResponse(self)
|
297
|
+
|
298
|
+
def list(
|
299
|
+
self,
|
300
|
+
*,
|
301
|
+
base64_urls: bool | NotGiven = NOT_GIVEN,
|
302
|
+
cursor: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
303
|
+
end: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
304
|
+
include_chunks: bool | NotGiven = NOT_GIVEN,
|
305
|
+
limit: int | NotGiven = NOT_GIVEN,
|
306
|
+
sort: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
307
|
+
start: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
308
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
309
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
310
|
+
extra_headers: Headers | None = None,
|
311
|
+
extra_query: Query | None = None,
|
312
|
+
extra_body: Body | None = None,
|
313
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
314
|
+
) -> AsyncPaginator[Task, AsyncTasksPage[Task]]:
|
315
|
+
"""
|
316
|
+
Lists tasks for the authenticated user with cursor-based pagination and optional
|
317
|
+
filtering by date range. Supports ascending or descending sort order and
|
318
|
+
optional inclusion of chunks/base64 URLs.
|
319
|
+
|
320
|
+
Args:
|
321
|
+
base64_urls: Whether to return base64 encoded URLs. If false, the URLs will be returned as
|
322
|
+
presigned URLs.
|
323
|
+
|
324
|
+
cursor: Cursor for pagination (timestamp)
|
325
|
+
|
326
|
+
end: End date
|
327
|
+
|
328
|
+
include_chunks: Whether to include chunks in the output response
|
329
|
+
|
330
|
+
limit: Number of tasks per page
|
331
|
+
|
332
|
+
sort: Sort order: 'asc' for ascending, 'desc' for descending (default)
|
333
|
+
|
334
|
+
start: Start date
|
335
|
+
|
336
|
+
extra_headers: Send extra headers
|
337
|
+
|
338
|
+
extra_query: Add additional query parameters to the request
|
339
|
+
|
340
|
+
extra_body: Add additional JSON properties to the request
|
341
|
+
|
342
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
343
|
+
"""
|
344
|
+
return self._get_api_list(
|
345
|
+
"/tasks",
|
346
|
+
page=AsyncTasksPage[Task],
|
347
|
+
options=make_request_options(
|
348
|
+
extra_headers=extra_headers,
|
349
|
+
extra_query=extra_query,
|
350
|
+
extra_body=extra_body,
|
351
|
+
timeout=timeout,
|
352
|
+
query=maybe_transform(
|
353
|
+
{
|
354
|
+
"base64_urls": base64_urls,
|
355
|
+
"cursor": cursor,
|
356
|
+
"end": end,
|
357
|
+
"include_chunks": include_chunks,
|
358
|
+
"limit": limit,
|
359
|
+
"sort": sort,
|
360
|
+
"start": start,
|
361
|
+
},
|
362
|
+
task_list_params.TaskListParams,
|
363
|
+
),
|
364
|
+
),
|
365
|
+
model=Task,
|
366
|
+
)
|
367
|
+
|
368
|
+
async def delete(
|
369
|
+
self,
|
370
|
+
task_id: Optional[str],
|
371
|
+
*,
|
372
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
373
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
374
|
+
extra_headers: Headers | None = None,
|
375
|
+
extra_query: Query | None = None,
|
376
|
+
extra_body: Body | None = None,
|
377
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
378
|
+
) -> None:
|
379
|
+
"""
|
380
|
+
Delete a task by its ID.
|
381
|
+
|
382
|
+
Requirements:
|
383
|
+
|
384
|
+
- Task must have status `Succeeded` or `Failed`
|
385
|
+
|
386
|
+
Args:
|
387
|
+
extra_headers: Send extra headers
|
388
|
+
|
389
|
+
extra_query: Add additional query parameters to the request
|
390
|
+
|
391
|
+
extra_body: Add additional JSON properties to the request
|
392
|
+
|
393
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
394
|
+
"""
|
395
|
+
if not task_id:
|
396
|
+
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
397
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
398
|
+
return await self._delete(
|
399
|
+
f"/tasks/{task_id}",
|
400
|
+
options=make_request_options(
|
401
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
402
|
+
),
|
403
|
+
cast_to=NoneType,
|
404
|
+
)
|
405
|
+
|
406
|
+
async def cancel(
|
407
|
+
self,
|
408
|
+
task_id: Optional[str],
|
409
|
+
*,
|
410
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
411
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
412
|
+
extra_headers: Headers | None = None,
|
413
|
+
extra_query: Query | None = None,
|
414
|
+
extra_body: Body | None = None,
|
415
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
416
|
+
) -> None:
|
417
|
+
"""
|
418
|
+
Cancel a task that hasn't started processing yet:
|
419
|
+
|
420
|
+
- For new tasks: Status will be updated to `Cancelled`
|
421
|
+
- For updating tasks: Task will revert to the previous state
|
422
|
+
|
423
|
+
Requirements:
|
424
|
+
|
425
|
+
- Task must have status `Starting`
|
426
|
+
|
427
|
+
Args:
|
428
|
+
extra_headers: Send extra headers
|
429
|
+
|
430
|
+
extra_query: Add additional query parameters to the request
|
431
|
+
|
432
|
+
extra_body: Add additional JSON properties to the request
|
433
|
+
|
434
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
435
|
+
"""
|
436
|
+
if not task_id:
|
437
|
+
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
438
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
439
|
+
return await self._get(
|
440
|
+
f"/tasks/{task_id}/cancel",
|
441
|
+
options=make_request_options(
|
442
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
443
|
+
),
|
444
|
+
cast_to=NoneType,
|
445
|
+
)
|
446
|
+
|
447
|
+
async def get(
|
448
|
+
self,
|
449
|
+
task_id: Optional[str],
|
450
|
+
*,
|
451
|
+
base64_urls: bool | NotGiven = NOT_GIVEN,
|
452
|
+
include_chunks: bool | NotGiven = NOT_GIVEN,
|
453
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
454
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
455
|
+
extra_headers: Headers | None = None,
|
456
|
+
extra_query: Query | None = None,
|
457
|
+
extra_body: Body | None = None,
|
458
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
459
|
+
) -> Task:
|
460
|
+
"""
|
461
|
+
Retrieves detailed information about a task by its ID, including:
|
462
|
+
|
463
|
+
- Processing status
|
464
|
+
- Task configuration
|
465
|
+
- Output data (if processing is complete)
|
466
|
+
- File metadata (name, page count)
|
467
|
+
- Timestamps (created, started, finished)
|
468
|
+
- Presigned URLs for accessing files
|
469
|
+
|
470
|
+
This endpoint can be used to:
|
471
|
+
|
472
|
+
1. Poll the task status during processing
|
473
|
+
2. Retrieve the final output once processing is complete
|
474
|
+
3. Access task metadata and configuration
|
475
|
+
|
476
|
+
Args:
|
477
|
+
base64_urls: Whether to return base64 encoded URLs. If false, the URLs will be returned as
|
478
|
+
presigned URLs.
|
479
|
+
|
480
|
+
include_chunks: Whether to include chunks in the output response
|
481
|
+
|
482
|
+
extra_headers: Send extra headers
|
483
|
+
|
484
|
+
extra_query: Add additional query parameters to the request
|
485
|
+
|
486
|
+
extra_body: Add additional JSON properties to the request
|
487
|
+
|
488
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
489
|
+
"""
|
490
|
+
if not task_id:
|
491
|
+
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
492
|
+
return await self._get(
|
493
|
+
f"/tasks/{task_id}",
|
494
|
+
options=make_request_options(
|
495
|
+
extra_headers=extra_headers,
|
496
|
+
extra_query=extra_query,
|
497
|
+
extra_body=extra_body,
|
498
|
+
timeout=timeout,
|
499
|
+
query=await async_maybe_transform(
|
500
|
+
{
|
501
|
+
"base64_urls": base64_urls,
|
502
|
+
"include_chunks": include_chunks,
|
503
|
+
},
|
504
|
+
task_get_params.TaskGetParams,
|
505
|
+
),
|
506
|
+
),
|
507
|
+
cast_to=Task,
|
508
|
+
)
|
509
|
+
|
510
|
+
|
511
|
+
class TasksResourceWithRawResponse:
|
512
|
+
def __init__(self, tasks: TasksResource) -> None:
|
513
|
+
self._tasks = tasks
|
514
|
+
|
515
|
+
self.list = to_raw_response_wrapper(
|
516
|
+
tasks.list,
|
517
|
+
)
|
518
|
+
self.delete = to_raw_response_wrapper(
|
519
|
+
tasks.delete,
|
520
|
+
)
|
521
|
+
self.cancel = to_raw_response_wrapper(
|
522
|
+
tasks.cancel,
|
523
|
+
)
|
524
|
+
self.get = to_raw_response_wrapper(
|
525
|
+
tasks.get,
|
526
|
+
)
|
527
|
+
|
528
|
+
@cached_property
|
529
|
+
def parse(self) -> ParseResourceWithRawResponse:
|
530
|
+
return ParseResourceWithRawResponse(self._tasks.parse)
|
531
|
+
|
532
|
+
|
533
|
+
class AsyncTasksResourceWithRawResponse:
|
534
|
+
def __init__(self, tasks: AsyncTasksResource) -> None:
|
535
|
+
self._tasks = tasks
|
536
|
+
|
537
|
+
self.list = async_to_raw_response_wrapper(
|
538
|
+
tasks.list,
|
539
|
+
)
|
540
|
+
self.delete = async_to_raw_response_wrapper(
|
541
|
+
tasks.delete,
|
542
|
+
)
|
543
|
+
self.cancel = async_to_raw_response_wrapper(
|
544
|
+
tasks.cancel,
|
545
|
+
)
|
546
|
+
self.get = async_to_raw_response_wrapper(
|
547
|
+
tasks.get,
|
548
|
+
)
|
549
|
+
|
550
|
+
@cached_property
|
551
|
+
def parse(self) -> AsyncParseResourceWithRawResponse:
|
552
|
+
return AsyncParseResourceWithRawResponse(self._tasks.parse)
|
553
|
+
|
554
|
+
|
555
|
+
class TasksResourceWithStreamingResponse:
|
556
|
+
def __init__(self, tasks: TasksResource) -> None:
|
557
|
+
self._tasks = tasks
|
558
|
+
|
559
|
+
self.list = to_streamed_response_wrapper(
|
560
|
+
tasks.list,
|
561
|
+
)
|
562
|
+
self.delete = to_streamed_response_wrapper(
|
563
|
+
tasks.delete,
|
564
|
+
)
|
565
|
+
self.cancel = to_streamed_response_wrapper(
|
566
|
+
tasks.cancel,
|
567
|
+
)
|
568
|
+
self.get = to_streamed_response_wrapper(
|
569
|
+
tasks.get,
|
570
|
+
)
|
571
|
+
|
572
|
+
@cached_property
|
573
|
+
def parse(self) -> ParseResourceWithStreamingResponse:
|
574
|
+
return ParseResourceWithStreamingResponse(self._tasks.parse)
|
575
|
+
|
576
|
+
|
577
|
+
class AsyncTasksResourceWithStreamingResponse:
|
578
|
+
def __init__(self, tasks: AsyncTasksResource) -> None:
|
579
|
+
self._tasks = tasks
|
580
|
+
|
581
|
+
self.list = async_to_streamed_response_wrapper(
|
582
|
+
tasks.list,
|
583
|
+
)
|
584
|
+
self.delete = async_to_streamed_response_wrapper(
|
585
|
+
tasks.delete,
|
586
|
+
)
|
587
|
+
self.cancel = async_to_streamed_response_wrapper(
|
588
|
+
tasks.cancel,
|
589
|
+
)
|
590
|
+
self.get = async_to_streamed_response_wrapper(
|
591
|
+
tasks.get,
|
592
|
+
)
|
593
|
+
|
594
|
+
@cached_property
|
595
|
+
def parse(self) -> AsyncParseResourceWithStreamingResponse:
|
596
|
+
return AsyncParseResourceWithStreamingResponse(self._tasks.parse)
|
chunkr_ai/types/__init__.py
CHANGED
@@ -2,26 +2,14 @@
|
|
2
2
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
|
+
from .file import File as File
|
5
6
|
from .task import Task as Task
|
6
|
-
from .
|
7
|
-
from .
|
7
|
+
from .delete import Delete as Delete
|
8
|
+
from .file_url import FileURL as FileURL
|
9
|
+
from .file_url_params import FileURLParams as FileURLParams
|
8
10
|
from .task_get_params import TaskGetParams as TaskGetParams
|
9
|
-
from .
|
11
|
+
from .file_list_params import FileListParams as FileListParams
|
10
12
|
from .task_list_params import TaskListParams as TaskListParams
|
11
|
-
from .
|
12
|
-
from .
|
13
|
-
from .task_update_params import TaskUpdateParams as TaskUpdateParams
|
14
|
-
from .llm_processing_param import LlmProcessingParam as LlmProcessingParam
|
13
|
+
from .file_create_params import FileCreateParams as FileCreateParams
|
14
|
+
from .files_page_response import FilesPageResponse as FilesPageResponse
|
15
15
|
from .health_check_response import HealthCheckResponse as HealthCheckResponse
|
16
|
-
from .llm_generation_config import LlmGenerationConfig as LlmGenerationConfig
|
17
|
-
from .auto_generation_config import AutoGenerationConfig as AutoGenerationConfig
|
18
|
-
from .chunk_processing_param import ChunkProcessingParam as ChunkProcessingParam
|
19
|
-
from .table_generation_config import TableGenerationConfig as TableGenerationConfig
|
20
|
-
from .ignore_generation_config import IgnoreGenerationConfig as IgnoreGenerationConfig
|
21
|
-
from .segment_processing_param import SegmentProcessingParam as SegmentProcessingParam
|
22
|
-
from .picture_generation_config import PictureGenerationConfig as PictureGenerationConfig
|
23
|
-
from .llm_generation_config_param import LlmGenerationConfigParam as LlmGenerationConfigParam
|
24
|
-
from .auto_generation_config_param import AutoGenerationConfigParam as AutoGenerationConfigParam
|
25
|
-
from .table_generation_config_param import TableGenerationConfigParam as TableGenerationConfigParam
|
26
|
-
from .ignore_generation_config_param import IgnoreGenerationConfigParam as IgnoreGenerationConfigParam
|
27
|
-
from .picture_generation_config_param import PictureGenerationConfigParam as PictureGenerationConfigParam
|
chunkr_ai/types/file.py
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from datetime import datetime
|
4
|
+
|
5
|
+
from .._models import BaseModel
|
6
|
+
|
7
|
+
__all__ = ["File"]
|
8
|
+
|
9
|
+
|
10
|
+
class File(BaseModel):
|
11
|
+
content_type: str
|
12
|
+
"""MIME type detected or provided for the file."""
|
13
|
+
|
14
|
+
created_at: datetime
|
15
|
+
"""Timestamp when the file was created."""
|
16
|
+
|
17
|
+
file_id: str
|
18
|
+
"""Unique identifier for the file."""
|
19
|
+
|
20
|
+
file_name: str
|
21
|
+
"""The original filename supplied by the client."""
|
22
|
+
|
23
|
+
file_size: int
|
24
|
+
"""Size of the stored file in bytes."""
|
25
|
+
|
26
|
+
metadata: object
|
27
|
+
"""Arbitrary JSON metadata associated with the file."""
|
28
|
+
|
29
|
+
url: str
|
30
|
+
"""Permanent Chunkr URL. Use directly with other chunkr API requests."""
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from typing_extensions import Required, TypedDict
|
6
|
+
|
7
|
+
from .._types import FileTypes
|
8
|
+
|
9
|
+
__all__ = ["FileCreateParams"]
|
10
|
+
|
11
|
+
|
12
|
+
class FileCreateParams(TypedDict, total=False):
|
13
|
+
file: Required[FileTypes]
|
14
|
+
"""The file to upload"""
|
15
|
+
|
16
|
+
file_metadata: Required[str]
|
17
|
+
"""Arbitrary JSON metadata associated with the file."""
|