chunkr-ai 0.0.14__py3-none-any.whl → 0.0.15__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,21 +3,24 @@ from .misc import prepare_upload_data
3
3
  from .task_base import TaskBase
4
4
  import asyncio
5
5
 
6
+
6
7
  class TaskResponseAsync(TaskBase):
7
8
  async def _poll_request(self) -> dict:
8
9
  try:
9
10
  if not self._client._client:
10
11
  raise ValueError("Client not found")
11
- r = await self._client._client.get(self.task_url, headers=self._client._headers())
12
+ r = await self._client._client.get(
13
+ self.task_url, headers=self._client._headers()
14
+ )
12
15
  r.raise_for_status()
13
16
  return r.json()
14
17
  except (ConnectionError, TimeoutError) as _:
15
18
  print("Connection error while polling the task, retrying...")
16
19
  await asyncio.sleep(0.5)
17
- except Exception as e:
20
+ except Exception:
18
21
  raise
19
22
 
20
- async def poll(self) -> 'TaskResponseAsync':
23
+ async def poll(self) -> "TaskResponseAsync":
21
24
  if not self.task_url:
22
25
  raise ValueError("Task URL not found")
23
26
  if not self._client._client:
@@ -30,13 +33,15 @@ class TaskResponseAsync(TaskBase):
30
33
  return res
31
34
  await asyncio.sleep(0.5)
32
35
 
33
- async def update(self, config: Configuration) -> 'TaskResponseAsync':
36
+ async def update(self, config: Configuration) -> "TaskResponseAsync":
34
37
  if not self.task_url:
35
38
  raise ValueError("Task URL not found")
36
39
  if not self._client._client:
37
40
  raise ValueError("Client not found")
38
41
  f = prepare_upload_data(None, config)
39
- r = await self._client._client.patch(self.task_url, files=f, headers=self._client._headers())
42
+ r = await self._client._client.patch(
43
+ self.task_url, files=f, headers=self._client._headers()
44
+ )
40
45
  r.raise_for_status()
41
46
  updated = TaskResponseAsync(**r.json()).with_client(self._client)
42
47
  self.__dict__.update(updated.__dict__)
@@ -47,7 +52,9 @@ class TaskResponseAsync(TaskBase):
47
52
  raise ValueError("Task URL not found")
48
53
  if not self._client._client:
49
54
  raise ValueError("Client not found")
50
- r = await self._client._client.get(f"{self.task_url}/cancel", headers=self._client._headers())
55
+ r = await self._client._client.get(
56
+ f"{self.task_url}/cancel", headers=self._client._headers()
57
+ )
51
58
  r.raise_for_status()
52
59
  return await self.poll()
53
60
 
@@ -56,5 +63,7 @@ class TaskResponseAsync(TaskBase):
56
63
  raise ValueError("Task URL not found")
57
64
  if not self._client._client:
58
65
  raise ValueError("Client not found")
59
- r = await self._client._client.delete(self.task_url, headers=self._client._headers())
66
+ r = await self._client._client.delete(
67
+ self.task_url, headers=self._client._headers()
68
+ )
60
69
  r.raise_for_status()
@@ -5,7 +5,8 @@ from typing import TypeVar, Optional, Generic
5
5
  from pydantic import BaseModel, PrivateAttr
6
6
  from datetime import datetime
7
7
 
8
- T = TypeVar('T', bound='TaskBase')
8
+ T = TypeVar("T", bound="TaskBase")
9
+
9
10
 
10
11
  class TaskBase(BaseModel, ABC, Generic[T]):
11
12
  configuration: Configuration
chunkr_ai/models.py CHANGED
@@ -24,26 +24,25 @@ from .api.task import TaskResponse
24
24
  from .api.task_async import TaskResponseAsync
25
25
 
