retab 0.0.36__py3-none-any.whl → 0.0.38__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 (123) hide show
  1. retab/__init__.py +4 -0
  2. {uiform → retab}/_resource.py +5 -5
  3. {uiform → retab}/_utils/ai_models.py +2 -2
  4. {uiform → retab}/_utils/benchmarking.py +15 -16
  5. {uiform → retab}/_utils/chat.py +29 -34
  6. {uiform → retab}/_utils/display.py +0 -3
  7. {uiform → retab}/_utils/json_schema.py +9 -14
  8. {uiform → retab}/_utils/mime.py +11 -14
  9. {uiform → retab}/_utils/responses.py +16 -10
  10. {uiform → retab}/_utils/stream_context_managers.py +1 -1
  11. {uiform → retab}/_utils/usage/usage.py +31 -31
  12. {uiform → retab}/client.py +54 -53
  13. {uiform → retab}/resources/consensus/client.py +19 -38
  14. {uiform → retab}/resources/consensus/completions.py +36 -59
  15. {uiform → retab}/resources/consensus/completions_stream.py +35 -47
  16. {uiform → retab}/resources/consensus/responses.py +37 -86
  17. {uiform → retab}/resources/consensus/responses_stream.py +41 -89
  18. retab/resources/documents/client.py +455 -0
  19. {uiform → retab}/resources/documents/extractions.py +192 -101
  20. {uiform → retab}/resources/evals.py +56 -43
  21. retab/resources/evaluations/__init__.py +3 -0
  22. retab/resources/evaluations/client.py +301 -0
  23. retab/resources/evaluations/documents.py +233 -0
  24. retab/resources/evaluations/iterations.py +452 -0
  25. {uiform → retab}/resources/files.py +2 -2
  26. {uiform → retab}/resources/jsonlUtils.py +225 -221
  27. retab/resources/models.py +73 -0
  28. retab/resources/processors/automations/client.py +244 -0
  29. {uiform → retab}/resources/processors/automations/endpoints.py +79 -120
  30. retab/resources/processors/automations/links.py +294 -0
  31. {uiform → retab}/resources/processors/automations/logs.py +30 -19
  32. retab/resources/processors/automations/mailboxes.py +397 -0
  33. retab/resources/processors/automations/outlook.py +337 -0
  34. {uiform → retab}/resources/processors/automations/tests.py +22 -25
  35. {uiform → retab}/resources/processors/client.py +181 -166
  36. {uiform → retab}/resources/schemas.py +78 -66
  37. {uiform → retab}/resources/secrets/external_api_keys.py +1 -5
  38. retab/resources/secrets/webhook.py +64 -0
  39. {uiform → retab}/resources/usage.py +41 -4
  40. {uiform → retab}/types/ai_models.py +17 -17
  41. {uiform → retab}/types/automations/cron.py +19 -12
  42. {uiform → retab}/types/automations/endpoints.py +7 -4
  43. {uiform → retab}/types/automations/links.py +7 -3
  44. {uiform → retab}/types/automations/mailboxes.py +10 -10
  45. {uiform → retab}/types/automations/outlook.py +15 -11
  46. {uiform → retab}/types/automations/webhooks.py +1 -1
  47. retab/types/browser_canvas.py +3 -0
  48. retab/types/chat.py +8 -0
  49. {uiform → retab}/types/completions.py +12 -15
  50. retab/types/consensus.py +19 -0
  51. {uiform → retab}/types/db/annotations.py +3 -3
  52. {uiform → retab}/types/db/files.py +8 -6
  53. {uiform → retab}/types/documents/create_messages.py +20 -22
  54. {uiform → retab}/types/documents/extractions.py +71 -26
  55. {uiform → retab}/types/evals.py +5 -5
  56. retab/types/evaluations/__init__.py +31 -0
  57. retab/types/evaluations/documents.py +30 -0
  58. retab/types/evaluations/iterations.py +112 -0
  59. retab/types/evaluations/model.py +73 -0
  60. retab/types/events.py +79 -0
  61. {uiform → retab}/types/extractions.py +36 -13
  62. retab/types/inference_settings.py +15 -0
  63. retab/types/jobs/base.py +54 -0
  64. retab/types/jobs/batch_annotation.py +12 -0
  65. {uiform → retab}/types/jobs/evaluation.py +1 -2
  66. {uiform → retab}/types/logs.py +37 -34
  67. retab/types/metrics.py +32 -0
  68. {uiform → retab}/types/mime.py +22 -20
  69. {uiform → retab}/types/modalities.py +10 -10
  70. retab/types/predictions.py +19 -0
  71. {uiform → retab}/types/schemas/enhance.py +4 -2
  72. {uiform → retab}/types/schemas/evaluate.py +7 -4
  73. {uiform → retab}/types/schemas/generate.py +6 -3
  74. {uiform → retab}/types/schemas/layout.py +1 -1
  75. {uiform → retab}/types/schemas/object.py +16 -17
  76. {uiform → retab}/types/schemas/templates.py +1 -3
  77. {uiform → retab}/types/secrets/external_api_keys.py +0 -1
  78. {uiform → retab}/types/standards.py +18 -1
  79. {retab-0.0.36.dist-info → retab-0.0.38.dist-info}/METADATA +78 -77
  80. retab-0.0.38.dist-info/RECORD +107 -0
  81. retab-0.0.38.dist-info/top_level.txt +1 -0
  82. retab-0.0.36.dist-info/RECORD +0 -96
  83. retab-0.0.36.dist-info/top_level.txt +0 -1
  84. uiform/__init__.py +0 -4
  85. uiform/_utils/benchmarking copy.py +0 -588
  86. uiform/resources/documents/client.py +0 -255
  87. uiform/resources/models.py +0 -45
  88. uiform/resources/processors/automations/client.py +0 -78
  89. uiform/resources/processors/automations/links.py +0 -356
  90. uiform/resources/processors/automations/mailboxes.py +0 -435
  91. uiform/resources/processors/automations/outlook.py +0 -444
  92. uiform/resources/secrets/webhook.py +0 -62
  93. uiform/types/chat.py +0 -8
  94. uiform/types/consensus.py +0 -10
  95. uiform/types/events.py +0 -76
  96. uiform/types/jobs/base.py +0 -150
  97. uiform/types/jobs/batch_annotation.py +0 -22
  98. {uiform → retab}/_utils/__init__.py +0 -0
  99. {uiform → retab}/_utils/usage/__init__.py +0 -0
  100. {uiform → retab}/py.typed +0 -0
  101. {uiform → retab}/resources/__init__.py +0 -0
  102. {uiform → retab}/resources/consensus/__init__.py +0 -0
  103. {uiform → retab}/resources/documents/__init__.py +0 -0
  104. {uiform → retab}/resources/finetuning.py +0 -0
  105. {uiform → retab}/resources/openai_example.py +0 -0
  106. {uiform → retab}/resources/processors/__init__.py +0 -0
  107. {uiform → retab}/resources/processors/automations/__init__.py +0 -0
  108. {uiform → retab}/resources/prompt_optimization.py +0 -0
  109. {uiform → retab}/resources/secrets/__init__.py +0 -0
  110. {uiform → retab}/resources/secrets/client.py +0 -0
  111. {uiform → retab}/types/__init__.py +0 -0
  112. {uiform → retab}/types/automations/__init__.py +0 -0
  113. {uiform → retab}/types/db/__init__.py +0 -0
  114. {uiform → retab}/types/documents/__init__.py +0 -0
  115. {uiform → retab}/types/documents/correct_orientation.py +0 -0
  116. {uiform → retab}/types/jobs/__init__.py +0 -0
  117. {uiform → retab}/types/jobs/finetune.py +0 -0
  118. {uiform → retab}/types/jobs/prompt_optimization.py +0 -0
  119. {uiform → retab}/types/jobs/webcrawl.py +0 -0
  120. {uiform → retab}/types/pagination.py +0 -0
  121. {uiform → retab}/types/schemas/__init__.py +0 -0
  122. {uiform → retab}/types/secrets/__init__.py +0 -0
  123. {retab-0.0.36.dist-info → retab-0.0.38.dist-info}/WHEEL +0 -0
