chunkr-ai 0.1.0a2__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 -10
- 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/{task → tasks}/__init__.py +14 -14
- chunkr_ai/resources/{task → tasks}/parse.py +48 -52
- chunkr_ai/resources/{task/task.py → tasks/tasks.py} +58 -126
- chunkr_ai/types/__init__.py +7 -0
- 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/task.py → task.py} +55 -23
- chunkr_ai/types/{task → tasks}/__init__.py +0 -1
- chunkr_ai/types/{task → tasks}/parse_create_params.py +61 -23
- chunkr_ai/types/{task → tasks}/parse_update_params.py +54 -22
- {chunkr_ai-0.1.0a2.dist-info → chunkr_ai-0.1.0a3.dist-info}/METADATA +38 -20
- {chunkr_ai-0.1.0a2.dist-info → chunkr_ai-0.1.0a3.dist-info}/RECORD +25 -17
- {chunkr_ai-0.1.0a2.dist-info → chunkr_ai-0.1.0a3.dist-info}/WHEEL +0 -0
- {chunkr_ai-0.1.0a2.dist-info → chunkr_ai-0.1.0a3.dist-info}/licenses/LICENSE +0 -0
@@ -1,13 +1,5 @@
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
2
|
|
3
|
-
from .task import (
|
4
|
-
TaskResource,
|
5
|
-
AsyncTaskResource,
|
6
|
-
TaskResourceWithRawResponse,
|
7
|
-
AsyncTaskResourceWithRawResponse,
|
8
|
-
TaskResourceWithStreamingResponse,
|
9
|
-
AsyncTaskResourceWithStreamingResponse,
|
10
|
-
)
|
11
3
|
from .parse import (
|
12
4
|
ParseResource,
|
13
5
|
AsyncParseResource,
|
@@ -16,6 +8,14 @@ from .parse import (
|
|
16
8
|
ParseResourceWithStreamingResponse,
|
17
9
|
AsyncParseResourceWithStreamingResponse,
|
18
10
|
)
|
11
|
+
from .tasks import (
|
12
|
+
TasksResource,
|
13
|
+
AsyncTasksResource,
|
14
|
+
TasksResourceWithRawResponse,
|
15
|
+
AsyncTasksResourceWithRawResponse,
|
16
|
+
TasksResourceWithStreamingResponse,
|
17
|
+
AsyncTasksResourceWithStreamingResponse,
|
18
|
+
)
|
19
19
|
|
20
20
|
__all__ = [
|
21
21
|
"ParseResource",
|
@@ -24,10 +24,10 @@ __all__ = [
|
|
24
24
|
"AsyncParseResourceWithRawResponse",
|
25
25
|
"ParseResourceWithStreamingResponse",
|
26
26
|
"AsyncParseResourceWithStreamingResponse",
|
27
|
-
"
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"
|
31
|
-
"
|
32
|
-
"
|
27
|
+
"TasksResource",
|
28
|
+
"AsyncTasksResource",
|
29
|
+
"TasksResourceWithRawResponse",
|
30
|
+
"AsyncTasksResourceWithRawResponse",
|
31
|
+
"TasksResourceWithStreamingResponse",
|
32
|
+
"AsyncTasksResourceWithStreamingResponse",
|
33
33
|
]
|
@@ -17,9 +17,9 @@ from ..._response import (
|
|
17
17
|
async_to_raw_response_wrapper,
|
18
18
|
async_to_streamed_response_wrapper,
|
19
19
|
)
|
20
|
-
from ...types.task import
|
20
|
+
from ...types.task import Task
|
21
|
+
from ...types.tasks import parse_create_params, parse_update_params
|
21
22
|
from ..._base_client import make_request_options
|
22
|
-
from ...types.task.task import Task
|
23
23
|
|
24
24
|
__all__ = ["ParseResource", "AsyncParseResource"]
|
25
25
|
|
@@ -75,10 +75,16 @@ class ParseResource(SyncAPIResource):
|
|
75
75
|
- Presigned URLs for file access
|
76
76
|
|
77
77
|
The returned task will typically be in a `Starting` or `Processing` state. Use
|
78
|
-
the `GET /
|
78
|
+
the `GET /tasks/{task_id}` endpoint to poll for completion.
|
79
79
|
|
80
80
|
Args:
|
81
|
-
file:
|
81
|
+
file:
|
82
|
+
The file to be uploaded. Supported inputs:
|
83
|
+
|
84
|
+
- `ch://files/{file_id}`: References a previously uploaded file you own
|
85
|
+
(authorization enforced)
|
86
|
+
- `http(s)://...`: Remote URL to fetch
|
87
|
+
- `data:*;base64,...` or raw base64 string
|
82
88
|
|
83
89
|
chunk_processing: Controls the setting for the chunking and post-processing of each chunk.
|
84
90
|
|
@@ -113,18 +119,14 @@ class ParseResource(SyncAPIResource):
|
|
113
119
|
content is produced (rule-based vs. LLM). • The output format (`Html` or
|
114
120
|
`Markdown`).
|
115
121
|
|
116
|
-
Optional flags such as image **cropping**, **extended context**, and
|
117
|
-
descriptions** further refine behaviour.
|
118
|
-
|
119
|
-
---
|
122
|
+
Optional flags such as image **cropping**, **extended context**, and
|
123
|
+
**descriptions** further refine behaviour.
|
120
124
|
|
121
125
|
**Default strategy per segment** • `Title`, `SectionHeader`, `Text`, `ListItem`,
|
122
|
-
`Caption`, `Footnote` → **Auto** (Markdown) • `Table` → **LLM**
|
123
|
-
description on) • `Picture` → **LLM** (Markdown, description off,
|
124
|
-
_All_) • `Formula`, `Page` → **LLM** (Markdown) •
|
125
|
-
**Ignore** (removed from output)
|
126
|
-
|
127
|
-
---
|
126
|
+
`Caption`, `Footnote` → **Auto** (Markdown, description off) • `Table` → **LLM**
|
127
|
+
(HTML, description on) • `Picture` → **LLM** (Markdown, description off,
|
128
|
+
cropping _All_) • `Formula`, `Page` → **LLM** (Markdown, description off) •
|
129
|
+
`PageHeader`, `PageFooter` → **Ignore** (removed from output)
|
128
130
|
|
129
131
|
**Strategy reference** • **Auto** – rule-based content generation. • **LLM** –
|
130
132
|
generate content with an LLM. • **Ignore** – exclude the segment entirely.
|
@@ -147,7 +149,7 @@ class ParseResource(SyncAPIResource):
|
|
147
149
|
timeout: Override the client-level default timeout for this request, in seconds
|
148
150
|
"""
|
149
151
|
return self._post(
|
150
|
-
"/
|
152
|
+
"/tasks/parse",
|
151
153
|
body=maybe_transform(
|
152
154
|
{
|
153
155
|
"file": file,
|
@@ -201,7 +203,7 @@ class ParseResource(SyncAPIResource):
|
|
201
203
|
- New configuration must be different from the current one
|
202
204
|
|
203
205
|
The returned task will typically be in a `Starting` or `Processing` state. Use
|
204
|
-
the `GET /
|
206
|
+
the `GET /tasks/{task_id}` endpoint to poll for completion.
|
205
207
|
|
206
208
|
Args:
|
207
209
|
chunk_processing: Controls the setting for the chunking and post-processing of each chunk.
|
@@ -238,18 +240,14 @@ class ParseResource(SyncAPIResource):
|
|
238
240
|
content is produced (rule-based vs. LLM). • The output format (`Html` or
|
239
241
|
`Markdown`).
|
240
242
|
|
241
|
-
Optional flags such as image **cropping**, **extended context**, and
|
242
|
-
descriptions** further refine behaviour.
|
243
|
-
|
244
|
-
---
|
243
|
+
Optional flags such as image **cropping**, **extended context**, and
|
244
|
+
**descriptions** further refine behaviour.
|
245
245
|
|
246
246
|
**Default strategy per segment** • `Title`, `SectionHeader`, `Text`, `ListItem`,
|
247
|
-
`Caption`, `Footnote` → **Auto** (Markdown) • `Table` → **LLM**
|
248
|
-
description on) • `Picture` → **LLM** (Markdown, description off,
|
249
|
-
_All_) • `Formula`, `Page` → **LLM** (Markdown) •
|
250
|
-
**Ignore** (removed from output)
|
251
|
-
|
252
|
-
---
|
247
|
+
`Caption`, `Footnote` → **Auto** (Markdown, description off) • `Table` → **LLM**
|
248
|
+
(HTML, description on) • `Picture` → **LLM** (Markdown, description off,
|
249
|
+
cropping _All_) • `Formula`, `Page` → **LLM** (Markdown, description off) •
|
250
|
+
`PageHeader`, `PageFooter` → **Ignore** (removed from output)
|
253
251
|
|
254
252
|
**Strategy reference** • **Auto** – rule-based content generation. • **LLM** –
|
255
253
|
generate content with an LLM. • **Ignore** – exclude the segment entirely.
|
@@ -274,7 +272,7 @@ class ParseResource(SyncAPIResource):
|
|
274
272
|
if not task_id:
|
275
273
|
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
276
274
|
return self._patch(
|
277
|
-
f"/
|
275
|
+
f"/tasks/parse/{task_id}",
|
278
276
|
body=maybe_transform(
|
279
277
|
{
|
280
278
|
"chunk_processing": chunk_processing,
|
@@ -347,10 +345,16 @@ class AsyncParseResource(AsyncAPIResource):
|
|
347
345
|
- Presigned URLs for file access
|
348
346
|
|
349
347
|
The returned task will typically be in a `Starting` or `Processing` state. Use
|
350
|
-
the `GET /
|
348
|
+
the `GET /tasks/{task_id}` endpoint to poll for completion.
|
351
349
|
|
352
350
|
Args:
|
353
|
-
file:
|
351
|
+
file:
|
352
|
+
The file to be uploaded. Supported inputs:
|
353
|
+
|
354
|
+
- `ch://files/{file_id}`: References a previously uploaded file you own
|
355
|
+
(authorization enforced)
|
356
|
+
- `http(s)://...`: Remote URL to fetch
|
357
|
+
- `data:*;base64,...` or raw base64 string
|
354
358
|
|
355
359
|
chunk_processing: Controls the setting for the chunking and post-processing of each chunk.
|
356
360
|
|
@@ -385,18 +389,14 @@ class AsyncParseResource(AsyncAPIResource):
|
|
385
389
|
content is produced (rule-based vs. LLM). • The output format (`Html` or
|
386
390
|
`Markdown`).
|
387
391
|
|
388
|
-
Optional flags such as image **cropping**, **extended context**, and
|
389
|
-
descriptions** further refine behaviour.
|
390
|
-
|
391
|
-
---
|
392
|
+
Optional flags such as image **cropping**, **extended context**, and
|
393
|
+
**descriptions** further refine behaviour.
|
392
394
|
|
393
395
|
**Default strategy per segment** • `Title`, `SectionHeader`, `Text`, `ListItem`,
|
394
|
-
`Caption`, `Footnote` → **Auto** (Markdown) • `Table` → **LLM**
|
395
|
-
description on) • `Picture` → **LLM** (Markdown, description off,
|
396
|
-
_All_) • `Formula`, `Page` → **LLM** (Markdown) •
|
397
|
-
**Ignore** (removed from output)
|
398
|
-
|
399
|
-
---
|
396
|
+
`Caption`, `Footnote` → **Auto** (Markdown, description off) • `Table` → **LLM**
|
397
|
+
(HTML, description on) • `Picture` → **LLM** (Markdown, description off,
|
398
|
+
cropping _All_) • `Formula`, `Page` → **LLM** (Markdown, description off) •
|
399
|
+
`PageHeader`, `PageFooter` → **Ignore** (removed from output)
|
400
400
|
|
401
401
|
**Strategy reference** • **Auto** – rule-based content generation. • **LLM** –
|
402
402
|
generate content with an LLM. • **Ignore** – exclude the segment entirely.
|
@@ -419,7 +419,7 @@ class AsyncParseResource(AsyncAPIResource):
|
|
419
419
|
timeout: Override the client-level default timeout for this request, in seconds
|
420
420
|
"""
|
421
421
|
return await self._post(
|
422
|
-
"/
|
422
|
+
"/tasks/parse",
|
423
423
|
body=await async_maybe_transform(
|
424
424
|
{
|
425
425
|
"file": file,
|
@@ -473,7 +473,7 @@ class AsyncParseResource(AsyncAPIResource):
|
|
473
473
|
- New configuration must be different from the current one
|
474
474
|
|
475
475
|
The returned task will typically be in a `Starting` or `Processing` state. Use
|
476
|
-
the `GET /
|
476
|
+
the `GET /tasks/{task_id}` endpoint to poll for completion.
|
477
477
|
|
478
478
|
Args:
|
479
479
|
chunk_processing: Controls the setting for the chunking and post-processing of each chunk.
|
@@ -510,18 +510,14 @@ class AsyncParseResource(AsyncAPIResource):
|
|
510
510
|
content is produced (rule-based vs. LLM). • The output format (`Html` or
|
511
511
|
`Markdown`).
|
512
512
|
|
513
|
-
Optional flags such as image **cropping**, **extended context**, and
|
514
|
-
descriptions** further refine behaviour.
|
515
|
-
|
516
|
-
---
|
513
|
+
Optional flags such as image **cropping**, **extended context**, and
|
514
|
+
**descriptions** further refine behaviour.
|
517
515
|
|
518
516
|
**Default strategy per segment** • `Title`, `SectionHeader`, `Text`, `ListItem`,
|
519
|
-
`Caption`, `Footnote` → **Auto** (Markdown) • `Table` → **LLM**
|
520
|
-
description on) • `Picture` → **LLM** (Markdown, description off,
|
521
|
-
_All_) • `Formula`, `Page` → **LLM** (Markdown) •
|
522
|
-
**Ignore** (removed from output)
|
523
|
-
|
524
|
-
---
|
517
|
+
`Caption`, `Footnote` → **Auto** (Markdown, description off) • `Table` → **LLM**
|
518
|
+
(HTML, description on) • `Picture` → **LLM** (Markdown, description off,
|
519
|
+
cropping _All_) • `Formula`, `Page` → **LLM** (Markdown, description off) •
|
520
|
+
`PageHeader`, `PageFooter` → **Ignore** (removed from output)
|
525
521
|
|
526
522
|
**Strategy reference** • **Auto** – rule-based content generation. • **LLM** –
|
527
523
|
generate content with an LLM. • **Ignore** – exclude the segment entirely.
|
@@ -546,7 +542,7 @@ class AsyncParseResource(AsyncAPIResource):
|
|
546
542
|
if not task_id:
|
547
543
|
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
548
544
|
return await self._patch(
|
549
|
-
f"/
|
545
|
+
f"/tasks/parse/{task_id}",
|
550
546
|
body=await async_maybe_transform(
|
551
547
|
{
|
552
548
|
"chunk_processing": chunk_processing,
|
@@ -28,35 +28,35 @@ from ..._response import (
|
|
28
28
|
async_to_streamed_response_wrapper,
|
29
29
|
)
|
30
30
|
from ...pagination import SyncTasksPage, AsyncTasksPage
|
31
|
+
from ...types.task import Task
|
31
32
|
from ..._base_client import AsyncPaginator, make_request_options
|
32
|
-
from ...types.task.task import Task
|
33
33
|
|
34
|
-
__all__ = ["
|
34
|
+
__all__ = ["TasksResource", "AsyncTasksResource"]
|
35
35
|
|
36
36
|
|
37
|
-
class
|
37
|
+
class TasksResource(SyncAPIResource):
|
38
38
|
@cached_property
|
39
39
|
def parse(self) -> ParseResource:
|
40
40
|
return ParseResource(self._client)
|
41
41
|
|
42
42
|
@cached_property
|
43
|
-
def with_raw_response(self) ->
|
43
|
+
def with_raw_response(self) -> TasksResourceWithRawResponse:
|
44
44
|
"""
|
45
45
|
This property can be used as a prefix for any HTTP method call to return
|
46
46
|
the raw response object instead of the parsed content.
|
47
47
|
|
48
48
|
For more information, see https://www.github.com/lumina-ai-inc/chunkr-python#accessing-raw-response-data-eg-headers
|
49
49
|
"""
|
50
|
-
return
|
50
|
+
return TasksResourceWithRawResponse(self)
|
51
51
|
|
52
52
|
@cached_property
|
53
|
-
def with_streaming_response(self) ->
|
53
|
+
def with_streaming_response(self) -> TasksResourceWithStreamingResponse:
|
54
54
|
"""
|
55
55
|
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
56
56
|
|
57
57
|
For more information, see https://www.github.com/lumina-ai-inc/chunkr-python#with_streaming_response
|
58
58
|
"""
|
59
|
-
return
|
59
|
+
return TasksResourceWithStreamingResponse(self)
|
60
60
|
|
61
61
|
def list(
|
62
62
|
self,
|
@@ -75,44 +75,10 @@ class TaskResource(SyncAPIResource):
|
|
75
75
|
extra_body: Body | None = None,
|
76
76
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
77
77
|
) -> SyncTasksPage[Task]:
|
78
|
-
"""
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
## Default Behaviors:
|
84
|
-
|
85
|
-
- **limit**: Returns all tasks if not specified
|
86
|
-
- **start**: No start date filter (returns from beginning of time)
|
87
|
-
- **end**: No end date filter (returns up to current time)
|
88
|
-
- **cursor**: Starts from most recent tasks (no pagination offset)
|
89
|
-
- **sort**: 'desc' (descending order, newest first)
|
90
|
-
- **include_chunks**: false (excludes chunks for better performance)
|
91
|
-
- **base64_urls**: false (returns presigned URLs instead of base64)
|
92
|
-
|
93
|
-
## Common Usage Patterns:
|
94
|
-
|
95
|
-
**Basic usage (get all tasks):** `GET /api/v1/tasks`
|
96
|
-
|
97
|
-
**Get first 10 tasks:** `GET /api/v1/tasks?limit=10`
|
98
|
-
|
99
|
-
**Paginate through results:**
|
100
|
-
|
101
|
-
1. First request: `GET /api/v1/tasks?limit=10`
|
102
|
-
2. Use next_cursor from response for subsequent pages:
|
103
|
-
`GET /api/v1/tasks?limit=10&cursor=<timestamp>`
|
104
|
-
|
105
|
-
**Filter by date range:**
|
106
|
-
`GET /api/v1/tasks?start=2025-01-01T00:00:00Z&end=2025-12-31T23:59:59Z`
|
107
|
-
|
108
|
-
**Get detailed results with chunks:** `GET /api/v1/tasks?include_chunks=true`
|
109
|
-
|
110
|
-
**Get base64 encoded content:** `GET /api/v1/tasks?base64_urls=true`
|
111
|
-
|
112
|
-
**Get tasks in ascending order (oldest first):** `GET /api/v1/tasks?sort=asc`
|
113
|
-
|
114
|
-
**Get tasks in descending order (newest first, default):**
|
115
|
-
`GET /api/v1/tasks?sort=desc`
|
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.
|
116
82
|
|
117
83
|
Args:
|
118
84
|
base64_urls: Whether to return base64 encoded URLs. If false, the URLs will be returned as
|
@@ -193,7 +159,7 @@ class TaskResource(SyncAPIResource):
|
|
193
159
|
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
194
160
|
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
195
161
|
return self._delete(
|
196
|
-
f"/
|
162
|
+
f"/tasks/{task_id}",
|
197
163
|
options=make_request_options(
|
198
164
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
199
165
|
),
|
@@ -234,7 +200,7 @@ class TaskResource(SyncAPIResource):
|
|
234
200
|
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
235
201
|
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
236
202
|
return self._get(
|
237
|
-
f"/
|
203
|
+
f"/tasks/{task_id}/cancel",
|
238
204
|
options=make_request_options(
|
239
205
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
240
206
|
),
|
@@ -287,7 +253,7 @@ class TaskResource(SyncAPIResource):
|
|
287
253
|
if not task_id:
|
288
254
|
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
289
255
|
return self._get(
|
290
|
-
f"/
|
256
|
+
f"/tasks/{task_id}",
|
291
257
|
options=make_request_options(
|
292
258
|
extra_headers=extra_headers,
|
293
259
|
extra_query=extra_query,
|
@@ -305,29 +271,29 @@ class TaskResource(SyncAPIResource):
|
|
305
271
|
)
|
306
272
|
|
307
273
|
|
308
|
-
class
|
274
|
+
class AsyncTasksResource(AsyncAPIResource):
|
309
275
|
@cached_property
|
310
276
|
def parse(self) -> AsyncParseResource:
|
311
277
|
return AsyncParseResource(self._client)
|
312
278
|
|
313
279
|
@cached_property
|
314
|
-
def with_raw_response(self) ->
|
280
|
+
def with_raw_response(self) -> AsyncTasksResourceWithRawResponse:
|
315
281
|
"""
|
316
282
|
This property can be used as a prefix for any HTTP method call to return
|
317
283
|
the raw response object instead of the parsed content.
|
318
284
|
|
319
285
|
For more information, see https://www.github.com/lumina-ai-inc/chunkr-python#accessing-raw-response-data-eg-headers
|
320
286
|
"""
|
321
|
-
return
|
287
|
+
return AsyncTasksResourceWithRawResponse(self)
|
322
288
|
|
323
289
|
@cached_property
|
324
|
-
def with_streaming_response(self) ->
|
290
|
+
def with_streaming_response(self) -> AsyncTasksResourceWithStreamingResponse:
|
325
291
|
"""
|
326
292
|
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
327
293
|
|
328
294
|
For more information, see https://www.github.com/lumina-ai-inc/chunkr-python#with_streaming_response
|
329
295
|
"""
|
330
|
-
return
|
296
|
+
return AsyncTasksResourceWithStreamingResponse(self)
|
331
297
|
|
332
298
|
def list(
|
333
299
|
self,
|
@@ -346,44 +312,10 @@ class AsyncTaskResource(AsyncAPIResource):
|
|
346
312
|
extra_body: Body | None = None,
|
347
313
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
348
314
|
) -> AsyncPaginator[Task, AsyncTasksPage[Task]]:
|
349
|
-
"""
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
## Default Behaviors:
|
355
|
-
|
356
|
-
- **limit**: Returns all tasks if not specified
|
357
|
-
- **start**: No start date filter (returns from beginning of time)
|
358
|
-
- **end**: No end date filter (returns up to current time)
|
359
|
-
- **cursor**: Starts from most recent tasks (no pagination offset)
|
360
|
-
- **sort**: 'desc' (descending order, newest first)
|
361
|
-
- **include_chunks**: false (excludes chunks for better performance)
|
362
|
-
- **base64_urls**: false (returns presigned URLs instead of base64)
|
363
|
-
|
364
|
-
## Common Usage Patterns:
|
365
|
-
|
366
|
-
**Basic usage (get all tasks):** `GET /api/v1/tasks`
|
367
|
-
|
368
|
-
**Get first 10 tasks:** `GET /api/v1/tasks?limit=10`
|
369
|
-
|
370
|
-
**Paginate through results:**
|
371
|
-
|
372
|
-
1. First request: `GET /api/v1/tasks?limit=10`
|
373
|
-
2. Use next_cursor from response for subsequent pages:
|
374
|
-
`GET /api/v1/tasks?limit=10&cursor=<timestamp>`
|
375
|
-
|
376
|
-
**Filter by date range:**
|
377
|
-
`GET /api/v1/tasks?start=2025-01-01T00:00:00Z&end=2025-12-31T23:59:59Z`
|
378
|
-
|
379
|
-
**Get detailed results with chunks:** `GET /api/v1/tasks?include_chunks=true`
|
380
|
-
|
381
|
-
**Get base64 encoded content:** `GET /api/v1/tasks?base64_urls=true`
|
382
|
-
|
383
|
-
**Get tasks in ascending order (oldest first):** `GET /api/v1/tasks?sort=asc`
|
384
|
-
|
385
|
-
**Get tasks in descending order (newest first, default):**
|
386
|
-
`GET /api/v1/tasks?sort=desc`
|
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.
|
387
319
|
|
388
320
|
Args:
|
389
321
|
base64_urls: Whether to return base64 encoded URLs. If false, the URLs will be returned as
|
@@ -464,7 +396,7 @@ class AsyncTaskResource(AsyncAPIResource):
|
|
464
396
|
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
465
397
|
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
466
398
|
return await self._delete(
|
467
|
-
f"/
|
399
|
+
f"/tasks/{task_id}",
|
468
400
|
options=make_request_options(
|
469
401
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
470
402
|
),
|
@@ -505,7 +437,7 @@ class AsyncTaskResource(AsyncAPIResource):
|
|
505
437
|
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
506
438
|
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
507
439
|
return await self._get(
|
508
|
-
f"/
|
440
|
+
f"/tasks/{task_id}/cancel",
|
509
441
|
options=make_request_options(
|
510
442
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
511
443
|
),
|
@@ -558,7 +490,7 @@ class AsyncTaskResource(AsyncAPIResource):
|
|
558
490
|
if not task_id:
|
559
491
|
raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}")
|
560
492
|
return await self._get(
|
561
|
-
f"/
|
493
|
+
f"/tasks/{task_id}",
|
562
494
|
options=make_request_options(
|
563
495
|
extra_headers=extra_headers,
|
564
496
|
extra_query=extra_query,
|
@@ -576,89 +508,89 @@ class AsyncTaskResource(AsyncAPIResource):
|
|
576
508
|
)
|
577
509
|
|
578
510
|
|
579
|
-
class
|
580
|
-
def __init__(self,
|
581
|
-
self.
|
511
|
+
class TasksResourceWithRawResponse:
|
512
|
+
def __init__(self, tasks: TasksResource) -> None:
|
513
|
+
self._tasks = tasks
|
582
514
|
|
583
515
|
self.list = to_raw_response_wrapper(
|
584
|
-
|
516
|
+
tasks.list,
|
585
517
|
)
|
586
518
|
self.delete = to_raw_response_wrapper(
|
587
|
-
|
519
|
+
tasks.delete,
|
588
520
|
)
|
589
521
|
self.cancel = to_raw_response_wrapper(
|
590
|
-
|
522
|
+
tasks.cancel,
|
591
523
|
)
|
592
524
|
self.get = to_raw_response_wrapper(
|
593
|
-
|
525
|
+
tasks.get,
|
594
526
|
)
|
595
527
|
|
596
528
|
@cached_property
|
597
529
|
def parse(self) -> ParseResourceWithRawResponse:
|
598
|
-
return ParseResourceWithRawResponse(self.
|
530
|
+
return ParseResourceWithRawResponse(self._tasks.parse)
|
599
531
|
|
600
532
|
|
601
|
-
class
|
602
|
-
def __init__(self,
|
603
|
-
self.
|
533
|
+
class AsyncTasksResourceWithRawResponse:
|
534
|
+
def __init__(self, tasks: AsyncTasksResource) -> None:
|
535
|
+
self._tasks = tasks
|
604
536
|
|
605
537
|
self.list = async_to_raw_response_wrapper(
|
606
|
-
|
538
|
+
tasks.list,
|
607
539
|
)
|
608
540
|
self.delete = async_to_raw_response_wrapper(
|
609
|
-
|
541
|
+
tasks.delete,
|
610
542
|
)
|
611
543
|
self.cancel = async_to_raw_response_wrapper(
|
612
|
-
|
544
|
+
tasks.cancel,
|
613
545
|
)
|
614
546
|
self.get = async_to_raw_response_wrapper(
|
615
|
-
|
547
|
+
tasks.get,
|
616
548
|
)
|
617
549
|
|
618
550
|
@cached_property
|
619
551
|
def parse(self) -> AsyncParseResourceWithRawResponse:
|
620
|
-
return AsyncParseResourceWithRawResponse(self.
|
552
|
+
return AsyncParseResourceWithRawResponse(self._tasks.parse)
|
621
553
|
|
622
554
|
|
623
|
-
class
|
624
|
-
def __init__(self,
|
625
|
-
self.
|
555
|
+
class TasksResourceWithStreamingResponse:
|
556
|
+
def __init__(self, tasks: TasksResource) -> None:
|
557
|
+
self._tasks = tasks
|
626
558
|
|
627
559
|
self.list = to_streamed_response_wrapper(
|
628
|
-
|
560
|
+
tasks.list,
|
629
561
|
)
|
630
562
|
self.delete = to_streamed_response_wrapper(
|
631
|
-
|
563
|
+
tasks.delete,
|
632
564
|
)
|
633
565
|
self.cancel = to_streamed_response_wrapper(
|
634
|
-
|
566
|
+
tasks.cancel,
|
635
567
|
)
|
636
568
|
self.get = to_streamed_response_wrapper(
|
637
|
-
|
569
|
+
tasks.get,
|
638
570
|
)
|
639
571
|
|
640
572
|
@cached_property
|
641
573
|
def parse(self) -> ParseResourceWithStreamingResponse:
|
642
|
-
return ParseResourceWithStreamingResponse(self.
|
574
|
+
return ParseResourceWithStreamingResponse(self._tasks.parse)
|
643
575
|
|
644
576
|
|
645
|
-
class
|
646
|
-
def __init__(self,
|
647
|
-
self.
|
577
|
+
class AsyncTasksResourceWithStreamingResponse:
|
578
|
+
def __init__(self, tasks: AsyncTasksResource) -> None:
|
579
|
+
self._tasks = tasks
|
648
580
|
|
649
581
|
self.list = async_to_streamed_response_wrapper(
|
650
|
-
|
582
|
+
tasks.list,
|
651
583
|
)
|
652
584
|
self.delete = async_to_streamed_response_wrapper(
|
653
|
-
|
585
|
+
tasks.delete,
|
654
586
|
)
|
655
587
|
self.cancel = async_to_streamed_response_wrapper(
|
656
|
-
|
588
|
+
tasks.cancel,
|
657
589
|
)
|
658
590
|
self.get = async_to_streamed_response_wrapper(
|
659
|
-
|
591
|
+
tasks.get,
|
660
592
|
)
|
661
593
|
|
662
594
|
@cached_property
|
663
595
|
def parse(self) -> AsyncParseResourceWithStreamingResponse:
|
664
|
-
return AsyncParseResourceWithStreamingResponse(self.
|
596
|
+
return AsyncParseResourceWithStreamingResponse(self._tasks.parse)
|
chunkr_ai/types/__init__.py
CHANGED
@@ -2,7 +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
|
7
|
+
from .delete import Delete as Delete
|
8
|
+
from .file_url import FileURL as FileURL
|
9
|
+
from .file_url_params import FileURLParams as FileURLParams
|
6
10
|
from .task_get_params import TaskGetParams as TaskGetParams
|
11
|
+
from .file_list_params import FileListParams as FileListParams
|
7
12
|
from .task_list_params import TaskListParams as TaskListParams
|
13
|
+
from .file_create_params import FileCreateParams as FileCreateParams
|
14
|
+
from .files_page_response import FilesPageResponse as FilesPageResponse
|
8
15
|
from .health_check_response import HealthCheckResponse as HealthCheckResponse
|
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."""
|