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
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: chunkr-ai
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.0a3
|
4
4
|
Summary: The official Python library for the chunkr API
|
5
5
|
Project-URL: Homepage, https://github.com/lumina-ai-inc/chunkr-python
|
6
6
|
Project-URL: Repository, https://github.com/lumina-ai-inc/chunkr-python
|
@@ -70,7 +70,7 @@ client = Chunkr(
|
|
70
70
|
api_key=os.environ.get("CHUNKR_API_KEY"), # This is the default and can be omitted
|
71
71
|
)
|
72
72
|
|
73
|
-
task = client.
|
73
|
+
task = client.tasks.parse.create(
|
74
74
|
file="string",
|
75
75
|
)
|
76
76
|
print(task.task_id)
|
@@ -96,7 +96,7 @@ client = AsyncChunkr(
|
|
96
96
|
|
97
97
|
|
98
98
|
async def main() -> None:
|
99
|
-
task = await client.
|
99
|
+
task = await client.tasks.parse.create(
|
100
100
|
file="string",
|
101
101
|
)
|
102
102
|
print(task.task_id)
|
@@ -131,7 +131,7 @@ async def main() -> None:
|
|
131
131
|
api_key="My API Key",
|
132
132
|
http_client=DefaultAioHttpClient(),
|
133
133
|
) as client:
|
134
|
-
task = await client.
|
134
|
+
task = await client.tasks.parse.create(
|
135
135
|
file="string",
|
136
136
|
)
|
137
137
|
print(task.task_id)
|
@@ -162,7 +162,7 @@ client = Chunkr()
|
|
162
162
|
|
163
163
|
all_tasks = []
|
164
164
|
# Automatically fetches more pages as needed.
|
165
|
-
for task in client.
|
165
|
+
for task in client.tasks.list(
|
166
166
|
limit=100,
|
167
167
|
):
|
168
168
|
# Do something with task here
|
@@ -182,7 +182,7 @@ client = AsyncChunkr()
|
|
182
182
|
async def main() -> None:
|
183
183
|
all_tasks = []
|
184
184
|
# Iterate through items across all pages, issuing requests as needed.
|
185
|
-
async for task in client.
|
185
|
+
async for task in client.tasks.list(
|
186
186
|
limit=100,
|
187
187
|
):
|
188
188
|
all_tasks.append(task)
|
@@ -195,7 +195,7 @@ asyncio.run(main())
|
|
195
195
|
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
|
196
196
|
|
197
197
|
```python
|
198
|
-
first_page = await client.
|
198
|
+
first_page = await client.tasks.list(
|
199
199
|
limit=100,
|
200
200
|
)
|
201
201
|
if first_page.has_next_page():
|
@@ -209,7 +209,7 @@ if first_page.has_next_page():
|
|
209
209
|
Or just work directly with the returned data:
|
210
210
|
|
211
211
|
```python
|
212
|
-
first_page = await client.
|
212
|
+
first_page = await client.tasks.list(
|
213
213
|
limit=100,
|
214
214
|
)
|
215
215
|
|
@@ -229,13 +229,31 @@ from chunkr_ai import Chunkr
|
|
229
229
|
|
230
230
|
client = Chunkr()
|
231
231
|
|
232
|
-
task = client.
|
232
|
+
task = client.tasks.parse.create(
|
233
233
|
file="file",
|
234
234
|
chunk_processing={},
|
235
235
|
)
|
236
236
|
print(task.chunk_processing)
|
237
237
|
```
|
238
238
|
|
239
|
+
## File uploads
|
240
|
+
|
241
|
+
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
|
242
|
+
|
243
|
+
```python
|
244
|
+
from pathlib import Path
|
245
|
+
from chunkr_ai import Chunkr
|
246
|
+
|
247
|
+
client = Chunkr()
|
248
|
+
|
249
|
+
client.files.create(
|
250
|
+
file=Path("/path/to/file"),
|
251
|
+
file_metadata="file_metadata",
|
252
|
+
)
|
253
|
+
```
|
254
|
+
|
255
|
+
The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
|
256
|
+
|
239
257
|
## Handling errors
|
240
258
|
|
241
259
|
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `chunkr_ai.APIConnectionError` is raised.
|
@@ -252,8 +270,8 @@ from chunkr_ai import Chunkr
|
|
252
270
|
client = Chunkr()
|
253
271
|
|
254
272
|
try:
|
255
|
-
client.
|
256
|
-
file="
|
273
|
+
client.tasks.parse.create(
|
274
|
+
file="string",
|
257
275
|
)
|
258
276
|
except chunkr_ai.APIConnectionError as e:
|
259
277
|
print("The server could not be reached")
|
@@ -297,8 +315,8 @@ client = Chunkr(
|
|
297
315
|
)
|
298
316
|
|
299
317
|
# Or, configure per-request:
|
300
|
-
client.with_options(max_retries=5).
|
301
|
-
file="
|
318
|
+
client.with_options(max_retries=5).tasks.parse.create(
|
319
|
+
file="string",
|
302
320
|
)
|
303
321
|
```
|
304
322
|
|
@@ -322,8 +340,8 @@ client = Chunkr(
|
|
322
340
|
)
|
323
341
|
|
324
342
|
# Override per-request:
|
325
|
-
client.with_options(timeout=5.0).
|
326
|
-
file="
|
343
|
+
client.with_options(timeout=5.0).tasks.parse.create(
|
344
|
+
file="string",
|
327
345
|
)
|
328
346
|
```
|
329
347
|
|
@@ -365,13 +383,13 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
365
383
|
from chunkr_ai import Chunkr
|
366
384
|
|
367
385
|
client = Chunkr()
|
368
|
-
response = client.
|
369
|
-
file="
|
386
|
+
response = client.tasks.parse.with_raw_response.create(
|
387
|
+
file="string",
|
370
388
|
)
|
371
389
|
print(response.headers.get('X-My-Header'))
|
372
390
|
|
373
|
-
|
374
|
-
print(
|
391
|
+
parse = response.parse() # get the object that `tasks.parse.create()` would have returned
|
392
|
+
print(parse.task_id)
|
375
393
|
```
|
376
394
|
|
377
395
|
These methods return an [`APIResponse`](https://github.com/lumina-ai-inc/chunkr-python/tree/main/src/chunkr_ai/_response.py) object.
|
@@ -385,8 +403,8 @@ The above interface eagerly reads the full response body when you make the reque
|
|
385
403
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
386
404
|
|
387
405
|
```python
|
388
|
-
with client.
|
389
|
-
file="
|
406
|
+
with client.tasks.parse.with_streaming_response.create(
|
407
|
+
file="string",
|
390
408
|
) as response:
|
391
409
|
print(response.headers.get("X-My-Header"))
|
392
410
|
|
@@ -0,0 +1,52 @@
|
|
1
|
+
chunkr_ai/__init__.py,sha256=scS30uHiCpLbaalKTAJSCFSTqnu_b9R5JCkTu2hmbzU,2587
|
2
|
+
chunkr_ai/_base_client.py,sha256=Nv5b_rmVdmmPbF42mlOfymbSC6lxcYsrsvBhKSBDXWQ,67038
|
3
|
+
chunkr_ai/_client.py,sha256=fseZHGtnXGw3uSa1Le8SxH2oSBeHczn6mOsLeLGj4rY,15867
|
4
|
+
chunkr_ai/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
|
5
|
+
chunkr_ai/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
|
6
|
+
chunkr_ai/_exceptions.py,sha256=ClgXUcwf4qhBTXnK4LzUPQCFdFldRxAlcYdOFFgpTxA,3220
|
7
|
+
chunkr_ai/_files.py,sha256=SUFtic_gwSzbvhLtMdQ7TBem8szrqZE2nZFFMRa0KTw,3619
|
8
|
+
chunkr_ai/_models.py,sha256=KvjsMfb88XZlFUKVoOxr8OyDj47MhoH2OKqWNEbBhk4,30010
|
9
|
+
chunkr_ai/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
|
10
|
+
chunkr_ai/_resource.py,sha256=f5tiwjxcKdbeMor8idoHtMFTUhqD9yc2xXtq5rqeLLk,1100
|
11
|
+
chunkr_ai/_response.py,sha256=xXNpF53hiYARmAW7npKuxQ5UHAEjgAzm7ME_L3eIstY,28800
|
12
|
+
chunkr_ai/_streaming.py,sha256=ZmyrVWk7-AWkLAATR55WgNxnyFzYmaqJt2LthA_PTqQ,10100
|
13
|
+
chunkr_ai/_types.py,sha256=dnzU2Q2tLcuk29QFEcnPC1wp0-4XB4Cpef_3AnRhV5Y,6200
|
14
|
+
chunkr_ai/_version.py,sha256=ZlaSb0jnVJ7N4kkTfvr8UrgWy--cDr9CwSzUZLsiWbo,169
|
15
|
+
chunkr_ai/pagination.py,sha256=bT-ErcJ80YlKBV6tWq2s9uqg-wv7o66SKe_AgUAGrKc,3533
|
16
|
+
chunkr_ai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
+
chunkr_ai/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
|
18
|
+
chunkr_ai/_utils/_logs.py,sha256=ylZvP2JTPNlFCbxYajpsnWkA253kDFgnFYDWWuvgf_Q,780
|
19
|
+
chunkr_ai/_utils/_proxy.py,sha256=aglnj2yBTDyGX9Akk2crZHrl10oqRmceUy2Zp008XEs,1975
|
20
|
+
chunkr_ai/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnmEMU,1364
|
21
|
+
chunkr_ai/_utils/_resources_proxy.py,sha256=3KbSCApjaz7x_frFAxJe9ltY-dIJBQUVnIhR2GvVRY8,604
|
22
|
+
chunkr_ai/_utils/_streams.py,sha256=SMC90diFFecpEg_zgDRVbdR3hSEIgVVij4taD-noMLM,289
|
23
|
+
chunkr_ai/_utils/_sync.py,sha256=TpGLrrhRNWTJtODNE6Fup3_k7zrWm1j2RlirzBwre-0,2862
|
24
|
+
chunkr_ai/_utils/_transform.py,sha256=n7kskEWz6o__aoNvhFoGVyDoalNe6mJwp-g7BWkdj88,15617
|
25
|
+
chunkr_ai/_utils/_typing.py,sha256=D0DbbNu8GnYQTSICnTSHDGsYXj8TcAKyhejb0XcnjtY,4602
|
26
|
+
chunkr_ai/_utils/_utils.py,sha256=ts4CiiuNpFiGB6YMdkQRh2SZvYvsl7mAF-JWHCcLDf4,12312
|
27
|
+
chunkr_ai/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
28
|
+
chunkr_ai/resources/__init__.py,sha256=K-axuAEg2pJQl45N5ao1tm8AnRwpQVVNp_b6qSMgB6A,1426
|
29
|
+
chunkr_ai/resources/files.py,sha256=Dez080pD_xUr1jOW3y6QSg92sSSZhEYObPze2RWktoY,26304
|
30
|
+
chunkr_ai/resources/health.py,sha256=XTvUtRs5hEK-uccb_40mcIex85eEUo1a171nQUjpSOs,4965
|
31
|
+
chunkr_ai/resources/tasks/__init__.py,sha256=W-sclAx_Kfm7OBGlSs694QzNCMkewtz9LU9KRcb8Ud0,976
|
32
|
+
chunkr_ai/resources/tasks/parse.py,sha256=um0sw2ZU7bY6AK7LKAS0GxAHUyuSzav_NlhxXPjNjxY,28491
|
33
|
+
chunkr_ai/resources/tasks/tasks.py,sha256=UC15zZNpY7u85X_JJudDuNrnpaeULiISaBde4BRHGSw,21653
|
34
|
+
chunkr_ai/types/__init__.py,sha256=70x8dXFkNKZJZMQyHDswdY2c-gppLNAda9aqGksZwjM,728
|
35
|
+
chunkr_ai/types/delete.py,sha256=EU78fjXpc8-fqvgcFTuJ0ejs5u_UjbhOz5frkeUHvxY,225
|
36
|
+
chunkr_ai/types/file.py,sha256=kOxR0g-3A-qOxz2cjuTcq0wFMqPoph9uQuLYQ56zb-c,718
|
37
|
+
chunkr_ai/types/file_create_params.py,sha256=eR5tUPv1ZxGk94y6Ps5PDF5AoHsTfPRM9jNxnrEEnCQ,440
|
38
|
+
chunkr_ai/types/file_list_params.py,sha256=oJGTf88aAxBhNfmQDbxGT63b95HdSbMXUubKjXM22_U,822
|
39
|
+
chunkr_ai/types/file_url.py,sha256=L434WnOXkNmt59dJiaAgT1_3pN3BIsxm2q14zHQK6xY,365
|
40
|
+
chunkr_ai/types/file_url_params.py,sha256=ZHfKiy_6B25StdDemulavGcsPggNNMKLWf6KN7xfPTY,413
|
41
|
+
chunkr_ai/types/files_page_response.py,sha256=N0Wwr8NeDxF-AX4Zs1HYDMeFoxJ8jxkFoCADgt6bZik,506
|
42
|
+
chunkr_ai/types/health_check_response.py,sha256=6Zn5YYHCQf2RgMjDlf39mtiTPqfaBfC9Vv599U_rKCI,200
|
43
|
+
chunkr_ai/types/task.py,sha256=aew6aT0ngKtwgfUCSCvMTJOBQL1Xp0F0otB_wxumIGQ,46703
|
44
|
+
chunkr_ai/types/task_get_params.py,sha256=Nx2luhebcoaiuRln4KP4FarWvBPd1OYi__efi56zHPM,460
|
45
|
+
chunkr_ai/types/task_list_params.py,sha256=fCku42QW6QUsLmZgKJBaxisGvUcmcQ5fa6LgHHRIwiQ,1043
|
46
|
+
chunkr_ai/types/tasks/__init__.py,sha256=VdLEmQvgPoiykSEYaRhkMYVaIueGDkR4P_MjCq9SbQY,267
|
47
|
+
chunkr_ai/types/tasks/parse_create_params.py,sha256=PBg2VR_OnBdB8K4NihuefGJXgUXBn7v5317LZG7PDks,34340
|
48
|
+
chunkr_ai/types/tasks/parse_update_params.py,sha256=B1cKfdX_cNDh0m2zDoH0FiZP_Qc-a5GFy-5iXHDHuy8,34113
|
49
|
+
chunkr_ai-0.1.0a3.dist-info/METADATA,sha256=1KrH5ko1te-nf_LOutXz2FeuCG8BErWw2WdXFDrXMKc,16441
|
50
|
+
chunkr_ai-0.1.0a3.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
51
|
+
chunkr_ai-0.1.0a3.dist-info/licenses/LICENSE,sha256=3FDRL-L-DFkrFy8yJpb1Nxhuztm0PB2kawcCgK5utFg,11336
|
52
|
+
chunkr_ai-0.1.0a3.dist-info/RECORD,,
|