@@ -1,444 +0,0 @@
1
- import json
2
- from io import IOBase
3
- from pathlib import Path
4
- from typing import Any, Dict, List, Literal, Optional
5
-
6
- from openai.types.chat.chat_completion_reasoning_effort import ChatCompletionReasoningEffort
7
- from PIL.Image import Image
8
- from pydantic import HttpUrl
9
-
10
- from ...._resource import AsyncAPIResource, SyncAPIResource
11
- from ...._utils.ai_models import assert_valid_model_extraction
12
- from ....types.automations.outlook import FetchParams, ListOutlooks, MatchParams, Outlook, UpdateOutlookRequest
13
- from ....types.logs import AutomationLog
14
- from ....types.modalities import Modality
15
- from ....types.standards import PreparedRequest
16
-
17
-
18
- class OutlooksMixin:
19
- def prepare_create(
20
- self,
21
- name: str,
22
- json_schema: Dict[str, Any],
23
- webhook_url: HttpUrl,
24
- # email specific opitonals Fields
25
- authorized_domains: List[str] = [],
26
- authorized_emails: List[str] = [],
27
- # HTTP Config Optional Fields
28
- webhook_headers: Dict[str, str] = {},
29
- # DocumentExtraction Config
30
- image_resolution_dpi: Optional[int] = None,
31
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
32
- modality: Modality = "native",
33
- model: str = "gpt-4o-mini",
34
- temperature: float = 0,
35
- reasoning_effort: ChatCompletionReasoningEffort = "medium",
36
- # Optional Fields for data integration
37
- match_params: Optional[List[MatchParams]] = None,
38
- fetch_params: Optional[List[FetchParams]] = None,
39
- layout_schema: Optional[Dict[str, Any]] = None,
40
- ) -> PreparedRequest:
41
- assert_valid_model_extraction(model)
42
-
43
- data = {
44
- "name": name,
45
- "webhook_url": webhook_url,
46
- "webhook_headers": webhook_headers,
47
- "json_schema": json_schema,
48
- "authorized_domains": authorized_domains,
49
- "authorized_emails": authorized_emails,
50
- "image_resolution_dpi": image_resolution_dpi,
51
- "browser_canvas": browser_canvas,
52
- "modality": modality,
53
- "model": model,
54
- "temperature": temperature,
55
- "reasoning_effort": reasoning_effort,
56
- "layout_schema": layout_schema,
57
- }
58
-
59
- if match_params is not None:
60
- data["match_params"] = match_params
61
- if fetch_params is not None:
62
- data["fetch_params"] = fetch_params
63
-
64
- # Validate the data
65
- outlook_data = Outlook.model_validate(data)
66
- return PreparedRequest(method="POST", url="/v1/deployments/outlook", data=outlook_data.model_dump(mode="json"))
67
-
68
- def prepare_list(
69
- self,
70
- before: str | None = None,
71
- after: str | None = None,
72
- limit: int = 10,
73
- order: Literal["asc", "desc"] | None = "desc",
74
- name: Optional[str] = None,
75
- webhook_url: Optional[str] = None,
76
- schema_id: Optional[str] = None,
77
- schema_data_id: Optional[str] = None,
78
- ) -> PreparedRequest:
79
- params = {
80
- "before": before,
81
- "after": after,
82
- "limit": limit,
83
- "order": order,
84
- "name": name,
85
- "webhook_url": webhook_url,
86
- "schema_id": schema_id,
87
- "schema_data_id": schema_data_id,
88
- }
89
- # Remove None values
90
- params = {k: v for k, v in params.items() if v is not None}
91
-
92
- return PreparedRequest(method="GET", url="/v1/deployments/outlook", params=params)
93
-
94
- def prepare_get(self, outlook_id: str) -> PreparedRequest:
95
- return PreparedRequest(method="GET", url=f"/v1/processors/automations/outlook/{outlook_id}")
96
-
97
- def prepare_update(
98
- self,
99
- outlook_id: str,
100
- name: Optional[str] = None,
101
- webhook_url: Optional[HttpUrl] = None,
102
- webhook_headers: Optional[Dict[str, str]] = None,
103
- authorized_domains: Optional[List[str]] = None,
104
- authorized_emails: Optional[List[str]] = None,
105
- image_resolution_dpi: Optional[int] = None,
106
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
107
- modality: Optional[Modality] = None,
108
- model: Optional[str] = None,
109
- temperature: Optional[float] = None,
110
- reasoning_effort: Optional[ChatCompletionReasoningEffort] = None,
111
- json_schema: Optional[Dict[str, Any]] = None,
112
- match_params: Optional[List[MatchParams]] = None,
113
- fetch_params: Optional[List[FetchParams]] = None,
114
- layout_schema: Optional[Dict[str, Any]] = None,
115
- ) -> PreparedRequest:
116
- data: dict[str, Any] = {}
117
- if name is not None:
118
- data["name"] = name
119
- if webhook_url is not None:
120
- data["webhook_url"] = webhook_url
121
- if webhook_headers is not None:
122
- data["webhook_headers"] = webhook_headers
123
- if authorized_domains is not None:
124
- data["authorized_domains"] = authorized_domains
125
- if authorized_emails is not None:
126
- data["authorized_emails"] = authorized_emails
127
- if image_resolution_dpi is not None:
128
- data["image_resolution_dpi"] = image_resolution_dpi
129
- if browser_canvas is not None:
130
- data["browser_canvas"] = browser_canvas
131
- if modality is not None:
132
- data["modality"] = modality
133
- if model is not None:
134
- assert_valid_model_extraction(model)
135
- data["model"] = model
136
- if temperature is not None:
137
- data["temperature"] = temperature
138
- if json_schema is not None:
139
- data["json_schema"] = json_schema
140
- if match_params is not None:
141
- data["match_params"] = match_params
142
- if fetch_params is not None:
143
- data["fetch_params"] = fetch_params
144
- if reasoning_effort is not None:
145
- data["reasoning_effort"] = reasoning_effort
146
- if layout_schema is not None:
147
- data["layout_schema"] = layout_schema
148
-
149
- update_outlook_request = UpdateOutlookRequest.model_validate(data)
150
-
151
- return PreparedRequest(method="PUT", url=f"/v1/processors/automations/outlook/{outlook_id}", data=update_outlook_request.model_dump(mode="json"))
152
-
153
- def prepare_delete(self, outlook_id: str) -> PreparedRequest:
154
- return PreparedRequest(method="DELETE", url=f"/v1/processors/automations/outlook/{outlook_id}")
155
-
156
- class Outlooks(SyncAPIResource, OutlooksMixin):
157
- """Outlook API wrapper for managing outlook automation configurations"""
158
-
159
- def __init__(self, client: Any) -> None:
160
- super().__init__(client=client)
161
-
162
- def create(
163
- self,
164
- name: str,
165
- json_schema: Dict[str, Any],
166
- webhook_url: HttpUrl,
167
- authorized_domains: List[str] = [],
168
- authorized_emails: List[str] = [],
169
- webhook_headers: Dict[str, str] = {},
170
- image_resolution_dpi: Optional[int] = None,
171
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
172
- modality: Modality = "native",
173
- model: str = "gpt-4o-mini",
174
- temperature: float = 0,
175
- reasoning_effort: ChatCompletionReasoningEffort = "medium",
176
- match_params: Optional[List[MatchParams]] = None,
177
- fetch_params: Optional[List[FetchParams]] = None,
178
- ) -> Outlook:
179
- """Create a new outlook automation configuration.
180
-
181
- Args:
182
- name: Name of the outlook plugin
183
- json_schema: JSON schema to validate extracted data
184
- webhook_url: Webhook URL to receive processed data
185
- webhook_headers: Webhook headers to send with processed data
186
- authorized_domains: List of authorized domains
187
- authorized_emails: List of authorized emails
188
- image_resolution_dpi: Optional image resolution DPI
189
- browser_canvas: Optional browser canvas size
190
- modality: Processing modality (currently only "native" supported)
191
- model: AI model to use for processing
192
- temperature: Model temperature setting
193
- reasoning_effort: The effort level for the model to reason about the input data.
194
- match_params: List of match parameters for the outlook automation
195
- fetch_params: List of fetch parameters for the outlook automation
196
- Returns:
197
- Outlook: The created outlook plugin configuration
198
- """
199
-
200
- request = self.prepare_create(
201
- name,
202
- json_schema,
203
- webhook_url,
204
- authorized_domains,
205
- authorized_emails,
206
- webhook_headers,
207
- image_resolution_dpi,
208
- browser_canvas,
209
- modality,
210
- model,
211
- temperature,
212
- reasoning_effort,
213
- match_params,
214
- fetch_params,
215
- )
216
- response = self._client._prepared_request(request)
217
-
218
- print(f"Outlook automation created. Outlook available at https://www.uiform.com/dashboard/processors/{response['id']}")
219
-
220
- return Outlook.model_validate(response)
221
-
222
- def list(
223
- self,
224
- before: str | None = None,
225
- after: str | None = None,
226
- limit: int = 10,
227
- order: Literal["asc", "desc"] | None = "desc",
228
- name: Optional[str] = None,
229
- webhook_url: Optional[str] = None,
230
- schema_id: Optional[str] = None,
231
- schema_data_id: Optional[str] = None,
232
- ) -> ListOutlooks:
233
- """List all outlook automation configurations.
234
-
235
- Args:
236
- before: Optional cursor for pagination - get results before this log ID
237
- after: Optional cursor for pagination - get results after this log ID
238
- limit: Maximum number of logs to return (1-100, default 10)
239
- order: Sort order by creation time - "asc" or "desc" (default "desc")
240
- name: Optional name filter
241
- webhook_url: Optional webhook URL filter
242
- schema_id: Optional schema ID filter
243
- schema_data_id: Optional schema data ID filter
244
- match_params: Optional list of match parameters for the outlook automation
245
- fetch_params: Optional list of fetch parameters for the outlook automation
246
- Returns:
247
- List[Outlook]: List of outlook plugin configurations
248
- """
249
- request = self.prepare_list(before, after, limit, order, name, webhook_url, schema_id, schema_data_id)
250
- response = self._client._prepared_request(request)
251
- return ListOutlooks.model_validate(response)
252
-
253
- def get(self, id: str) -> Outlook:
254
- """Get a specific outlook automation configuration.
255
-
256
- Args:
257
- id: ID of the outlook plugin
258
-
259
- Returns:
260
- Outlook: The outlook plugin configuration
261
- """
262
- request = self.prepare_get(id)
263
- response = self._client._prepared_request(request)
264
- return Outlook.model_validate(response)
265
-
266
- def update(
267
- self,
268
- outlook_id: str,
269
- name: Optional[str] = None,
270
- webhook_url: Optional[HttpUrl] = None,
271
- webhook_headers: Optional[Dict[str, str]] = None,
272
- authorized_domains: Optional[List[str]] = None,
273
- authorized_emails: Optional[List[str]] = None,
274
- image_resolution_dpi: Optional[int] = None,
275
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
276
- modality: Optional[Modality] = None,
277
- model: Optional[str] = None,
278
- temperature: Optional[float] = None,
279
- reasoning_effort: Optional[ChatCompletionReasoningEffort] = None,
280
- json_schema: Optional[Dict[str, Any]] = None,
281
- match_params: Optional[List[MatchParams]] = None,
282
- fetch_params: Optional[List[FetchParams]] = None,
283
- layout_schema: Optional[Dict[str, Any]] = None,
284
- ) -> Outlook:
285
- """Update an outlook automation configuration.
286
-
287
- Args:
288
- outlook_id: ID of the outlook plugin to update
289
- name: New name for the outlook plugin
290
- webhook_url: New webhook URL
291
- webhook_headers: New webhook headers
292
- authorized_domains: New authorized domains
293
- authorized_emails: New authorized emails
294
- image_resolution_dpi: New image resolution DPI
295
- browser_canvas: New browser canvas size
296
- modality: New processing modality
297
- model: New AI model
298
- temperature: New temperature setting
299
- reasoning_effort: New reasoning effort
300
- json_schema: New JSON schema
301
- match_params: New match parameters for the outlook automation
302
- fetch_params: New fetch parameters for the outlook automation
303
- layout_schema: New layout schema for the outlook automation
304
-
305
- Returns:
306
- Outlook: The updated outlook plugin configuration
307
- """
308
- request = self.prepare_update(
309
- outlook_id,
310
- name,
311
- webhook_url,
312
- webhook_headers,
313
- authorized_domains,
314
- authorized_emails,
315
- image_resolution_dpi,
316
- browser_canvas,
317
- modality,
318
- model,
319
- temperature,
320
- reasoning_effort,
321
- json_schema,
322
- match_params,
323
- fetch_params,
324
- layout_schema,
325
- )
326
- response = self._client._prepared_request(request)
327
- return Outlook.model_validate(response)
328
-
329
- def delete(self, outlook_id: str) -> None:
330
- """Delete an outlook automation configuration.
331
-
332
- Args:
333
- outlook_id: ID of the outlook plugin to delete
334
- """
335
- request = self.prepare_delete(outlook_id)
336
- response = self._client._prepared_request(request)
337
- return None
338
-
339
-
340
- class AsyncOutlooks(AsyncAPIResource, OutlooksMixin):
341
- def __init__(self, client: Any) -> None:
342
- super().__init__(client=client)
343
-
344
- async def create(
345
- self,
346
- name: str,
347
- json_schema: Dict[str, Any],
348
- webhook_url: HttpUrl,
349
- authorized_domains: List[str] = [],
350
- authorized_emails: List[str] = [],
351
- webhook_headers: Dict[str, str] = {},
352
- image_resolution_dpi: Optional[int] = None,
353
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
354
- modality: Modality = "native",
355
- model: str = "gpt-4o-mini",
356
- temperature: float = 0,
357
- reasoning_effort: ChatCompletionReasoningEffort = "medium",
358
- match_params: List[MatchParams] = [],
359
- fetch_params: List[FetchParams] = [],
360
- ) -> Outlook:
361
- request = self.prepare_create(
362
- name,
363
- json_schema,
364
- webhook_url,
365
- authorized_domains,
366
- authorized_emails,
367
- webhook_headers,
368
- image_resolution_dpi,
369
- browser_canvas,
370
- modality,
371
- model,
372
- temperature,
373
- reasoning_effort,
374
- match_params,
375
- fetch_params,
376
- )
377
- response = await self._client._prepared_request(request)
378
- print(f"Outlook automation created. Outlook available at https://www.uiform.com/dashboard/processors/{response['id']}")
379
- return Outlook.model_validate(response)
380
-
381
- async def list(
382
- self,
383
- before: str | None = None,
384
- after: str | None = None,
385
- limit: int = 10,
386
- order: Literal["asc", "desc"] | None = "desc",
387
- name: Optional[str] = None,
388
- webhook_url: Optional[str] = None,
389
- schema_id: Optional[str] = None,
390
- schema_data_id: Optional[str] = None,
391
- ) -> ListOutlooks:
392
- request = self.prepare_list(before, after, limit, order, name, webhook_url, schema_id, schema_data_id)
393
- response = await self._client._prepared_request(request)
394
- return ListOutlooks.model_validate(response)
395
-
396
- async def get(self, outlook_id: str) -> Outlook:
397
- request = self.prepare_get(outlook_id)
398
- response = await self._client._prepared_request(request)
399
- return Outlook.model_validate(response)
400
-
401
- async def update(
402
- self,
403
- outlook_id: str,
404
- name: Optional[str] = None,
405
- webhook_url: Optional[HttpUrl] = None,
406
- webhook_headers: Optional[Dict[str, str]] = None,
407
- authorized_domains: Optional[List[str]] = None,
408
- authorized_emails: Optional[List[str]] = None,
409
- image_resolution_dpi: Optional[int] = None,
410
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
411
- modality: Optional[Modality] = None,
412
- model: Optional[str] = None,
413
- temperature: Optional[float] = None,
414
- reasoning_effort: Optional[ChatCompletionReasoningEffort] = None,
415
- json_schema: Optional[Dict[str, Any]] = None,
416
- match_params: Optional[List[MatchParams]] = None,
417
- fetch_params: Optional[List[FetchParams]] = None,
418
- layout_schema: Optional[Dict[str, Any]] = None,
419
- ) -> Outlook:
420
- request = self.prepare_update(
421
- outlook_id,
422
- name,
423
- webhook_url,
424
- webhook_headers,
425
- authorized_domains,
426
- authorized_emails,
427
- image_resolution_dpi,
428
- browser_canvas,
429
- modality,
430
- model,
431
- temperature,
432
- reasoning_effort,
433
- json_schema,
434
- match_params,
435
- fetch_params,
436
- layout_schema,
437
- )
438
- response = await self._client._prepared_request(request)
439
- return Outlook.model_validate(response)
440
-
441
- async def delete(self, outlook_id: str) -> None:
442
- request = self.prepare_delete(outlook_id)
443
- await self._client._prepared_request(request)
444
- return None
@@ -1,62 +0,0 @@
1
- from ..._resource import AsyncAPIResource, SyncAPIResource
2
- from ...types.standards import PreparedRequest
3
-
4
-
5
- class WebhookMixin:
6
- def prepare_create(self) -> PreparedRequest:
7
- return PreparedRequest(method="POST", url="/v1/secrets/webhook")
8
-
9
- def prepare_delete(self) -> PreparedRequest:
10
- return PreparedRequest(method="DELETE", url="/v1/secrets/webhook")
11
-
12
-
13
- class Webhook(SyncAPIResource, WebhookMixin):
14
- """Webhook secret management wrapper"""
15
-
16
- def create(
17
- self,
18
- ) -> dict:
19
- """Create a webhook secret.
20
-
21
- Returns:
22
- dict: Response indicating success
23
- """
24
- request = self.prepare_create()
25
- response = self._client._prepared_request(request)
26
-
27
- return response
28
-
29
- def delete(self) -> dict:
30
- """Delete a webhook secret.
31
-
32
- Returns:
33
- dict: Response indicating success
34
- """
35
- request = self.prepare_delete()
36
- response = self._client._prepared_request(request)
37
-
38
- return response
39
-
40
-
41
- class AsyncWebhook(AsyncAPIResource, WebhookMixin):
42
- """Webhook secret management wrapper"""
43
-
44
- async def create(self) -> dict:
45
- """Create a webhook secret.
46
-
47
- Returns:
48
- dict: Response indicating success
49
- """
50
- request = self.prepare_create()
51
- response = await self._client._prepared_request(request)
52
- return response
53
-
54
- async def delete(self) -> dict:
55
- """Delete a webhook secret.
56
-
57
- Returns:
58
- dict: Response indicating success
59
- """
60
- request = self.prepare_delete()
61
- response = await self._client._prepared_request(request)
62
- return response
uiform/types/chat.py DELETED
@@ -1,8 +0,0 @@
1
- from typing import Iterable, Literal, TypedDict, Union
2
-
3
- from openai.types.chat.chat_completion_content_part_param import ChatCompletionContentPartParam
4
-
5
-
6
- class ChatCompletionUiformMessage(TypedDict): # homemade replacement for ChatCompletionMessageParam because iterable messes the serialization with pydantic
7
- role: Literal['user', 'system', 'assistant', 'developer']
8
- content: Union[str, list[ChatCompletionContentPartParam]]
uiform/types/consensus.py DELETED
@@ -1,10 +0,0 @@
1
- from pydantic import BaseModel, Field
2
-
3
-
4
- class ReconciliationResponse(BaseModel):
5
- consensus_dict: dict = Field(
6
- description="The consensus dictionary containing the reconciled values from the input dictionaries."
7
- )
8
- likelihoods: dict = Field(
9
- description="A dictionary containing the likelihood/confidence scores for each field in the consensus dictionary."
10
- )
uiform/types/events.py DELETED
@@ -1,76 +0,0 @@
1
- import datetime
2
- from typing import Any, Literal, Optional
3
-
4
- import nanoid # type: ignore
5
- from pydantic import BaseModel, Field
6
-
7
- metadata_key = Literal[
8
- 'user',
9
- 'organization',
10
- 'link',
11
- 'mailbox',
12
- 'cron',
13
- 'outlook',
14
- 'extraction',
15
- 'webhook',
16
- 'reconciliation',
17
- 'preprocessing',
18
- 'schema',
19
- 'data_structure',
20
- 'file',
21
- 'preprocessing',
22
- 'dataset',
23
- 'dataset_membership',
24
- 'endpoint',
25
- 'automation',
26
- 'template',
27
- ]
28
-
29
- event_type = Literal[
30
- 'extraction.created',
31
- 'messages.created',
32
- 'document.orientation_corrected',
33
- 'consensus.reconciled',
34
- 'automation.created',
35
- 'automation.updated',
36
- 'automation.deleted',
37
- 'automation.webhook',
38
- 'preprocessing.created',
39
- 'link.created',
40
- 'link.updated',
41
- 'link.deleted',
42
- 'link.webhook',
43
- 'mailbox.created',
44
- 'mailbox.updated',
45
- 'mailbox.deleted',
46
- 'mailbox.webhook',
47
- 'outlook.created',
48
- 'outlook.updated',
49
- 'outlook.deleted',
50
- 'outlook.webhook',
51
- 'schema.generated',
52
- 'schema.promptified',
53
- 'schema.system_promptfile.created',
54
- 'file.updated',
55
- 'file.deleted',
56
- 'template.created',
57
- 'template.deleted',
58
- 'template.sample_document_uploaded',
59
- 'template.sample_document_deleted',
60
- 'template.updated',
61
- ]
62
-
63
-
64
- class Event(BaseModel):
65
- object: Literal['event'] = "event"
66
- id: str = Field(default_factory=lambda: "event_" + nanoid.generate(), description="Unique identifier for the event")
67
- event: str = Field(..., description="A string that distinguishes the event type. Ex: user.created, user.updated, user.deleted, etc.")
68
- created_at: datetime.datetime = Field(default_factory=lambda: datetime.datetime.now(datetime.timezone.utc))
69
- data: dict[str, Any] = Field(..., description="Event payload. Payloads match the corresponding API objects.")
70
- metadata: Optional[dict[metadata_key, str]] = Field(
71
- default=None, description="Ids giving informations about the event. Ex: user.created.metadata = {'user': 'usr_8478973619047837'}"
72
- )
73
-
74
-
75
- class StoredEvent(Event):
76
- organization_id: str = Field(..., description="Organization ID")