retab 0.0.42__py3-none-any.whl → 0.0.44__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.
- retab/__init__.py +2 -1
- retab/client.py +26 -51
- retab/generate_types.py +180 -0
- retab/resources/consensus/client.py +1 -1
- retab/resources/consensus/responses.py +1 -1
- retab/resources/deployments/__init__.py +3 -0
- retab/resources/deployments/automations/__init__.py +9 -0
- retab/resources/deployments/automations/client.py +244 -0
- retab/resources/deployments/automations/endpoints.py +290 -0
- retab/resources/deployments/automations/links.py +303 -0
- retab/resources/deployments/automations/logs.py +222 -0
- retab/resources/deployments/automations/mailboxes.py +423 -0
- retab/resources/deployments/automations/outlook.py +377 -0
- retab/resources/deployments/automations/tests.py +161 -0
- retab/resources/deployments/client.py +148 -0
- retab/resources/documents/client.py +94 -68
- retab/resources/documents/extractions.py +55 -46
- retab/resources/evaluations/__init__.py +2 -2
- retab/resources/evaluations/client.py +61 -77
- retab/resources/evaluations/documents.py +48 -37
- retab/resources/evaluations/iterations.py +58 -40
- retab/resources/jsonlUtils.py +3 -4
- retab/resources/processors/automations/endpoints.py +49 -39
- retab/resources/processors/automations/links.py +52 -43
- retab/resources/processors/automations/mailboxes.py +74 -59
- retab/resources/processors/automations/outlook.py +104 -82
- retab/resources/processors/client.py +35 -30
- retab/resources/projects/__init__.py +3 -0
- retab/resources/projects/client.py +285 -0
- retab/resources/projects/documents.py +244 -0
- retab/resources/projects/iterations.py +470 -0
- retab/resources/usage.py +2 -0
- retab/types/ai_models.py +2 -1
- retab/types/deprecated_evals.py +195 -0
- retab/types/evaluations/__init__.py +5 -2
- retab/types/evaluations/iterations.py +9 -43
- retab/types/evaluations/model.py +19 -24
- retab/types/extractions.py +1 -0
- retab/types/jobs/base.py +1 -1
- retab/types/jobs/evaluation.py +1 -1
- retab/types/logs.py +5 -6
- retab/types/mime.py +1 -10
- retab/types/projects/__init__.py +34 -0
- retab/types/projects/documents.py +30 -0
- retab/types/projects/iterations.py +78 -0
- retab/types/projects/model.py +68 -0
- retab/types/schemas/enhance.py +22 -5
- retab/types/schemas/evaluate.py +2 -2
- retab/types/schemas/object.py +27 -25
- retab/types/standards.py +2 -2
- retab/utils/__init__.py +3 -0
- retab/utils/ai_models.py +127 -12
- retab/utils/hashing.py +24 -0
- retab/utils/json_schema.py +1 -26
- retab/utils/mime.py +0 -17
- retab/utils/usage/usage.py +0 -1
- {retab-0.0.42.dist-info → retab-0.0.44.dist-info}/METADATA +4 -6
- {retab-0.0.42.dist-info → retab-0.0.44.dist-info}/RECORD +60 -55
- retab/_utils/__init__.py +0 -0
- retab/_utils/_model_cards/anthropic.yaml +0 -59
- retab/_utils/_model_cards/auto.yaml +0 -43
- retab/_utils/_model_cards/gemini.yaml +0 -117
- retab/_utils/_model_cards/openai.yaml +0 -301
- retab/_utils/_model_cards/xai.yaml +0 -28
- retab/_utils/ai_models.py +0 -138
- retab/_utils/benchmarking.py +0 -484
- retab/_utils/chat.py +0 -327
- retab/_utils/display.py +0 -440
- retab/_utils/json_schema.py +0 -2156
- retab/_utils/mime.py +0 -165
- retab/_utils/responses.py +0 -169
- retab/_utils/stream_context_managers.py +0 -52
- retab/_utils/usage/__init__.py +0 -0
- retab/_utils/usage/usage.py +0 -301
- {retab-0.0.42.dist-info → retab-0.0.44.dist-info}/WHEEL +0 -0
- {retab-0.0.42.dist-info → retab-0.0.44.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,7 @@ from pathlib import Path
|
|
3
3
|
from typing import Any, List, Literal, Optional
|
4
4
|
|
5
5
|
from pydantic import EmailStr, HttpUrl
|
6
|
-
from
|
6
|
+
from ....types.standards import FieldUnset
|
7
7
|
|
8
8
|
from ...._resource import AsyncAPIResource, SyncAPIResource
|
9
9
|
from ....utils.mime import prepare_mime_document
|
@@ -21,25 +21,32 @@ class MailBoxesMixin:
|
|
21
21
|
name: str,
|
22
22
|
processor_id: str,
|
23
23
|
webhook_url: str,
|
24
|
-
authorized_domains: list[str] =
|
25
|
-
authorized_emails: list[EmailStr] =
|
26
|
-
webhook_headers: dict[str, str] =
|
27
|
-
default_language: str =
|
28
|
-
need_validation: bool =
|
24
|
+
authorized_domains: list[str] = FieldUnset,
|
25
|
+
authorized_emails: list[EmailStr] = FieldUnset,
|
26
|
+
webhook_headers: dict[str, str] = FieldUnset,
|
27
|
+
default_language: str = FieldUnset,
|
28
|
+
need_validation: bool = FieldUnset,
|
29
29
|
) -> PreparedRequest:
|
30
30
|
"""Create a new email automation configuration."""
|
31
|
-
|
32
|
-
name
|
33
|
-
processor_id
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
31
|
+
mailbox_dict: dict[str, Any] = {
|
32
|
+
'name': name,
|
33
|
+
'processor_id': processor_id,
|
34
|
+
'webhook_url': webhook_url,
|
35
|
+
'email': email,
|
36
|
+
}
|
37
|
+
if default_language is not FieldUnset:
|
38
|
+
mailbox_dict['default_language'] = default_language
|
39
|
+
if webhook_headers is not FieldUnset:
|
40
|
+
mailbox_dict['webhook_headers'] = webhook_headers
|
41
|
+
if need_validation is not FieldUnset:
|
42
|
+
mailbox_dict['need_validation'] = need_validation
|
43
|
+
if authorized_domains is not FieldUnset:
|
44
|
+
mailbox_dict['authorized_domains'] = authorized_domains
|
45
|
+
if authorized_emails is not FieldUnset:
|
46
|
+
mailbox_dict['authorized_emails'] = authorized_emails
|
47
|
+
|
48
|
+
mailbox = Mailbox(**mailbox_dict)
|
49
|
+
return PreparedRequest(method="POST", url=self.mailboxes_base_url, data=mailbox.model_dump(mode="json", exclude_unset=True))
|
43
50
|
|
44
51
|
def prepare_list(
|
45
52
|
self,
|
@@ -73,24 +80,32 @@ class MailBoxesMixin:
|
|
73
80
|
def prepare_update(
|
74
81
|
self,
|
75
82
|
mailbox_id: str,
|
76
|
-
name: str =
|
77
|
-
default_language: str =
|
78
|
-
webhook_url: str =
|
79
|
-
webhook_headers: dict[str, str] =
|
80
|
-
need_validation: bool =
|
81
|
-
authorized_domains: list[str] =
|
82
|
-
authorized_emails: list[str] =
|
83
|
+
name: str = FieldUnset,
|
84
|
+
default_language: str = FieldUnset,
|
85
|
+
webhook_url: str = FieldUnset,
|
86
|
+
webhook_headers: dict[str, str] = FieldUnset,
|
87
|
+
need_validation: bool = FieldUnset,
|
88
|
+
authorized_domains: list[str] = FieldUnset,
|
89
|
+
authorized_emails: list[str] = FieldUnset,
|
83
90
|
) -> PreparedRequest:
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
update_dict: dict[str, Any] = {}
|
92
|
+
if name is not FieldUnset:
|
93
|
+
update_dict['name'] = name
|
94
|
+
if default_language is not FieldUnset:
|
95
|
+
update_dict['default_language'] = default_language
|
96
|
+
if webhook_url is not FieldUnset:
|
97
|
+
update_dict['webhook_url'] = webhook_url
|
98
|
+
if webhook_headers is not FieldUnset:
|
99
|
+
update_dict['webhook_headers'] = webhook_headers
|
100
|
+
if need_validation is not FieldUnset:
|
101
|
+
update_dict['need_validation'] = need_validation
|
102
|
+
if authorized_domains is not FieldUnset:
|
103
|
+
update_dict['authorized_domains'] = authorized_domains
|
104
|
+
if authorized_emails is not FieldUnset:
|
105
|
+
update_dict['authorized_emails'] = authorized_emails
|
106
|
+
|
107
|
+
update_mailbox_request = UpdateMailboxRequest(**update_dict)
|
108
|
+
return PreparedRequest(method="PUT", url=f"/v1/processors/automations/mailboxes/{mailbox_id}", data=update_mailbox_request.model_dump(mode="json", exclude_unset=True))
|
94
109
|
|
95
110
|
def prepare_delete(self, mailbox_id: str) -> PreparedRequest:
|
96
111
|
return PreparedRequest(method="DELETE", url=f"/v1/processors/automations/mailboxes/{mailbox_id}", raise_for_status=True)
|
@@ -109,11 +124,11 @@ class Mailboxes(SyncAPIResource, MailBoxesMixin):
|
|
109
124
|
name: str,
|
110
125
|
webhook_url: str,
|
111
126
|
processor_id: str,
|
112
|
-
authorized_domains: list[str] =
|
113
|
-
authorized_emails: list[EmailStr] =
|
114
|
-
webhook_headers: dict[str, str] =
|
115
|
-
default_language: str =
|
116
|
-
need_validation: bool =
|
127
|
+
authorized_domains: list[str] = FieldUnset,
|
128
|
+
authorized_emails: list[EmailStr] = FieldUnset,
|
129
|
+
webhook_headers: dict[str, str] = FieldUnset,
|
130
|
+
default_language: str = FieldUnset,
|
131
|
+
need_validation: bool = FieldUnset,
|
117
132
|
) -> Mailbox:
|
118
133
|
"""Create a new email automation configuration.
|
119
134
|
|
@@ -202,13 +217,13 @@ class Mailboxes(SyncAPIResource, MailBoxesMixin):
|
|
202
217
|
def update(
|
203
218
|
self,
|
204
219
|
mailbox_id: str,
|
205
|
-
name: str =
|
206
|
-
default_language: str =
|
207
|
-
webhook_url: str =
|
208
|
-
webhook_headers: dict[str, str] =
|
209
|
-
need_validation: bool =
|
210
|
-
authorized_domains: List[str] =
|
211
|
-
authorized_emails: List[str] =
|
220
|
+
name: str = FieldUnset,
|
221
|
+
default_language: str = FieldUnset,
|
222
|
+
webhook_url: str = FieldUnset,
|
223
|
+
webhook_headers: dict[str, str] = FieldUnset,
|
224
|
+
need_validation: bool = FieldUnset,
|
225
|
+
authorized_domains: List[str] = FieldUnset,
|
226
|
+
authorized_emails: List[str] = FieldUnset,
|
212
227
|
) -> Mailbox:
|
213
228
|
"""Update an email automation configuration.
|
214
229
|
|
@@ -260,11 +275,11 @@ class AsyncMailboxes(AsyncAPIResource, MailBoxesMixin):
|
|
260
275
|
name: str,
|
261
276
|
webhook_url: str,
|
262
277
|
processor_id: str,
|
263
|
-
authorized_domains: List[str] =
|
264
|
-
authorized_emails: List[EmailStr] =
|
265
|
-
webhook_headers: dict[str, str] =
|
266
|
-
default_language: str =
|
267
|
-
need_validation: bool =
|
278
|
+
authorized_domains: List[str] = FieldUnset,
|
279
|
+
authorized_emails: List[EmailStr] = FieldUnset,
|
280
|
+
webhook_headers: dict[str, str] = FieldUnset,
|
281
|
+
default_language: str = FieldUnset,
|
282
|
+
need_validation: bool = FieldUnset,
|
268
283
|
) -> Mailbox:
|
269
284
|
request = self.prepare_create(
|
270
285
|
email=email,
|
@@ -315,13 +330,13 @@ class AsyncMailboxes(AsyncAPIResource, MailBoxesMixin):
|
|
315
330
|
async def update(
|
316
331
|
self,
|
317
332
|
mailbox_id: str,
|
318
|
-
name: str =
|
319
|
-
default_language: str =
|
320
|
-
webhook_url: str =
|
321
|
-
webhook_headers: dict[str, str] =
|
322
|
-
need_validation: bool =
|
323
|
-
authorized_domains: List[str] =
|
324
|
-
authorized_emails: List[str] =
|
333
|
+
name: str = FieldUnset,
|
334
|
+
default_language: str = FieldUnset,
|
335
|
+
webhook_url: str = FieldUnset,
|
336
|
+
webhook_headers: dict[str, str] = FieldUnset,
|
337
|
+
need_validation: bool = FieldUnset,
|
338
|
+
authorized_domains: List[str] = FieldUnset,
|
339
|
+
authorized_emails: List[str] = FieldUnset,
|
325
340
|
) -> Mailbox:
|
326
341
|
request = self.prepare_update(
|
327
342
|
mailbox_id=mailbox_id,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import Any, Literal, List
|
2
2
|
|
3
|
-
from
|
3
|
+
from ....types.standards import FieldUnset
|
4
4
|
|
5
5
|
from ...._resource import AsyncAPIResource, SyncAPIResource
|
6
6
|
from ....types.automations.outlook import (
|
@@ -21,33 +21,44 @@ class OutlooksMixin:
|
|
21
21
|
name: str,
|
22
22
|
processor_id: str,
|
23
23
|
webhook_url: str,
|
24
|
-
default_language: str =
|
25
|
-
webhook_headers: dict[str, str] =
|
26
|
-
need_validation: bool =
|
27
|
-
authorized_domains: list[str] =
|
28
|
-
authorized_emails: list[str] =
|
29
|
-
layout_schema: dict[str, Any] =
|
30
|
-
match_params: list[MatchParams] =
|
31
|
-
fetch_params: list[FetchParams] =
|
24
|
+
default_language: str = FieldUnset,
|
25
|
+
webhook_headers: dict[str, str] = FieldUnset,
|
26
|
+
need_validation: bool = FieldUnset,
|
27
|
+
authorized_domains: list[str] = FieldUnset,
|
28
|
+
authorized_emails: list[str] = FieldUnset,
|
29
|
+
layout_schema: dict[str, Any] = FieldUnset,
|
30
|
+
match_params: list[MatchParams] = FieldUnset,
|
31
|
+
fetch_params: list[FetchParams] = FieldUnset,
|
32
32
|
) -> PreparedRequest:
|
33
|
+
# Build outlook dictionary with only provided fields
|
34
|
+
outlook_dict: dict[str, Any] = {
|
35
|
+
'processor_id': processor_id,
|
36
|
+
'name': name,
|
37
|
+
'webhook_url': webhook_url,
|
38
|
+
}
|
39
|
+
if default_language is not FieldUnset:
|
40
|
+
outlook_dict['default_language'] = default_language
|
41
|
+
if webhook_headers is not FieldUnset:
|
42
|
+
outlook_dict['webhook_headers'] = webhook_headers
|
43
|
+
if need_validation is not FieldUnset:
|
44
|
+
outlook_dict['need_validation'] = need_validation
|
45
|
+
if authorized_domains is not FieldUnset:
|
46
|
+
outlook_dict['authorized_domains'] = authorized_domains
|
47
|
+
if authorized_emails is not FieldUnset:
|
48
|
+
outlook_dict['authorized_emails'] = authorized_emails
|
49
|
+
if layout_schema is not FieldUnset:
|
50
|
+
outlook_dict['layout_schema'] = layout_schema
|
51
|
+
if match_params is not FieldUnset:
|
52
|
+
outlook_dict['match_params'] = match_params
|
53
|
+
if fetch_params is not FieldUnset:
|
54
|
+
outlook_dict['fetch_params'] = fetch_params
|
55
|
+
|
33
56
|
# Validate the data
|
34
|
-
outlook_data = Outlook(
|
35
|
-
processor_id=processor_id,
|
36
|
-
name=name,
|
37
|
-
default_language=default_language,
|
38
|
-
webhook_url=webhook_url,
|
39
|
-
webhook_headers=webhook_headers,
|
40
|
-
need_validation=need_validation,
|
41
|
-
authorized_domains=authorized_domains,
|
42
|
-
authorized_emails=authorized_emails,
|
43
|
-
layout_schema=layout_schema,
|
44
|
-
match_params=match_params,
|
45
|
-
fetch_params=fetch_params,
|
46
|
-
)
|
57
|
+
outlook_data = Outlook(**outlook_dict)
|
47
58
|
return PreparedRequest(
|
48
59
|
method="POST",
|
49
60
|
url=self.outlooks_base_url,
|
50
|
-
data=outlook_data.model_dump(mode="json"),
|
61
|
+
data=outlook_data.model_dump(mode="json", exclude_unset=True),
|
51
62
|
)
|
52
63
|
|
53
64
|
def prepare_list(
|
@@ -80,34 +91,45 @@ class OutlooksMixin:
|
|
80
91
|
def prepare_update(
|
81
92
|
self,
|
82
93
|
outlook_id: str,
|
83
|
-
name: str =
|
84
|
-
default_language: str =
|
85
|
-
webhook_url: str =
|
86
|
-
webhook_headers: dict[str, str] =
|
87
|
-
need_validation: bool =
|
88
|
-
authorized_domains: list[str] =
|
89
|
-
authorized_emails: list[str] =
|
90
|
-
match_params: list[MatchParams] =
|
91
|
-
fetch_params: list[FetchParams] =
|
92
|
-
layout_schema: dict[str, Any] =
|
94
|
+
name: str = FieldUnset,
|
95
|
+
default_language: str = FieldUnset,
|
96
|
+
webhook_url: str = FieldUnset,
|
97
|
+
webhook_headers: dict[str, str] = FieldUnset,
|
98
|
+
need_validation: bool = FieldUnset,
|
99
|
+
authorized_domains: list[str] = FieldUnset,
|
100
|
+
authorized_emails: list[str] = FieldUnset,
|
101
|
+
match_params: list[MatchParams] = FieldUnset,
|
102
|
+
fetch_params: list[FetchParams] = FieldUnset,
|
103
|
+
layout_schema: dict[str, Any] = FieldUnset,
|
93
104
|
) -> PreparedRequest:
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
105
|
+
update_dict: dict[str, Any] = {}
|
106
|
+
if name is not FieldUnset:
|
107
|
+
update_dict['name'] = name
|
108
|
+
if default_language is not FieldUnset:
|
109
|
+
update_dict['default_language'] = default_language
|
110
|
+
if webhook_url is not FieldUnset:
|
111
|
+
update_dict['webhook_url'] = webhook_url
|
112
|
+
if webhook_headers is not FieldUnset:
|
113
|
+
update_dict['webhook_headers'] = webhook_headers
|
114
|
+
if need_validation is not FieldUnset:
|
115
|
+
update_dict['need_validation'] = need_validation
|
116
|
+
if authorized_domains is not FieldUnset:
|
117
|
+
update_dict['authorized_domains'] = authorized_domains
|
118
|
+
if authorized_emails is not FieldUnset:
|
119
|
+
update_dict['authorized_emails'] = authorized_emails
|
120
|
+
if layout_schema is not FieldUnset:
|
121
|
+
update_dict['layout_schema'] = layout_schema
|
122
|
+
if match_params is not FieldUnset:
|
123
|
+
update_dict['match_params'] = match_params
|
124
|
+
if fetch_params is not FieldUnset:
|
125
|
+
update_dict['fetch_params'] = fetch_params
|
126
|
+
|
127
|
+
update_outlook_request = UpdateOutlookRequest(**update_dict)
|
106
128
|
|
107
129
|
return PreparedRequest(
|
108
130
|
method="PUT",
|
109
131
|
url=f"{self.outlooks_base_url}/{outlook_id}",
|
110
|
-
data=update_outlook_request.model_dump(mode="json"),
|
132
|
+
data=update_outlook_request.model_dump(mode="json", exclude_unset=True),
|
111
133
|
)
|
112
134
|
|
113
135
|
def prepare_delete(self, outlook_id: str) -> PreparedRequest:
|
@@ -125,14 +147,14 @@ class Outlooks(SyncAPIResource, OutlooksMixin):
|
|
125
147
|
name: str,
|
126
148
|
processor_id: str,
|
127
149
|
webhook_url: str,
|
128
|
-
default_language: str =
|
129
|
-
webhook_headers: dict[str, str] =
|
130
|
-
need_validation: bool =
|
131
|
-
authorized_domains: list[str] =
|
132
|
-
authorized_emails: list[str] =
|
133
|
-
layout_schema: dict[str, Any] =
|
134
|
-
match_params: list[MatchParams] =
|
135
|
-
fetch_params: list[FetchParams] =
|
150
|
+
default_language: str = FieldUnset,
|
151
|
+
webhook_headers: dict[str, str] = FieldUnset,
|
152
|
+
need_validation: bool = FieldUnset,
|
153
|
+
authorized_domains: list[str] = FieldUnset,
|
154
|
+
authorized_emails: list[str] = FieldUnset,
|
155
|
+
layout_schema: dict[str, Any] = FieldUnset,
|
156
|
+
match_params: list[MatchParams] = FieldUnset,
|
157
|
+
fetch_params: list[FetchParams] = FieldUnset,
|
136
158
|
) -> Outlook:
|
137
159
|
"""Create a new outlook automation configuration.
|
138
160
|
|
@@ -211,16 +233,16 @@ class Outlooks(SyncAPIResource, OutlooksMixin):
|
|
211
233
|
def update(
|
212
234
|
self,
|
213
235
|
outlook_id: str,
|
214
|
-
name: str =
|
215
|
-
default_language: str =
|
216
|
-
webhook_url: str =
|
217
|
-
webhook_headers: dict[str, str] =
|
218
|
-
need_validation: bool =
|
219
|
-
authorized_domains: List[str] =
|
220
|
-
authorized_emails: List[str] =
|
221
|
-
layout_schema: dict[str, Any] =
|
222
|
-
match_params: List[MatchParams] =
|
223
|
-
fetch_params: List[FetchParams] =
|
236
|
+
name: str = FieldUnset,
|
237
|
+
default_language: str = FieldUnset,
|
238
|
+
webhook_url: str = FieldUnset,
|
239
|
+
webhook_headers: dict[str, str] = FieldUnset,
|
240
|
+
need_validation: bool = FieldUnset,
|
241
|
+
authorized_domains: List[str] = FieldUnset,
|
242
|
+
authorized_emails: List[str] = FieldUnset,
|
243
|
+
layout_schema: dict[str, Any] = FieldUnset,
|
244
|
+
match_params: List[MatchParams] = FieldUnset,
|
245
|
+
fetch_params: List[FetchParams] = FieldUnset,
|
224
246
|
) -> Outlook:
|
225
247
|
"""Update an outlook automation configuration.
|
226
248
|
|
@@ -274,14 +296,14 @@ class AsyncOutlooks(AsyncAPIResource, OutlooksMixin):
|
|
274
296
|
name: str,
|
275
297
|
processor_id: str,
|
276
298
|
webhook_url: str,
|
277
|
-
default_language: str =
|
278
|
-
webhook_headers: dict[str, str] =
|
279
|
-
need_validation: bool =
|
280
|
-
authorized_domains: list[str] =
|
281
|
-
authorized_emails: list[str] =
|
282
|
-
layout_schema: dict[str, Any] =
|
283
|
-
match_params: list[MatchParams] =
|
284
|
-
fetch_params: list[FetchParams] =
|
299
|
+
default_language: str = FieldUnset,
|
300
|
+
webhook_headers: dict[str, str] = FieldUnset,
|
301
|
+
need_validation: bool = FieldUnset,
|
302
|
+
authorized_domains: list[str] = FieldUnset,
|
303
|
+
authorized_emails: list[str] = FieldUnset,
|
304
|
+
layout_schema: dict[str, Any] = FieldUnset,
|
305
|
+
match_params: list[MatchParams] = FieldUnset,
|
306
|
+
fetch_params: list[FetchParams] = FieldUnset,
|
285
307
|
) -> Outlook:
|
286
308
|
request = self.prepare_create(
|
287
309
|
name=name,
|
@@ -322,16 +344,16 @@ class AsyncOutlooks(AsyncAPIResource, OutlooksMixin):
|
|
322
344
|
async def update(
|
323
345
|
self,
|
324
346
|
outlook_id: str,
|
325
|
-
name: str =
|
326
|
-
default_language: str =
|
327
|
-
webhook_url: str =
|
328
|
-
webhook_headers: dict[str, str] =
|
329
|
-
need_validation: bool =
|
330
|
-
authorized_domains: List[str] =
|
331
|
-
authorized_emails: List[str] =
|
332
|
-
layout_schema: dict[str, Any] =
|
333
|
-
match_params: List[MatchParams] =
|
334
|
-
fetch_params: List[FetchParams] =
|
347
|
+
name: str = FieldUnset,
|
348
|
+
default_language: str = FieldUnset,
|
349
|
+
webhook_url: str = FieldUnset,
|
350
|
+
webhook_headers: dict[str, str] = FieldUnset,
|
351
|
+
need_validation: bool = FieldUnset,
|
352
|
+
authorized_domains: List[str] = FieldUnset,
|
353
|
+
authorized_emails: List[str] = FieldUnset,
|
354
|
+
layout_schema: dict[str, Any] = FieldUnset,
|
355
|
+
match_params: List[MatchParams] = FieldUnset,
|
356
|
+
fetch_params: List[FetchParams] = FieldUnset,
|
335
357
|
) -> Outlook:
|
336
358
|
request = self.prepare_update(
|
337
359
|
outlook_id=outlook_id,
|
@@ -6,8 +6,6 @@ from typing import Any, List, Literal
|
|
6
6
|
import PIL.Image
|
7
7
|
from openai.types.chat.chat_completion_reasoning_effort import ChatCompletionReasoningEffort
|
8
8
|
from pydantic import BaseModel, HttpUrl
|
9
|
-
from pydantic_core import PydanticUndefined
|
10
|
-
|
11
9
|
from ..._resource import AsyncAPIResource, SyncAPIResource
|
12
10
|
from ...utils.ai_models import assert_valid_model_extraction
|
13
11
|
from ...utils.json_schema import load_json_schema
|
@@ -17,7 +15,7 @@ from ...types.documents.extractions import RetabParsedChatCompletion
|
|
17
15
|
from ...types.logs import ProcessorConfig, UpdateProcessorRequest
|
18
16
|
from ...types.modalities import Modality
|
19
17
|
from ...types.pagination import ListMetadata
|
20
|
-
from ...types.standards import PreparedRequest
|
18
|
+
from ...types.standards import PreparedRequest, FieldUnset
|
21
19
|
from .automations.client import AsyncAutomations, Automations
|
22
20
|
|
23
21
|
|
@@ -35,30 +33,37 @@ class ProcessorsMixin:
|
|
35
33
|
json_schema: dict[str, Any] | Path | str,
|
36
34
|
modality: Modality = "native",
|
37
35
|
model: str = "gpt-4o-mini",
|
38
|
-
temperature: float =
|
39
|
-
reasoning_effort: ChatCompletionReasoningEffort =
|
40
|
-
image_resolution_dpi: int =
|
41
|
-
browser_canvas: BrowserCanvas =
|
42
|
-
n_consensus: int =
|
36
|
+
temperature: float = FieldUnset,
|
37
|
+
reasoning_effort: ChatCompletionReasoningEffort = FieldUnset,
|
38
|
+
image_resolution_dpi: int = FieldUnset,
|
39
|
+
browser_canvas: BrowserCanvas = FieldUnset,
|
40
|
+
n_consensus: int = FieldUnset,
|
43
41
|
) -> PreparedRequest:
|
44
42
|
assert_valid_model_extraction(model)
|
45
43
|
|
46
44
|
# Load the JSON schema from file path, string, or dict
|
47
45
|
loaded_schema = load_json_schema(json_schema)
|
48
46
|
|
49
|
-
|
50
|
-
name
|
51
|
-
json_schema
|
52
|
-
modality
|
53
|
-
model
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
47
|
+
config_dict = {
|
48
|
+
'name': name,
|
49
|
+
'json_schema': loaded_schema,
|
50
|
+
'modality': modality,
|
51
|
+
'model': model,
|
52
|
+
}
|
53
|
+
if temperature is not FieldUnset:
|
54
|
+
config_dict['temperature'] = temperature
|
55
|
+
if reasoning_effort is not FieldUnset:
|
56
|
+
config_dict['reasoning_effort'] = reasoning_effort
|
57
|
+
if image_resolution_dpi is not FieldUnset:
|
58
|
+
config_dict['image_resolution_dpi'] = image_resolution_dpi
|
59
|
+
if browser_canvas is not FieldUnset:
|
60
|
+
config_dict['browser_canvas'] = browser_canvas
|
61
|
+
if n_consensus is not FieldUnset:
|
62
|
+
config_dict['n_consensus'] = n_consensus
|
63
|
+
|
64
|
+
processor_config = ProcessorConfig(**config_dict)
|
60
65
|
|
61
|
-
return PreparedRequest(method="POST", url="/v1/processors", data=processor_config.model_dump(mode="json"))
|
66
|
+
return PreparedRequest(method="POST", url="/v1/processors", data=processor_config.model_dump(mode="json", exclude_unset=True))
|
62
67
|
|
63
68
|
def prepare_list(
|
64
69
|
self,
|
@@ -215,11 +220,11 @@ class Processors(SyncAPIResource, ProcessorsMixin):
|
|
215
220
|
json_schema: dict[str, Any] | Path | str,
|
216
221
|
modality: Modality = "native",
|
217
222
|
model: str = "gpt-4o-mini",
|
218
|
-
temperature: float =
|
219
|
-
reasoning_effort: ChatCompletionReasoningEffort =
|
220
|
-
image_resolution_dpi: int =
|
221
|
-
browser_canvas: BrowserCanvas =
|
222
|
-
n_consensus: int =
|
223
|
+
temperature: float = FieldUnset,
|
224
|
+
reasoning_effort: ChatCompletionReasoningEffort = FieldUnset,
|
225
|
+
image_resolution_dpi: int = FieldUnset,
|
226
|
+
browser_canvas: BrowserCanvas = FieldUnset,
|
227
|
+
n_consensus: int = FieldUnset,
|
223
228
|
) -> ProcessorConfig:
|
224
229
|
"""Create a new processor configuration.
|
225
230
|
|
@@ -390,11 +395,11 @@ class AsyncProcessors(AsyncAPIResource, ProcessorsMixin):
|
|
390
395
|
json_schema: dict[str, Any] | Path | str,
|
391
396
|
modality: Modality = "native",
|
392
397
|
model: str = "gpt-4o-mini",
|
393
|
-
temperature: float =
|
394
|
-
reasoning_effort: ChatCompletionReasoningEffort =
|
395
|
-
image_resolution_dpi: int =
|
396
|
-
browser_canvas: BrowserCanvas =
|
397
|
-
n_consensus: int =
|
398
|
+
temperature: float = FieldUnset,
|
399
|
+
reasoning_effort: ChatCompletionReasoningEffort = FieldUnset,
|
400
|
+
image_resolution_dpi: int = FieldUnset,
|
401
|
+
browser_canvas: BrowserCanvas = FieldUnset,
|
402
|
+
n_consensus: int = FieldUnset,
|
398
403
|
) -> ProcessorConfig:
|
399
404
|
request = self.prepare_create(
|
400
405
|
name=name,
|