retab 0.0.35__py3-none-any.whl → 0.0.36__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: retab
3
- Version: 0.0.35
3
+ Version: 0.0.36
4
4
  Summary: UiForm official python library
5
5
  Home-page: https://github.com/UiForm/uiform
6
6
  Author: UiForm
@@ -30,14 +30,6 @@ uiform/resources/consensus/completions.py,sha256=AFjRfoA8ubaD-8VLpf1EW7kogRde4l7
30
30
  uiform/resources/consensus/completions_stream.py,sha256=RUtfpGlxoIcyqup9Xz54OLca5cGJOBQKClg83ulWna4,11174
31
31
  uiform/resources/consensus/responses.py,sha256=gqrRA2cTSRSdMWOhMYu9RJoSYEXL45Z_7KHxGQXHkPI,12006
32
32
  uiform/resources/consensus/responses_stream.py,sha256=o373nrVY2vetxQXcqJoAiDqWYPr4sqsGSkMoht9hrXs,13653
33
- uiform/resources/deployments/__init__.py,sha256=OVgAPOTjQ5Ao4LgkdkHTMpNN_EIH0a_FjZIYy7swQng,121
34
- uiform/resources/deployments/client.py,sha256=98G-bediZYMq16xlInFb4rjTgT4QYDn89Wy93dzEDuY,2675
35
- uiform/resources/deployments/endpoints.py,sha256=v5Xi_9Do9bsPeMP6xoxjJHydt9BrmPvCQRZC-aFFpec,13002
36
- uiform/resources/deployments/links.py,sha256=bgOZvjVxZmGTWXLNxKhQtYSnJvaijZKMfAxQuBE64bU,18223
37
- uiform/resources/deployments/logs.py,sha256=PsgrdjLUITkRDQLuTqFTleVyRGfxSFvgED_V_b5Qeu8,8003
38
- uiform/resources/deployments/mailboxes.py,sha256=bkPFaUQ2LWUa23xtKR8NlGzkBuiGWXSkMxDyPAnV5w0,20084
39
- uiform/resources/deployments/outlook.py,sha256=ZglnPgtPfD64qgOf18aMe6zrbULxuFIM16Yn22k0sPc,20887
40
- uiform/resources/deployments/tests.py,sha256=bMvQD_oXaMTCX2ZSLoxvDR27I166-7SOVLx-zyq8FUE,6028
41
33
  uiform/resources/documents/__init__.py,sha256=OjXmngFN0RKqO4SI-mJBNzr6Ex6rMxfq0DxaqzP0RQs,89
42
34
  uiform/resources/documents/client.py,sha256=kDEY1v-p7adzsK4Q0LJ2SnGf73D_D3CoO-njOfdb1Kg,11356
43
35
  uiform/resources/documents/extractions.py,sha256=5_2C0BWBltkPsfgcLVDP9w55oU6gsVritIUnqt3ZDvM,20898
@@ -78,13 +70,6 @@ uiform/types/automations/webhooks.py,sha256=I_zaART2V_XrC3bzHO7wB0UlxNGLiblTltfu
78
70
  uiform/types/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
71
  uiform/types/db/annotations.py,sha256=Npy3IHwrCPl4NCxfNtiI1X3cKkLYA7BvkncBPuBLzxA,1034
80
72
  uiform/types/db/files.py,sha256=bey3MeaoIuc_FklhQ8GBiluQV8IvGjK52BwmdfYqZhY,1191
81
- uiform/types/deployments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
- uiform/types/deployments/cron.py,sha256=DDlYNAAv8rXMnty_xHnMLZaVdWTgyJCBYxupQjm_X34,3065
83
- uiform/types/deployments/endpoints.py,sha256=T6yoI8o6Qkc4Fe4R4leyH25uEpLvAABivw7aTtXoC-E,976
84
- uiform/types/deployments/links.py,sha256=hRh7dkczCGZKUx2Hrh35XzBtLC2G9i-fz3tnBOeUYkg,1215
85
- uiform/types/deployments/mailboxes.py,sha256=QU7KChIYB-Hr9-1hqxNHJyNVUJqU8h6dOuZQEO3YTJQ,2653
86
- uiform/types/deployments/outlook.py,sha256=UENQs74_X7cB_2kpj6yL2e7hMHLIowaUx3UkJU1Vtew,3395
87
- uiform/types/deployments/webhooks.py,sha256=I_zaART2V_XrC3bzHO7wB0UlxNGLiblTltfue6BCgb0,563
88
73
  uiform/types/documents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
