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
chunkr_ai/_client.py
CHANGED
@@ -21,7 +21,7 @@ from ._types import (
|
|
21
21
|
)
|
22
22
|
from ._utils import is_given, get_async_library
|
23
23
|
from ._version import __version__
|
24
|
-
from .resources import
|
24
|
+
from .resources import files, health
|
25
25
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
26
26
|
from ._exceptions import ChunkrError, APIStatusError
|
27
27
|
from ._base_client import (
|
@@ -29,12 +29,14 @@ from ._base_client import (
|
|
29
29
|
SyncAPIClient,
|
30
30
|
AsyncAPIClient,
|
31
31
|
)
|
32
|
+
from .resources.tasks import tasks
|
32
33
|
|
33
34
|
__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Chunkr", "AsyncChunkr", "Client", "AsyncClient"]
|
34
35
|
|
35
36
|
|
36
37
|
class Chunkr(SyncAPIClient):
|
37
|
-
|
38
|
+
tasks: tasks.TasksResource
|
39
|
+
files: files.FilesResource
|
38
40
|
health: health.HealthResource
|
39
41
|
with_raw_response: ChunkrWithRawResponse
|
40
42
|
with_streaming_response: ChunkrWithStreamedResponse
|
@@ -93,7 +95,8 @@ class Chunkr(SyncAPIClient):
|
|
93
95
|
_strict_response_validation=_strict_response_validation,
|
94
96
|
)
|
95
97
|
|
96
|
-
self.
|
98
|
+
self.tasks = tasks.TasksResource(self)
|
99
|
+
self.files = files.FilesResource(self)
|
97
100
|
self.health = health.HealthResource(self)
|
98
101
|
self.with_raw_response = ChunkrWithRawResponse(self)
|
99
102
|
self.with_streaming_response = ChunkrWithStreamedResponse(self)
|
@@ -204,7 +207,8 @@ class Chunkr(SyncAPIClient):
|
|
204
207
|
|
205
208
|
|
206
209
|
class AsyncChunkr(AsyncAPIClient):
|
207
|
-
|
210
|
+
tasks: tasks.AsyncTasksResource
|
211
|
+
files: files.AsyncFilesResource
|
208
212
|
health: health.AsyncHealthResource
|
209
213
|
with_raw_response: AsyncChunkrWithRawResponse
|
210
214
|
with_streaming_response: AsyncChunkrWithStreamedResponse
|
@@ -263,7 +267,8 @@ class AsyncChunkr(AsyncAPIClient):
|
|
263
267
|
_strict_response_validation=_strict_response_validation,
|
264
268
|
)
|
265
269
|
|
266
|
-
self.
|
270
|
+
self.tasks = tasks.AsyncTasksResource(self)
|
271
|
+
self.files = files.AsyncFilesResource(self)
|
267
272
|
self.health = health.AsyncHealthResource(self)
|
268
273
|
self.with_raw_response = AsyncChunkrWithRawResponse(self)
|
269
274
|
self.with_streaming_response = AsyncChunkrWithStreamedResponse(self)
|
@@ -375,25 +380,29 @@ class AsyncChunkr(AsyncAPIClient):
|
|
375
380
|
|
376
381
|
class ChunkrWithRawResponse:
|
377
382
|
def __init__(self, client: Chunkr) -> None:
|
378
|
-
self.
|
383
|
+
self.tasks = tasks.TasksResourceWithRawResponse(client.tasks)
|
384
|
+
self.files = files.FilesResourceWithRawResponse(client.files)
|
379
385
|
self.health = health.HealthResourceWithRawResponse(client.health)
|
380
386
|
|
381
387
|
|
382
388
|
class AsyncChunkrWithRawResponse:
|
383
389
|
def __init__(self, client: AsyncChunkr) -> None:
|
384
|
-
self.
|
390
|
+
self.tasks = tasks.AsyncTasksResourceWithRawResponse(client.tasks)
|
391
|
+
self.files = files.AsyncFilesResourceWithRawResponse(client.files)
|
385
392
|
self.health = health.AsyncHealthResourceWithRawResponse(client.health)
|
386
393
|
|
387
394
|
|
388
395
|
class ChunkrWithStreamedResponse:
|
389
396
|
def __init__(self, client: Chunkr) -> None:
|
390
|
-
self.
|
397
|
+
self.tasks = tasks.TasksResourceWithStreamingResponse(client.tasks)
|
398
|
+
self.files = files.FilesResourceWithStreamingResponse(client.files)
|
391
399
|
self.health = health.HealthResourceWithStreamingResponse(client.health)
|
392
400
|
|
393
401
|
|
394
402
|
class AsyncChunkrWithStreamedResponse:
|
395
403
|
def __init__(self, client: AsyncChunkr) -> None:
|
396
|
-
self.
|
404
|
+
self.tasks = tasks.AsyncTasksResourceWithStreamingResponse(client.tasks)
|
405
|
+
self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
|
397
406
|
self.health = health.AsyncHealthResourceWithStreamingResponse(client.health)
|
398
407
|
|
399
408
|
|
chunkr_ai/_files.py
CHANGED
@@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
|
|
34
34
|
if not is_file_content(obj):
|
35
35
|
prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
|
36
36
|
raise RuntimeError(
|
37
|
-
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead."
|
37
|
+
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/lumina-ai-inc/chunkr-python/tree/main#file-uploads"
|
38
38
|
) from None
|
39
39
|
|
40
40
|
|
chunkr_ai/_version.py
CHANGED
chunkr_ai/pagination.py
CHANGED
@@ -6,7 +6,7 @@ from typing_extensions import override
|
|
6
6
|
|
7
7
|
from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage
|
8
8
|
|
9
|
-
__all__ = ["SyncTasksPage", "AsyncTasksPage"]
|
9
|
+
__all__ = ["SyncTasksPage", "AsyncTasksPage", "SyncFilesPage", "AsyncFilesPage"]
|
10
10
|
|
11
11
|
_T = TypeVar("_T")
|
12
12
|
|
@@ -69,3 +69,63 @@ class AsyncTasksPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
|
|
69
69
|
return None
|
70
70
|
|
71
71
|
return PageInfo(params={"cursor": next_cursor})
|
72
|
+
|
73
|
+
|
74
|
+
class SyncFilesPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
|
75
|
+
files: List[_T]
|
76
|
+
next_cursor: Optional[datetime] = None
|
77
|
+
has_more: Optional[bool] = None
|
78
|
+
"""Whether there are more pages available"""
|
79
|
+
|
80
|
+
@override
|
81
|
+
def _get_page_items(self) -> List[_T]:
|
82
|
+
files = self.files
|
83
|
+
if not files:
|
84
|
+
return []
|
85
|
+
return files
|
86
|
+
|
87
|
+
@override
|
88
|
+
def has_next_page(self) -> bool:
|
89
|
+
has_more = self.has_more
|
90
|
+
if has_more is not None and has_more is False:
|
91
|
+
return False
|
92
|
+
|
93
|
+
return super().has_next_page()
|
94
|
+
|
95
|
+
@override
|
96
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
97
|
+
next_cursor = self.next_cursor
|
98
|
+
if not next_cursor:
|
99
|
+
return None
|
100
|
+
|
101
|
+
return PageInfo(params={"cursor": next_cursor})
|
102
|
+
|
103
|
+
|
104
|
+
class AsyncFilesPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
|
105
|
+
files: List[_T]
|
106
|
+
next_cursor: Optional[datetime] = None
|
107
|
+
has_more: Optional[bool] = None
|
108
|
+
"""Whether there are more pages available"""
|
109
|
+
|
110
|
+
@override
|
111
|
+
def _get_page_items(self) -> List[_T]:
|
112
|
+
files = self.files
|
113
|
+
if not files:
|
114
|
+
return []
|
115
|
+
return files
|
116
|
+
|
117
|
+
@override
|
118
|
+
def has_next_page(self) -> bool:
|
119
|
+
has_more = self.has_more
|
120
|
+
if has_more is not None and has_more is False:
|
121
|
+
return False
|
122
|
+
|
123
|
+
return super().has_next_page()
|
124
|
+
|
125
|
+
@override
|
126
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
127
|
+
next_cursor = self.next_cursor
|
128
|
+
if not next_cursor:
|
129
|
+
return None
|
130
|
+
|
131
|
+
return PageInfo(params={"cursor": next_cursor})
|
chunkr_ai/resources/__init__.py
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
2
|
|
3
|
-
from .
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
from .files import (
|
4
|
+
FilesResource,
|
5
|
+
AsyncFilesResource,
|
6
|
+
FilesResourceWithRawResponse,
|
7
|
+
AsyncFilesResourceWithRawResponse,
|
8
|
+
FilesResourceWithStreamingResponse,
|
9
|
+
AsyncFilesResourceWithStreamingResponse,
|
10
|
+
)
|
11
|
+
from .tasks import (
|
12
|
+
TasksResource,
|
13
|
+
AsyncTasksResource,
|
14
|
+
TasksResourceWithRawResponse,
|
15
|
+
AsyncTasksResourceWithRawResponse,
|
16
|
+
TasksResourceWithStreamingResponse,
|
17
|
+
AsyncTasksResourceWithStreamingResponse,
|
10
18
|
)
|
11
19
|
from .health import (
|
12
20
|
HealthResource,
|
@@ -18,12 +26,18 @@ from .health import (
|
|
18
26
|
)
|
19
27
|
|
20
28
|
__all__ = [
|
21
|
-
"
|
22
|
-
"
|
23
|
-
"
|
24
|
-
"
|
25
|
-
"
|
26
|
-
"
|
29
|
+
"TasksResource",
|
30
|
+
"AsyncTasksResource",
|
31
|
+
"TasksResourceWithRawResponse",
|
32
|
+
"AsyncTasksResourceWithRawResponse",
|
33
|
+
"TasksResourceWithStreamingResponse",
|
34
|
+
"AsyncTasksResourceWithStreamingResponse",
|
35
|
+
"FilesResource",
|
36
|
+
"AsyncFilesResource",
|
37
|
+
"FilesResourceWithRawResponse",
|
38
|
+
"AsyncFilesResourceWithRawResponse",
|
39
|
+
"FilesResourceWithStreamingResponse",
|
40
|
+
"AsyncFilesResourceWithStreamingResponse",
|
27
41
|
"HealthResource",
|
28
42
|
"AsyncHealthResource",
|
29
43
|
"HealthResourceWithRawResponse",
|