26
26
  __all__ = [
27
- 'BoundingBox',
28
- 'Chunk',
29
- 'ChunkProcessing',
30
- 'Configuration',
31
- 'CroppingStrategy',
32
- 'ExtractedJson',
33
- 'GenerationConfig',
34
- 'GenerationStrategy',
35
- 'JsonSchema',
36
- 'LlmConfig',
37
- 'Model',
38
- 'OCRResult',
39
- 'OcrStrategy',
40
- 'OutputResponse',
41
- 'Property',
42
- 'Segment',
43
- 'SegmentProcessing',
44
- 'SegmentType',
45
- 'SegmentationStrategy',
46
- 'Status',
47
- 'TaskResponse',
48
- 'TaskResponseAsync',
27
+ "BoundingBox",
28
+ "Chunk",
29
+ "ChunkProcessing",
30
+ "Configuration",
31
+ "CroppingStrategy",
32
+ "ExtractedJson",
33
+ "GenerationConfig",
34
+ "GenerationStrategy",
35
+ "JsonSchema",
36
+ "Model",
37
+ "OCRResult",
38
+ "OcrStrategy",
39
+ "OutputResponse",
40
+ "Property",
41
+ "Segment",
42
+ "SegmentProcessing",
43
+ "SegmentType",
44
+ "SegmentationStrategy",
45
+ "Status",
46
+ "TaskResponse",
47
+ "TaskResponseAsync",
49
48
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: chunkr-ai
3
- Version: 0.0.14
3
+ Version: 0.0.15
4
4
  Summary: Python client for Chunkr: open source document intelligence
5
5
  Author-email: Ishaan Kapoor <ishaan@lumina.sh>
6
6
  Project-URL: Homepage, https://chunkr.ai
@@ -0,0 +1,21 @@
1
+ chunkr_ai/__init__.py,sha256=q5YosvCNXPNGjV10pZY1gcvdosqUh38nVQTQA9g8EuM,110
2
+ chunkr_ai/models.py,sha256=KPcZDkRAziyke33ciEZymvCA28_QuSozoR11fXtjats,886
3
+ chunkr_ai/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ chunkr_ai/api/api.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ chunkr_ai/api/auth.py,sha256=hlv0GiUmlsbFO1wLL9sslqOnsBSoBqkL_6Mk2SDvxgE,413
6
+ chunkr_ai/api/base.py,sha256=QvHl8FInKHYKPLWDeEPpCchB1uktzOwTW7iPnyXccUc,6449
7
+ chunkr_ai/api/chunkr.py,sha256=0extAWVeZtI7B-g14smTfFZD_csdJNCcVNXx2_L69OQ,2617
8
+ chunkr_ai/api/chunkr_async.py,sha256=aa0s_tnYoujHBsfe8uLiPpVEnb2l9A3CXwPP34w9Mk8,4127
9
+ chunkr_ai/api/chunkr_base.py,sha256=k34Dyt1f21NBWZvZJ3w6Svvpg4SKnzr2ldGQ4ib96Wc,4951
10
+ chunkr_ai/api/config.py,sha256=0vbPMAYvs-tb7zIDIoSFQekz8bK0-iw3iz7BqMnHbDI,4930
11
+ chunkr_ai/api/misc.py,sha256=Dk8lWrgX-pZYcvcP2SzRhCdyBwMSSTrE8y7MzVQnScw,4878
12
+ chunkr_ai/api/protocol.py,sha256=lxIR_qoCA2a1OXjpq3LrWMdS0jRHct1bEmBlUzV8gvE,526
13
+ chunkr_ai/api/schema.py,sha256=yYesvueGgtmRa7Fi_Tpdv8A2bzHlx-B-5DxRAPlaDHo,4926
14
+ chunkr_ai/api/task.py,sha256=28J4dR8BDjvtkh3CQjW_YUEkgPXhCHBGu0wH6AQKKuE,2474
15
+ chunkr_ai/api/task_async.py,sha256=K5hTEOnmD42snPZg_JtJsVWg6QBUFZ1aBz1Abwv58-A,2529
16
+ chunkr_ai/api/task_base.py,sha256=esEawvntjzfaPnV78KW2IbIFqI74-eJV_g70BVIubbY,2329
17
+ chunkr_ai-0.0.15.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ chunkr_ai-0.0.15.dist-info/METADATA,sha256=097bhYg2V6cuxLkiVmiSTNuGzlBvGFV1Hw2bFWxBYKc,4839
19
+ chunkr_ai-0.0.15.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
20
+ chunkr_ai-0.0.15.dist-info/top_level.txt,sha256=0IZY7PZIiS8bw5r4NUQRUQ-ATi-L_3vLQVq3ZLouOW8,10
21
+ chunkr_ai-0.0.15.dist-info/RECORD,,
@@ -1,21 +0,0 @@
1
- chunkr_ai/__init__.py,sha256=eXygrEhGxxIHXNYIlHF2eied8rGsx2RphgR8Wo4lRyo,110
2
- chunkr_ai/models.py,sha256=-dbwtTHTcGhH3LXUdVUPkobbPoeFNXRizeAW8BCGSkE,903
3
- chunkr_ai/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- chunkr_ai/api/api.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- chunkr_ai/api/auth.py,sha256=iSd5Jek2BFaHGw9HY-RrqgwP56BHFU0xbSuJS4fU6AA,425
6
- chunkr_ai/api/base.py,sha256=WDHx8tU0fl9_-yvYTKL-U0uaxHv-8_bRfiw9Xkl-mWM,6499
7
- chunkr_ai/api/chunkr.py,sha256=A1KEjA4zRJkGZhYwhWde4CFncrljEMky4SO4LPzYvws,2652
8
- chunkr_ai/api/chunkr_async.py,sha256=OvXd9Ma3rsp6q8nJsWzNgTKAGk-py93DqAENE8fMQfc,4153
9
- chunkr_ai/api/chunkr_base.py,sha256=run4UJVKa7Gx8I_ME0Mol-c_b-NIcexNkgxHu_hbX5M,4996
10
- chunkr_ai/api/config.py,sha256=joTn7jiOlJXTwwza-jHauLV-39CMzaxZVGB9JBm8Cok,4862
11
- chunkr_ai/api/misc.py,sha256=9vnfrbJ7sFlZqwEIQ4NTMb5rhPOmETT7e1jR-b42PXM,4977
12
- chunkr_ai/api/protocol.py,sha256=li-zy7Z-ChR9kZqJlixQv1kUYrmesPHxwUtnE5p16tQ,529
13
- chunkr_ai/api/schema.py,sha256=OeLOhBRXeRBgEImg0Q6O9Z10ojT6aSEVvwnDR8UeENo,4971
14
- chunkr_ai/api/task.py,sha256=j-Odecnbj3NjAGDyUNmZHgqsRDYhHs3xBWgsT2rrHjs,2517
15
- chunkr_ai/api/task_async.py,sha256=HpuVW928s-V3jjPa8L5i86lvKcpKbMhkCuV1nKSyXVA,2437
16
- chunkr_ai/api/task_base.py,sha256=9S8UCsrEOAH48PmOpLlyAifKDrtaUtrBMUmMZq4Dceg,2328
17
- chunkr_ai-0.0.14.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- chunkr_ai-0.0.14.dist-info/METADATA,sha256=1reEDprWgXg6bKCGKv6LXJxZZR-dQeJn9DeXGbp4Iwk,4839
19
- chunkr_ai-0.0.14.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
20
- chunkr_ai-0.0.14.dist-info/top_level.txt,sha256=0IZY7PZIiS8bw5r4NUQRUQ-ATi-L_3vLQVq3ZLouOW8,10
21
- chunkr_ai-0.0.14.dist-info/RECORD,,