74
  uiform/types/documents/correct_orientation.py,sha256=e-ivsslI6L6Gl0YkcslXw_DH620xMGEYVp4tdeviXeM,261
90
75
  uiform/types/documents/create_messages.py,sha256=dazBa-H4OQQcNsuu0BuUlXb5dIaBYcR0bzyeLZQAnJ8,10439
@@ -105,7 +90,7 @@ uiform/types/schemas/object.py,sha256=T25SvBfM6l6ekJz66yV8ISqJQjJMYGw1QW19cceEV9
105
90
  uiform/types/schemas/templates.py,sha256=xvfweRVGvW1Y9D42rJykqRZ_AXi_CJE_QnRusiDxgW4,3468
106
91
  uiform/types/secrets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
107
92
  uiform/types/secrets/external_api_keys.py,sha256=TYyyHAs7hl8ktQSEwcjtiUugZ0q-SZIXxYShM8NfjjA,459
108
- retab-0.0.35.dist-info/METADATA,sha256=fcVljRz67OIaFchTb62S4vnJIdJnWX8uDHM8PtirW-c,14183
109
- retab-0.0.35.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
110
- retab-0.0.35.dist-info/top_level.txt,sha256=2_46xeTCMIhYaZjPkGg3BgX3idio6qXgF4Xt0LxlSgg,7
111
- retab-0.0.35.dist-info/RECORD,,
93
+ retab-0.0.36.dist-info/METADATA,sha256=JqRHFNuclGDJudnfTzlOwaV4aZBYv6Iu3358ooWRxO4,14183
94
+ retab-0.0.36.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
95
+ retab-0.0.36.dist-info/top_level.txt,sha256=2_46xeTCMIhYaZjPkGg3BgX3idio6qXgF4Xt0LxlSgg,7
96
+ retab-0.0.36.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- from .client import (
2
- AsyncDeployments,
3
- Deployments,
4
- )
5
-
6
- __all__ = [
7
- "Deployments",
8
- "AsyncDeployments",
9
- ]
@@ -1,78 +0,0 @@
1
- import hashlib
2
- import hmac
3
- import json
4
- from typing import Any
5
-
6
- from ..._resource import AsyncAPIResource, SyncAPIResource
7
- from .endpoints import AsyncEndpoints, Endpoints
8
- from .links import AsyncLinks, Links
9
- from .mailboxes import AsyncMailboxes, Mailboxes
10
- from .outlook import AsyncOutlooks, Outlooks
11
- from .tests import AsyncTests, Tests
12
- from .logs import AsyncLogs, Logs
13
-
14
- class SignatureVerificationError(Exception):
15
- """Raised when webhook signature verification fails."""
16
-
17
- pass
18
-
19
-
20
- class DeploymentsMixin:
21
- def _verify_event(self, event_body: bytes, event_signature: str, secret: str) -> Any:
22
- """
23
- Verify the signature of a webhook event.
24
-
25
- Args:
26
- body: The raw request body
27
- signature: The signature header
28
- secret: The secret key used for signing
29
-
30
- Returns:
31
- The parsed event payload
32
-
33
- Raises:
34
- SignatureVerificationError: If the signature verification fails
35
- """
36
- expected_signature = hmac.new(secret.encode(), event_body, hashlib.sha256).hexdigest()
37
-
38
- if not hmac.compare_digest(event_signature, expected_signature):
39
- raise SignatureVerificationError("Invalid signature")
40
-
41
- return json.loads(event_body.decode('utf-8'))
42
-
43
-
44
- class Deployments(SyncAPIResource, DeploymentsMixin):
45
- """Deployments API wrapper"""
46
-
47
- def __init__(self, client: Any) -> None:
48
- super().__init__(client=client)
49
- self.mailboxes = Mailboxes(client=client)
50
- self.links = Links(client=client)
51
- self.outlook = Outlooks(client=client)
52
- self.endpoints = Endpoints(client=client)
53
- self.tests = Tests(client=client)
54
- self.logs = Logs(client=client)
55
- def verify_event(self, event_body: bytes, event_signature: str, secret: str) -> Any:
56
- """
57
- Verify the signature of a webhook event.
58
- """
59
- return self._verify_event(event_body, event_signature, secret)
60
-
61
-
62
- class AsyncDeployments(AsyncAPIResource, DeploymentsMixin):
63
- """Async Deployments API wrapper"""
64
-
65
- def __init__(self, client: Any) -> None:
66
- super().__init__(client=client)
67
- self.mailboxes = AsyncMailboxes(client=client)
68
- self.links = AsyncLinks(client=client)
69
- self.outlook = AsyncOutlooks(client=client)
70
- self.endpoints = AsyncEndpoints(client=client)
71
- self.tests = AsyncTests(client=client)
72
- self.logs = AsyncLogs(client=client)
73
-
74
- async def verify_event(self, event_body: bytes, event_signature: str, secret: str) -> Any:
75
- """
76
- Verify the signature of a webhook event.
77
- """
78
- return self._verify_event(event_body, event_signature, secret)
@@ -1,322 +0,0 @@
1
- import datetime
2
- from pathlib import Path
3
- from typing import Any, Dict, Literal, Optional
4
-
5
- import httpx
6
- from openai.types.chat.chat_completion_reasoning_effort import ChatCompletionReasoningEffort
7
- from pydantic import HttpUrl
8
-
9
- from ..._resource import AsyncAPIResource, SyncAPIResource
10
- from ..._utils.ai_models import assert_valid_model_extraction
11
- from ...types.automations.endpoints import Endpoint, ListEndpoints, UpdateEndpointRequest
12
- from ...types.logs import ExternalRequestLog
13
-
14
- # from ...types.documents.extractions import DocumentExtractResponse
15
- from ...types.mime import BaseMIMEData, MIMEData
16
- from ...types.modalities import Modality
17
- from ...types.standards import PreparedRequest
18
-
19
-
20
- class EndpointsMixin:
21
- def prepare_create(
22
- self,
23
- name: str,
24
- webhook_url: HttpUrl,
25
- json_schema: Dict[str, Any],
26
- webhook_headers: Optional[Dict[str, str]] = None,
27
- # DocumentExtraction Config
28
- image_resolution_dpi: Optional[int] = None,
29
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
30
- modality: Modality = "native",
31
- model: str = "gpt-4o-mini",
32
- temperature: float = 0,
33
- reasoning_effort: ChatCompletionReasoningEffort = "medium",
34
- ) -> PreparedRequest:
35
- assert_valid_model_extraction(model)
36
-
37
- data = {
38
- "name": name,
39
- "webhook_url": webhook_url,
40
- "webhook_headers": webhook_headers or {},
41
- "json_schema": json_schema,
42
- "image_resolution_dpi": image_resolution_dpi,
43
- "browser_canvas": browser_canvas,
44
- "modality": modality,
45
- "model": model,
46
- "temperature": temperature,
47
- "reasoning_effort": reasoning_effort,
48
- }
49
-
50
- request = Endpoint.model_validate(data)
51
- return PreparedRequest(method="POST", url="/v1/deployments/endpoints", data=request.model_dump(mode='json'))
52
-
53
- def prepare_list(
54
- self,
55
- before: Optional[str] = None,
56
- after: Optional[str] = None,
57
- limit: Optional[int] = 10,
58
- order: Optional[Literal["asc", "desc"]] = "desc",
59
- # Filtering parameters
60
- id: Optional[str] = None,
61
- name: Optional[str] = None,
62
- webhook_url: Optional[str] = None,
63
- ) -> PreparedRequest:
64
- params = {
65
- "before": before,
66
- "after": after,
67
- "limit": limit,
68
- "order": order,
69
- "id": id,
70
- "name": name,
71
- "webhook_url": webhook_url,
72
- }
73
- # Remove None values
74
- params = {k: v for k, v in params.items() if v is not None}
75
-
76
- return PreparedRequest(method="GET", url="/v1/deployments/endpoints", params=params)
77
-
78
- def prepare_get(self, id: str) -> PreparedRequest:
79
- """Get a specific endpoint configuration.
80
-
81
- Args:
82
- id: ID of the endpoint
83
-
84
- Returns:
85
- Endpoint: The endpoint configuration
86
- """
87
- return PreparedRequest(method="GET", url=f"/v1/deployments/endpoints/{id}")
88
-
89
- def prepare_update(
90
- self,
91
- id: str,
92
- name: Optional[str] = None,
93
- webhook_url: Optional[HttpUrl] = None,
94
- webhook_headers: Optional[Dict[str, str]] = None,
95
- json_schema: Optional[Dict[str, Any]] = None,
96
- image_resolution_dpi: Optional[int] = None,
97
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
98
- modality: Optional[Modality] = None,
99
- model: Optional[str] = None,
100
- temperature: Optional[float] = None,
101
- reasoning_effort: Optional[ChatCompletionReasoningEffort] = None,
102
- ) -> PreparedRequest:
103
- data: dict[str, Any] = {}
104
-
105
- if id is not None:
106
- data["id"] = id
107
- if name is not None:
108
- data["name"] = name
109
- if webhook_url is not None:
110
- data["webhook_url"] = webhook_url
111
- if webhook_headers is not None:
112
- data["webhook_headers"] = webhook_headers
113
- if json_schema is not None:
114
- data["json_schema"] = json_schema
115
- if image_resolution_dpi is not None:
116
- data["image_resolution_dpi"] = image_resolution_dpi
117
- if browser_canvas is not None:
118
- data["browser_canvas"] = browser_canvas
119
- if modality is not None:
120
- data["modality"] = modality
121
- if model is not None:
122
- assert_valid_model_extraction(model)
123
- data["model"] = model
124
- if temperature is not None:
125
- data["temperature"] = temperature
126
- if reasoning_effort is not None:
127
- data["reasoning_effort"] = reasoning_effort
128
- request = UpdateEndpointRequest.model_validate(data)
129
- return PreparedRequest(method="PUT", url=f"/v1/deployments/endpoints/{id}", data=request.model_dump(mode='json'))
130
-
131
- def prepare_delete(self, id: str) -> PreparedRequest:
132
- return PreparedRequest(method="DELETE", url=f"/v1/deployments/endpoints/{id}")
133
-
134
-
135
- class Endpoints(SyncAPIResource, EndpointsMixin):
136
- """Endpoints API wrapper for managing endpoint configurations"""
137
-
138
- def create(
139
- self,
140
- name: str,
141
- webhook_url: HttpUrl,
142
- json_schema: Dict[str, Any],
143
- webhook_headers: Optional[Dict[str, str]] = None,
144
- # DocumentExtraction Config
145
- image_resolution_dpi: Optional[int] = None,
146
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
147
- modality: Modality = "native",
148
- model: str = "gpt-4o-mini",
149
- temperature: float = 0,
150
- reasoning_effort: ChatCompletionReasoningEffort = "medium",
151
- ) -> Endpoint:
152
- """Create a new endpoint configuration.
153
-
154
- Args:
155
- name: Name of the endpoint
156
- webhook_url: Webhook endpoint URL
157
- json_schema: JSON schema for the endpoint
158
- webhook_headers: Optional HTTP headers for webhook requests
159
- image_resolution_dpi: Optional image resolution DPI
160
- browser_canvas: Optional browser canvas size
161
- modality: Processing modality (currently only "native" supported)
162
- model: AI model to use for processing
163
- temperature: Model temperature setting
164
- reasoning_effort: The effort level for the model to reason about the input data.
165
- Returns:
166
- Endpoint: The created endpoint configuration
167
- """
168
- request = self.prepare_create(name, webhook_url, json_schema, webhook_headers, image_resolution_dpi, browser_canvas, modality, model, temperature, reasoning_effort)
169
- response = self._client._prepared_request(request)
170
- print(f"Endpoint ID: {response['id']}. Endpoint available at https://www.uiform.com/dashboard/processors/{response['id']}")
171
- return Endpoint.model_validate(response)
172
-
173
- def list(
174
- self,
175
- before: Optional[str] = None,
176
- after: Optional[str] = None,
177
- limit: Optional[int] = 10,
178
- order: Optional[Literal["asc", "desc"]] = "desc",
179
- id: Optional[str] = None,
180
- name: Optional[str] = None,
181
- webhook_url: Optional[str] = None,
182
- ) -> ListEndpoints:
183
- """List endpoint configurations with pagination support.
184
-
185
- Args:
186
- before: Optional cursor for pagination before a specific endpoint ID
187
- after: Optional cursor for pagination after a specific endpoint ID
188
- limit: Optional limit on number of results (max 100)
189
- order: Optional sort order ("asc" or "desc")
190
- id: Optional filter by endpoint ID
191
- name: Optional filter by endpoint name
192
- webhook_url: Optional filter by webhook URL
193
-
194
- Returns:
195
- ListEndpoints: Paginated list of endpoint configurations with metadata
196
- """
197
- request = self.prepare_list(before, after, limit, order, id, name, webhook_url)
198
- response = self._client._prepared_request(request)
199
- return ListEndpoints.model_validate(response)
200
-
201
- def get(self, id: str) -> Endpoint:
202
- """Get a specific endpoint configuration.
203
-
204
- Args:
205
- id: ID of the endpoint
206
-
207
- Returns:
208
- Endpoint: The endpoint configuration
209
- """
210
- request = self.prepare_get(id)
211
- response = self._client._prepared_request(request)
212
- return Endpoint.model_validate(response)
213
-
214
- def update(
215
- self,
216
- id: str,
217
- name: Optional[str] = None,
218
- webhook_url: Optional[HttpUrl] = None,
219
- webhook_headers: Optional[Dict[str, str]] = None,
220
- json_schema: Optional[Dict[str, Any]] = None,
221
- image_resolution_dpi: Optional[int] = None,
222
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
223
- modality: Optional[Modality] = None,
224
- model: Optional[str] = None,
225
- temperature: Optional[float] = None,
226
- reasoning_effort: Optional[ChatCompletionReasoningEffort] = None,
227
- ) -> Endpoint:
228
- """Update an endpoint configuration.
229
-
230
- Args:
231
- id: ID of the endpoint to update
232
- name: New name for the endpoint
233
- webhook_url: New webhook URL
234
- webhook_headers: New webhook headers
235
- json_schema: New JSON schema for the endpoint
236
- image_resolution_dpi: New image resolution DPI
237
- browser_canvas: New browser canvas size
238
- modality: New processing modality
239
- model: New AI model
240
- temperature: New temperature setting
241
- reasoning_effort: The effort level for the model to reason about the input data.
242
- Returns:
243
- Endpoint: The updated endpoint configuration
244
- """
245
- request = self.prepare_update(id, name, webhook_url, webhook_headers, json_schema, image_resolution_dpi, browser_canvas, modality, model, temperature, reasoning_effort)
246
- response = self._client._prepared_request(request)
247
- return Endpoint.model_validate(response)
248
-
249
- def delete(self, id: str) -> None:
250
- """Delete an endpoint configuration.
251
-
252
- Args:
253
- id: ID of the endpoint to delete
254
- """
255
- request = self.prepare_delete(id)
256
- self._client._prepared_request(request)
257
- print(f"Endpoint Deleted. ID: {id}")
258
-
259
-
260
- class AsyncEndpoints(AsyncAPIResource, EndpointsMixin):
261
- """Async Endpoints API wrapper for managing endpoint configurations"""
262
-
263
- async def create(
264
- self,
265
- name: str,
266
- webhook_url: HttpUrl,
267
- json_schema: Dict[str, Any],
268
- webhook_headers: Optional[Dict[str, str]] = None,
269
- # DocumentExtraction Config
270
- image_resolution_dpi: Optional[int] = None,
271
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
272
- modality: Modality = "native",
273
- model: str = "gpt-4o-mini",
274
- temperature: float = 0,
275
- reasoning_effort: ChatCompletionReasoningEffort = "medium",
276
- ) -> Endpoint:
277
- request = self.prepare_create(name, webhook_url, json_schema, webhook_headers, image_resolution_dpi, browser_canvas, modality, model, temperature, reasoning_effort)
278
- response = await self._client._prepared_request(request)
279
- print(f"Endpoint ID: {response['id']}. Endpoint available at https://www.uiform.com/dashboard/processors/{response['id']}")
280
-
281
- return Endpoint.model_validate(response)
282
-
283
- async def list(
284
- self,
285
- before: Optional[str] = None,
286
- after: Optional[str] = None,
287
- limit: Optional[int] = 10,
288
- order: Optional[Literal["asc", "desc"]] = "desc",
289
- id: Optional[str] = None,
290
- name: Optional[str] = None,
291
- webhook_url: Optional[str] = None,
292
- ) -> ListEndpoints:
293
- request = self.prepare_list(before, after, limit, order, id, name, webhook_url)
294
- response = await self._client._prepared_request(request)
295
- return ListEndpoints.model_validate(response)
296
-
297
- async def get(self, id: str) -> Endpoint:
298
- request = self.prepare_get(id)
299
- response = await self._client._prepared_request(request)
300
- return Endpoint.model_validate(response)
301
-
302
- async def update(
303
- self,
304
- id: str,
305
- name: Optional[str] = None,
306
- webhook_url: Optional[HttpUrl] = None,
307
- webhook_headers: Optional[Dict[str, str]] = None,
308
- json_schema: Optional[Dict[str, Any]] = None,
309
- image_resolution_dpi: Optional[int] = None,
310
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
311
- modality: Optional[Modality] = None,
312
- model: Optional[str] = None,
313
- temperature: Optional[float] = None,
314
- reasoning_effort: Optional[ChatCompletionReasoningEffort] = None,
315
- ) -> Endpoint:
316
- request = self.prepare_update(id, name, webhook_url, webhook_headers, json_schema, image_resolution_dpi, browser_canvas, modality, model, temperature, reasoning_effort)
317
- response = await self._client._prepared_request(request)
318
- return Endpoint.model_validate(response)
319
-
320
- async def delete(self, id: str) -> None:
321
- request = self.prepare_delete(id)
322
- await self._client._prepared_request(request)