retab 0.0.35__py3-none-any.whl → 0.0.37__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.
Files changed (134) hide show
  1. {uiform → retab}/_utils/ai_models.py +2 -2
  2. {uiform → retab}/_utils/benchmarking.py +15 -16
  3. {uiform → retab}/_utils/chat.py +9 -14
  4. {uiform → retab}/_utils/display.py +0 -3
  5. {uiform → retab}/_utils/json_schema.py +9 -14
  6. {uiform → retab}/_utils/mime.py +11 -14
  7. {uiform → retab}/_utils/responses.py +9 -3
  8. {uiform → retab}/_utils/stream_context_managers.py +1 -1
  9. {uiform → retab}/_utils/usage/usage.py +28 -28
  10. {uiform → retab}/client.py +32 -31
  11. {uiform → retab}/resources/consensus/client.py +17 -36
  12. {uiform → retab}/resources/consensus/completions.py +24 -47
  13. {uiform → retab}/resources/consensus/completions_stream.py +26 -38
  14. {uiform → retab}/resources/consensus/responses.py +31 -80
  15. {uiform → retab}/resources/consensus/responses_stream.py +31 -79
  16. {uiform → retab}/resources/documents/client.py +59 -45
  17. {uiform → retab}/resources/documents/extractions.py +181 -90
  18. {uiform → retab}/resources/evals.py +56 -43
  19. retab/resources/evaluations/__init__.py +3 -0
  20. retab/resources/evaluations/client.py +301 -0
  21. retab/resources/evaluations/documents.py +233 -0
  22. retab/resources/evaluations/iterations.py +452 -0
  23. {uiform → retab}/resources/files.py +2 -2
  24. {uiform → retab}/resources/jsonlUtils.py +220 -216
  25. retab/resources/models.py +73 -0
  26. retab/resources/processors/automations/client.py +244 -0
  27. {uiform → retab}/resources/processors/automations/endpoints.py +77 -118
  28. retab/resources/processors/automations/links.py +294 -0
  29. {uiform → retab}/resources/processors/automations/logs.py +30 -19
  30. {uiform → retab}/resources/processors/automations/mailboxes.py +136 -174
  31. retab/resources/processors/automations/outlook.py +337 -0
  32. {uiform → retab}/resources/processors/automations/tests.py +22 -25
  33. {uiform → retab}/resources/processors/client.py +179 -164
  34. {uiform → retab}/resources/schemas.py +78 -66
  35. {uiform → retab}/resources/secrets/external_api_keys.py +1 -5
  36. retab/resources/secrets/webhook.py +64 -0
  37. {uiform → retab}/resources/usage.py +39 -2
  38. {uiform → retab}/types/ai_models.py +13 -13
  39. {uiform → retab}/types/automations/cron.py +19 -12
  40. {uiform → retab}/types/automations/endpoints.py +7 -4
  41. {uiform → retab}/types/automations/links.py +7 -3
  42. {uiform → retab}/types/automations/mailboxes.py +9 -9
  43. {uiform → retab}/types/automations/outlook.py +15 -11
  44. retab/types/browser_canvas.py +3 -0
  45. {uiform → retab}/types/chat.py +2 -2
  46. {uiform → retab}/types/completions.py +9 -12
  47. retab/types/consensus.py +19 -0
  48. {uiform → retab}/types/db/annotations.py +3 -3
  49. {uiform → retab}/types/db/files.py +8 -6
  50. {uiform → retab}/types/documents/create_messages.py +18 -20
  51. {uiform → retab}/types/documents/extractions.py +69 -24
  52. {uiform → retab}/types/evals.py +5 -5
  53. retab/types/evaluations/__init__.py +31 -0
  54. retab/types/evaluations/documents.py +30 -0
  55. retab/types/evaluations/iterations.py +112 -0
  56. retab/types/evaluations/model.py +73 -0
  57. retab/types/events.py +79 -0
  58. {uiform → retab}/types/extractions.py +33 -10
  59. retab/types/inference_settings.py +15 -0
  60. retab/types/jobs/base.py +54 -0
  61. retab/types/jobs/batch_annotation.py +12 -0
  62. {uiform → retab}/types/jobs/evaluation.py +1 -2
  63. {uiform → retab}/types/logs.py +37 -34
  64. retab/types/metrics.py +32 -0
  65. {uiform → retab}/types/mime.py +22 -20
  66. {uiform → retab}/types/modalities.py +10 -10
  67. retab/types/predictions.py +19 -0
  68. {uiform → retab}/types/schemas/enhance.py +4 -2
  69. {uiform → retab}/types/schemas/evaluate.py +7 -4
  70. {uiform → retab}/types/schemas/generate.py +6 -3
  71. {uiform → retab}/types/schemas/layout.py +1 -1
  72. {uiform → retab}/types/schemas/object.py +13 -14
  73. {uiform → retab}/types/schemas/templates.py +1 -3
  74. {uiform → retab}/types/secrets/external_api_keys.py +0 -1
  75. {uiform → retab}/types/standards.py +18 -1
  76. {retab-0.0.35.dist-info → retab-0.0.37.dist-info}/METADATA +7 -6
  77. retab-0.0.37.dist-info/RECORD +107 -0
  78. retab-0.0.37.dist-info/top_level.txt +1 -0
  79. retab-0.0.35.dist-info/RECORD +0 -111
  80. retab-0.0.35.dist-info/top_level.txt +0 -1
  81. uiform/_utils/benchmarking copy.py +0 -588
  82. uiform/resources/deployments/__init__.py +0 -9
  83. uiform/resources/deployments/client.py +0 -78
  84. uiform/resources/deployments/endpoints.py +0 -322
  85. uiform/resources/deployments/links.py +0 -452
  86. uiform/resources/deployments/logs.py +0 -211
  87. uiform/resources/deployments/mailboxes.py +0 -496
  88. uiform/resources/deployments/outlook.py +0 -531
  89. uiform/resources/deployments/tests.py +0 -158
  90. uiform/resources/models.py +0 -45
  91. uiform/resources/processors/automations/client.py +0 -78
  92. uiform/resources/processors/automations/links.py +0 -356
  93. uiform/resources/processors/automations/outlook.py +0 -444
  94. uiform/resources/secrets/webhook.py +0 -62
  95. uiform/types/consensus.py +0 -10
  96. uiform/types/deployments/cron.py +0 -59
  97. uiform/types/deployments/endpoints.py +0 -28
  98. uiform/types/deployments/links.py +0 -36
  99. uiform/types/deployments/mailboxes.py +0 -67
  100. uiform/types/deployments/outlook.py +0 -76
  101. uiform/types/deployments/webhooks.py +0 -21
  102. uiform/types/events.py +0 -76
  103. uiform/types/jobs/base.py +0 -150
  104. uiform/types/jobs/batch_annotation.py +0 -22
  105. uiform/types/secrets/__init__.py +0 -0
  106. {uiform → retab}/__init__.py +0 -0
  107. {uiform → retab}/_resource.py +0 -0
  108. {uiform → retab}/_utils/__init__.py +0 -0
  109. {uiform → retab}/_utils/usage/__init__.py +0 -0
  110. {uiform → retab}/py.typed +0 -0
  111. {uiform → retab}/resources/__init__.py +0 -0
  112. {uiform → retab}/resources/consensus/__init__.py +0 -0
  113. {uiform → retab}/resources/documents/__init__.py +0 -0
  114. {uiform → retab}/resources/finetuning.py +0 -0
  115. {uiform → retab}/resources/openai_example.py +0 -0
  116. {uiform → retab}/resources/processors/__init__.py +0 -0
  117. {uiform → retab}/resources/processors/automations/__init__.py +0 -0
  118. {uiform → retab}/resources/prompt_optimization.py +0 -0
  119. {uiform → retab}/resources/secrets/__init__.py +0 -0
  120. {uiform → retab}/resources/secrets/client.py +0 -0
  121. {uiform → retab}/types/__init__.py +0 -0
  122. {uiform → retab}/types/automations/__init__.py +0 -0
  123. {uiform → retab}/types/automations/webhooks.py +0 -0
  124. {uiform → retab}/types/db/__init__.py +0 -0
  125. {uiform/types/deployments → retab/types/documents}/__init__.py +0 -0
  126. {uiform → retab}/types/documents/correct_orientation.py +0 -0
  127. {uiform/types/documents → retab/types/jobs}/__init__.py +0 -0
  128. {uiform → retab}/types/jobs/finetune.py +0 -0
  129. {uiform → retab}/types/jobs/prompt_optimization.py +0 -0
  130. {uiform → retab}/types/jobs/webcrawl.py +0 -0
  131. {uiform → retab}/types/pagination.py +0 -0
  132. {uiform/types/jobs → retab/types/schemas}/__init__.py +0 -0
  133. {uiform/types/schemas → retab/types/secrets}/__init__.py +0 -0
  134. {retab-0.0.35.dist-info → retab-0.0.37.dist-info}/WHEEL +0 -0
@@ -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)