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
@@ -0,0 +1,73 @@
1
+ from openai.types.model import Model
2
+
3
+ from .._resource import AsyncAPIResource, SyncAPIResource
4
+ from ..types.standards import PreparedRequest
5
+
6
+
7
+ class ModelsMixin:
8
+ def prepare_list(
9
+ self,
10
+ supports_finetuning: bool = False,
11
+ supports_image: bool = False,
12
+ include_finetuned_models: bool = True,
13
+ ) -> PreparedRequest:
14
+ params = {
15
+ "supports_finetuning": supports_finetuning,
16
+ "supports_image": supports_image,
17
+ "include_finetuned_models": include_finetuned_models,
18
+ }
19
+ return PreparedRequest(method="GET", url="/v1/models", params=params)
20
+
21
+
22
+ class Models(SyncAPIResource, ModelsMixin):
23
+ """Models API wrapper"""
24
+
25
+ def list(
26
+ self,
27
+ supports_finetuning: bool = False,
28
+ supports_image: bool = False,
29
+ include_finetuned_models: bool = True,
30
+ ) -> list[Model]:
31
+ """
32
+ List all available models.
33
+
34
+ Args:
35
+ supports_finetuning: Filter for models that support fine-tuning
36
+ supports_image: Filter for models that support image inputs
37
+ include_finetuned_models: Include fine-tuned models in results
38
+
39
+ Returns:
40
+ list[Model]: List of available models
41
+ Raises:
42
+ HTTPException if the request fails
43
+ """
44
+ request = self.prepare_list(supports_finetuning, supports_image, include_finetuned_models)
45
+ output = self._client._prepared_request(request)
46
+ return [Model(**model) for model in output["data"]]
47
+
48
+
49
+ class AsyncModels(AsyncAPIResource, ModelsMixin):
50
+ """Models Asyncronous API wrapper"""
51
+
52
+ async def list(
53
+ self,
54
+ supports_finetuning: bool = False,
55
+ supports_image: bool = False,
56
+ include_finetuned_models: bool = True,
57
+ ) -> list[Model]:
58
+ """
59
+ List all available models asynchronously.
60
+
61
+ Args:
62
+ supports_finetuning: Filter for models that support fine-tuning
63
+ supports_image: Filter for models that support image inputs
64
+ include_finetuned_models: Include fine-tuned models in results
65
+
66
+ Returns:
67
+ list[Model]: List of available models
68
+ Raises:
69
+ HTTPException if the request fails
70
+ """
71
+ request = self.prepare_list(supports_finetuning, supports_image, include_finetuned_models)
72
+ output = await self._client._prepared_request(request)
73
+ return [Model(**model) for model in output["data"]]
@@ -0,0 +1,244 @@
1
+ import hashlib
2
+ import hmac
3
+ import json
4
+ from typing import Any, Literal, Optional, Union
5
+
6
+ from ...._resource import AsyncAPIResource, SyncAPIResource
7
+ from ....types.automations.endpoints import Endpoint, UpdateEndpointRequest
8
+ from ....types.automations.links import Link, UpdateLinkRequest
9
+ from ....types.automations.mailboxes import Mailbox, UpdateMailboxRequest
10
+ from ....types.automations.outlook import Outlook, UpdateOutlookRequest
11
+ from ....types.standards import PreparedRequest
12
+ from .endpoints import AsyncEndpoints, Endpoints
13
+ from .links import AsyncLinks, Links
14
+ from .logs import AsyncLogs, Logs
15
+ from .mailboxes import AsyncMailboxes, Mailboxes
16
+ from .outlook import AsyncOutlooks, Outlooks
17
+ from .tests import AsyncTests, Tests
18
+
19
+
20
+ class SignatureVerificationError(Exception):
21
+ """Raised when webhook signature verification fails."""
22
+
23
+ pass
24
+
25
+
26
+ class AutomationsMixin:
27
+ def _verify_event(self, event_body: bytes, event_signature: str, secret: str) -> Any:
28
+ """
29
+ Verify the signature of a webhook event.
30
+
31
+ Args:
32
+ body: The raw request body
33
+ signature: The signature header
34
+ secret: The secret key used for signing
35
+
36
+ Returns:
37
+ The parsed event payload
38
+
39
+ Raises:
40
+ SignatureVerificationError: If the signature verification fails
41
+ """
42
+ expected_signature = hmac.new(secret.encode(), event_body, hashlib.sha256).hexdigest()
43
+
44
+ if not hmac.compare_digest(event_signature, expected_signature):
45
+ raise SignatureVerificationError("Invalid signature")
46
+
47
+ return json.loads(event_body.decode("utf-8"))
48
+
49
+ def prepare_list(
50
+ self,
51
+ processor_id: str,
52
+ before: Optional[str] = None,
53
+ after: Optional[str] = None,
54
+ limit: Optional[int] = 10,
55
+ order: Optional[Literal["asc", "desc"]] = "desc",
56
+ automation_id: Optional[str] = None,
57
+ webhook_url: Optional[str] = None,
58
+ name: Optional[str] = None,
59
+ ) -> PreparedRequest:
60
+ params = {
61
+ "before": before,
62
+ "after": after,
63
+ "limit": limit,
64
+ "order": order,
65
+ "id": automation_id,
66
+ "webhook_url": webhook_url,
67
+ "name": name,
68
+ }
69
+ params = {k: v for k, v in params.items() if v is not None}
70
+ return PreparedRequest(method="GET", url=f"/v1/processors/{processor_id}/automations", params=params)
71
+
72
+ def prepare_get(self, processor_id: str, automation_id: str) -> PreparedRequest:
73
+ return PreparedRequest(method="GET", url=f"/v1/processors/{processor_id}/automations/{automation_id}")
74
+
75
+ def prepare_update(
76
+ self,
77
+ processor_id: str,
78
+ automation_id: str,
79
+ automation_data: Union[UpdateLinkRequest, UpdateMailboxRequest, UpdateEndpointRequest, UpdateOutlookRequest],
80
+ ) -> PreparedRequest:
81
+ return PreparedRequest(method="PUT", url=f"/v1/processors/{processor_id}/automations/{automation_id}", data=automation_data.model_dump(mode="json"))
82
+
83
+ def prepare_delete(self, processor_id: str, automation_id: str) -> PreparedRequest:
84
+ return PreparedRequest(method="DELETE", url=f"/v1/processors/{processor_id}/automations/{automation_id}")
85
+
86
+
87
+ class Automations(SyncAPIResource, AutomationsMixin):
88
+ """Automations API wrapper"""
89
+
90
+ def __init__(self, client: Any) -> None:
91
+ super().__init__(client=client)
92
+ self.mailboxes = Mailboxes(client=client)
93
+ self.links = Links(client=client)
94
+ self.outlook = Outlooks(client=client)
95
+ self.endpoints = Endpoints(client=client)
96
+ self.tests = Tests(client=client)
97
+ self.logs = Logs(client=client)
98
+
99
+ def verify_event(self, event_body: bytes, event_signature: str, secret: str) -> Any:
100
+ """
101
+ Verify the signature of a webhook event.
102
+ """
103
+ return self._verify_event(event_body, event_signature, secret)
104
+
105
+ def list_automations(
106
+ self,
107
+ processor_id: str,
108
+ before: Optional[str] = None,
109
+ after: Optional[str] = None,
110
+ limit: Optional[int] = 10,
111
+ order: Optional[Literal["asc", "desc"]] = "desc",
112
+ automation_id: Optional[str] = None,
113
+ webhook_url: Optional[str] = None,
114
+ name: Optional[str] = None,
115
+ ):
116
+ """List automations attached to this processor."""
117
+ request = self.prepare_list(processor_id, before, after, limit, order, automation_id, webhook_url, name)
118
+ response = self._client._prepared_request(request)
119
+ return response
120
+
121
+ def get_automation(self, processor_id: str, automation_id: str) -> Union[Link, Mailbox, Endpoint, Outlook]:
122
+ """Get a specific automation attached to this processor."""
123
+ request = self.prepare_get(processor_id, automation_id)
124
+ response = self._client._prepared_request(request)
125
+
126
+ # Return the appropriate model based on the automation type
127
+ if response["object"] == "automation.link":
128
+ return Link.model_validate(response)
129
+ elif response["object"] == "automation.mailbox":
130
+ return Mailbox.model_validate(response)
131
+ elif response["object"] == "automation.endpoint":
132
+ return Endpoint.model_validate(response)
133
+ elif response["object"] == "automation.outlook":
134
+ return Outlook.model_validate(response)
135
+ else:
136
+ raise ValueError(f"Unknown automation type: {response.get('object')}")
137
+
138
+ def update_automation(
139
+ self,
140
+ processor_id: str,
141
+ automation_id: str,
142
+ automation_data: Union[UpdateLinkRequest, UpdateMailboxRequest, UpdateEndpointRequest, UpdateOutlookRequest],
143
+ ) -> Union[Link, Mailbox, Endpoint, Outlook]:
144
+ """Update an automation attached to this processor."""
145
+ request = self.prepare_update(processor_id, automation_id, automation_data)
146
+ response = self._client._prepared_request(request)
147
+
148
+ # Return the appropriate model based on the automation type
149
+ if response["object"] == "automation.link":
150
+ return Link.model_validate(response)
151
+ elif response["object"] == "automation.mailbox":
152
+ return Mailbox.model_validate(response)
153
+ elif response["object"] == "automation.endpoint":
154
+ return Endpoint.model_validate(response)
155
+ elif response["object"] == "automation.outlook":
156
+ return Outlook.model_validate(response)
157
+ else:
158
+ raise ValueError(f"Unknown automation type: {response.get('object')}")
159
+
160
+ def delete_automation(self, processor_id: str, automation_id: str) -> None:
161
+ """Delete an automation attached to this processor."""
162
+ request = self.prepare_delete(processor_id, automation_id)
163
+ self._client._prepared_request(request)
164
+ print(f"Automation {automation_id} deleted from processor {processor_id}")
165
+
166
+
167
+ class AsyncAutomations(AsyncAPIResource, AutomationsMixin):
168
+ """Async Automations API wrapper"""
169
+
170
+ def __init__(self, client: Any) -> None:
171
+ super().__init__(client=client)
172
+ self.mailboxes = AsyncMailboxes(client=client)
173
+ self.links = AsyncLinks(client=client)
174
+ self.outlook = AsyncOutlooks(client=client)
175
+ self.endpoints = AsyncEndpoints(client=client)
176
+ self.tests = AsyncTests(client=client)
177
+ self.logs = AsyncLogs(client=client)
178
+
179
+ async def verify_event(self, event_body: bytes, event_signature: str, secret: str) -> Any:
180
+ """
181
+ Verify the signature of a webhook event.
182
+ """
183
+ return self._verify_event(event_body, event_signature, secret)
184
+
185
+ async def list(
186
+ self,
187
+ processor_id: str,
188
+ before: Optional[str] = None,
189
+ after: Optional[str] = None,
190
+ limit: Optional[int] = 10,
191
+ order: Optional[Literal["asc", "desc"]] = "desc",
192
+ automation_id: Optional[str] = None,
193
+ webhook_url: Optional[str] = None,
194
+ name: Optional[str] = None,
195
+ ):
196
+ """List automations attached to this processor."""
197
+ request = self.prepare_list(processor_id, before, after, limit, order, automation_id, webhook_url, name)
198
+ response = await self._client._prepared_request(request)
199
+ return response
200
+
201
+ async def get(self, processor_id: str, automation_id: str) -> Union[Link, Mailbox, Endpoint, Outlook]:
202
+ """Get a specific automation attached to this processor."""
203
+ request = self.prepare_get(processor_id, automation_id)
204
+ response = await self._client._prepared_request(request)
205
+
206
+ # Return the appropriate model based on the automation type
207
+ if response["object"] == "automation.link":
208
+ return Link.model_validate(response)
209
+ elif response["object"] == "automation.mailbox":
210
+ return Mailbox.model_validate(response)
211
+ elif response["object"] == "automation.endpoint":
212
+ return Endpoint.model_validate(response)
213
+ elif response["object"] == "automation.outlook":
214
+ return Outlook.model_validate(response)
215
+ else:
216
+ raise ValueError(f"Unknown automation type: {response.get('object')}")
217
+
218
+ async def update(
219
+ self,
220
+ processor_id: str,
221
+ automation_id: str,
222
+ automation_data: Union[UpdateLinkRequest, UpdateMailboxRequest, UpdateEndpointRequest, UpdateOutlookRequest],
223
+ ) -> Union[Link, Mailbox, Endpoint, Outlook]:
224
+ """Update an automation attached to this processor."""
225
+ request = self.prepare_update(processor_id, automation_id, automation_data)
226
+ response = await self._client._prepared_request(request)
227
+
228
+ # Return the appropriate model based on the automation type
229
+ if response["object"] == "automation.link":
230
+ return Link.model_validate(response)
231
+ elif response["object"] == "automation.mailbox":
232
+ return Mailbox.model_validate(response)
233
+ elif response["object"] == "automation.endpoint":
234
+ return Endpoint.model_validate(response)
235
+ elif response["object"] == "automation.outlook":
236
+ return Outlook.model_validate(response)
237
+ else:
238
+ raise ValueError(f"Unknown automation type: {response.get('object')}")
239
+
240
+ async def delete(self, processor_id: str, automation_id: str) -> None:
241
+ """Delete an automation attached to this processor."""
242
+ request = self.prepare_delete(processor_id, automation_id)
243
+ await self._client._prepared_request(request)
244
+ print(f"Automation {automation_id} deleted from processor {processor_id}")
@@ -1,54 +1,33 @@
1
- import datetime
2
- from pathlib import Path
3
- from typing import Any, Dict, Literal, Optional
1
+ from typing import Literal, Optional
4
2
 
5
- import httpx
6
- from openai.types.chat.chat_completion_reasoning_effort import ChatCompletionReasoningEffort
7
- from pydantic import HttpUrl
3
+ from pydantic_core import PydanticUndefined
8
4
 
9
5
  from ...._resource import AsyncAPIResource, SyncAPIResource
10
6
  from ...._utils.ai_models import assert_valid_model_extraction
11
7
  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
8
  from ....types.standards import PreparedRequest
18
9
 
19
10
 
20
11
  class EndpointsMixin:
21
12
  def prepare_create(
22
13
  self,
14
+ processor_id: str,
23
15
  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",
16
+ webhook_url: str,
31
17
  model: str = "gpt-4o-mini",
32
- temperature: float = 0,
33
- reasoning_effort: ChatCompletionReasoningEffort = "medium",
18
+ webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
19
+ need_validation: bool = PydanticUndefined, # type: ignore[assignment]
34
20
  ) -> PreparedRequest:
35
21
  assert_valid_model_extraction(model)
36
22
 
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'))
23
+ request = Endpoint(
24
+ processor_id=processor_id,
25
+ name=name,
26
+ webhook_url=webhook_url,
27
+ webhook_headers=webhook_headers,
28
+ need_validation=need_validation,
29
+ )
30
+ return PreparedRequest(method="POST", url="/v1/processors/automations/endpoints", data=request.model_dump(mode="json"))
52
31
 
53
32
  def prepare_list(
54
33
  self,
@@ -71,7 +50,7 @@ class EndpointsMixin:
71
50
  # Remove None values
72
51
  params = {k: v for k, v in params.items() if v is not None}
73
52
 
74
- return PreparedRequest(method="GET", url="/v1/deployments/endpoints", params=params)
53
+ return PreparedRequest(method="GET", url="/v1/processors/automations/endpoints", params=params)
75
54
 
76
55
  def prepare_get(self, endpoint_id: str) -> PreparedRequest:
77
56
  """Get a specific endpoint configuration.
@@ -87,44 +66,20 @@ class EndpointsMixin:
87
66
  def prepare_update(
88
67
  self,
89
68
  endpoint_id: str,
90
- name: Optional[str] = None,
91
- webhook_url: Optional[HttpUrl] = None,
92
- webhook_headers: Optional[Dict[str, str]] = None,
93
- json_schema: Optional[Dict[str, Any]] = None,
94
- image_resolution_dpi: Optional[int] = None,
95
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
96
- modality: Optional[Modality] = None,
97
- model: Optional[str] = None,
98
- temperature: Optional[float] = None,
99
- reasoning_effort: Optional[ChatCompletionReasoningEffort] = None,
69
+ name: str = PydanticUndefined, # type: ignore[assignment]
70
+ default_language: str = PydanticUndefined, # type: ignore[assignment]
71
+ webhook_url: str = PydanticUndefined, # type: ignore[assignment]
72
+ webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
73
+ need_validation: bool = PydanticUndefined, # type: ignore[assignment]
100
74
  ) -> PreparedRequest:
101
- data: dict[str, Any] = {}
102
-
103
- if endpoint_id is not None:
104
- data["id"] = endpoint_id
105
- if name is not None:
106
- data["name"] = name
107
- if webhook_url is not None:
108
- data["webhook_url"] = webhook_url
109
- if webhook_headers is not None:
110
- data["webhook_headers"] = webhook_headers
111
- if json_schema is not None:
112
- data["json_schema"] = json_schema
113
- if image_resolution_dpi is not None:
114
- data["image_resolution_dpi"] = image_resolution_dpi
115
- if browser_canvas is not None:
116
- data["browser_canvas"] = browser_canvas
117
- if modality is not None:
118
- data["modality"] = modality
119
- if model is not None:
120
- assert_valid_model_extraction(model)
121
- data["model"] = model
122
- if temperature is not None:
123
- data["temperature"] = temperature
124
- if reasoning_effort is not None:
125
- data["reasoning_effort"] = reasoning_effort
126
- request = UpdateEndpointRequest.model_validate(data)
127
- return PreparedRequest(method="PUT", url=f"/v1/processors/automations/endpoints/{endpoint_id}", data=request.model_dump(mode='json'))
75
+ request = UpdateEndpointRequest(
76
+ name=name,
77
+ default_language=default_language,
78
+ webhook_url=webhook_url,
79
+ webhook_headers=webhook_headers,
80
+ need_validation=need_validation,
81
+ )
82
+ return PreparedRequest(method="PUT", url=f"/v1/processors/automations/endpoints/{endpoint_id}", data=request.model_dump(mode="json"))
128
83
 
129
84
  def prepare_delete(self, endpoint_id: str) -> PreparedRequest:
130
85
  return PreparedRequest(method="DELETE", url=f"/v1/processors/automations/endpoints/{endpoint_id}")
@@ -135,17 +90,11 @@ class Endpoints(SyncAPIResource, EndpointsMixin):
135
90
 
136
91
  def create(
137
92
  self,
93
+ processor_id: str,
138
94
  name: str,
139
- webhook_url: HttpUrl,
140
- json_schema: Dict[str, Any],
141
- webhook_headers: Optional[Dict[str, str]] = None,
142
- # DocumentExtraction Config
143
- image_resolution_dpi: Optional[int] = None,
144
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
145
- modality: Modality = "native",
146
- model: str = "gpt-4o-mini",
147
- temperature: float = 0,
148
- reasoning_effort: ChatCompletionReasoningEffort = "medium",
95
+ webhook_url: str,
96
+ webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
97
+ need_validation: bool = PydanticUndefined, # type: ignore[assignment]
149
98
  ) -> Endpoint:
150
99
  """Create a new endpoint configuration.
151
100
 
@@ -163,7 +112,13 @@ class Endpoints(SyncAPIResource, EndpointsMixin):
163
112
  Returns:
164
113
  Endpoint: The created endpoint configuration
165
114
  """
166
- request = self.prepare_create(name, webhook_url, json_schema, webhook_headers, image_resolution_dpi, browser_canvas, modality, model, temperature, reasoning_effort)
115
+ request = self.prepare_create(
116
+ processor_id=processor_id,
117
+ name=name,
118
+ webhook_url=webhook_url,
119
+ webhook_headers=webhook_headers,
120
+ need_validation=need_validation,
121
+ )
167
122
  response = self._client._prepared_request(request)
168
123
  print(f"Endpoint ID: {response['id']}. Endpoint available at https://www.uiform.com/dashboard/processors/{response['id']}")
169
124
  return Endpoint.model_validate(response)
@@ -210,16 +165,11 @@ class Endpoints(SyncAPIResource, EndpointsMixin):
210
165
  def update(
211
166
  self,
212
167
  endpoint_id: str,
213
- name: Optional[str] = None,
214
- webhook_url: Optional[HttpUrl] = None,
215
- webhook_headers: Optional[Dict[str, str]] = None,
216
- json_schema: Optional[Dict[str, Any]] = None,
217
- image_resolution_dpi: Optional[int] = None,
218
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
219
- modality: Optional[Modality] = None,
220
- model: Optional[str] = None,
221
- temperature: Optional[float] = None,
222
- reasoning_effort: Optional[ChatCompletionReasoningEffort] = None,
168
+ name: str = PydanticUndefined, # type: ignore[assignment]
169
+ default_language: str = PydanticUndefined, # type: ignore[assignment]
170
+ webhook_url: str = PydanticUndefined, # type: ignore[assignment]
171
+ webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
172
+ need_validation: bool = PydanticUndefined, # type: ignore[assignment]
223
173
  ) -> Endpoint:
224
174
  """Update an endpoint configuration.
225
175
 
@@ -238,7 +188,14 @@ class Endpoints(SyncAPIResource, EndpointsMixin):
238
188
  Returns:
239
189
  Endpoint: The updated endpoint configuration
240
190
  """
241
- request = self.prepare_update(endpoint_id, name, webhook_url, webhook_headers, json_schema, image_resolution_dpi, browser_canvas, modality, model, temperature, reasoning_effort)
191
+ request = self.prepare_update(
192
+ endpoint_id=endpoint_id,
193
+ name=name,
194
+ default_language=default_language,
195
+ webhook_url=webhook_url,
196
+ webhook_headers=webhook_headers,
197
+ need_validation=need_validation,
198
+ )
242
199
  response = self._client._prepared_request(request)
243
200
  return Endpoint.model_validate(response)
244
201
 
@@ -258,22 +215,22 @@ class AsyncEndpoints(AsyncAPIResource, EndpointsMixin):
258
215
 
259
216
  async def create(
260
217
  self,
218
+ processor_id: str,
261
219
  name: str,
262
- webhook_url: HttpUrl,
263
- json_schema: Dict[str, Any],
264
- webhook_headers: Optional[Dict[str, str]] = None,
265
- # DocumentExtraction Config
266
- image_resolution_dpi: Optional[int] = None,
267
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
268
- modality: Modality = "native",
269
- model: str = "gpt-4o-mini",
270
- temperature: float = 0,
271
- reasoning_effort: ChatCompletionReasoningEffort = "medium",
220
+ webhook_url: str,
221
+ webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
222
+ need_validation: bool = PydanticUndefined, # type: ignore[assignment]
272
223
  ) -> Endpoint:
273
- request = self.prepare_create(name, webhook_url, json_schema, webhook_headers, image_resolution_dpi, browser_canvas, modality, model, temperature, reasoning_effort)
224
+ request = self.prepare_create(
225
+ processor_id=processor_id,
226
+ name=name,
227
+ webhook_url=webhook_url,
228
+ webhook_headers=webhook_headers,
229
+ need_validation=need_validation,
230
+ )
274
231
  response = await self._client._prepared_request(request)
275
232
  print(f"Endpoint ID: {response['id']}. Endpoint available at https://www.uiform.com/dashboard/processors/{response['id']}")
276
-
233
+
277
234
  return Endpoint.model_validate(response)
278
235
 
279
236
  async def list(
@@ -297,18 +254,20 @@ class AsyncEndpoints(AsyncAPIResource, EndpointsMixin):
297
254
  async def update(
298
255
  self,
299
256
  endpoint_id: str,
300
- name: Optional[str] = None,
301
- webhook_url: Optional[HttpUrl] = None,
302
- webhook_headers: Optional[Dict[str, str]] = None,
303
- json_schema: Optional[Dict[str, Any]] = None,
304
- image_resolution_dpi: Optional[int] = None,
305
- browser_canvas: Optional[Literal['A3', 'A4', 'A5']] = None,
306
- modality: Optional[Modality] = None,
307
- model: Optional[str] = None,
308
- temperature: Optional[float] = None,
309
- reasoning_effort: Optional[ChatCompletionReasoningEffort] = None,
257
+ name: str = PydanticUndefined, # type: ignore[assignment]
258
+ default_language: str = PydanticUndefined, # type: ignore[assignment]
259
+ webhook_url: str = PydanticUndefined, # type: ignore[assignment]
260
+ webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
261
+ need_validation: bool = PydanticUndefined, # type: ignore[assignment]
310
262
  ) -> Endpoint:
311
- request = self.prepare_update(endpoint_id, name, webhook_url, webhook_headers, json_schema, image_resolution_dpi, browser_canvas, modality, model, temperature, reasoning_effort)
263
+ request = self.prepare_update(
264
+ endpoint_id=endpoint_id,
265
+ name=name,
266
+ default_language=default_language,
267
+ webhook_url=webhook_url,
268
+ webhook_headers=webhook_headers,
269
+ need_validation=need_validation,
270
+ )
312
271
  response = await self._client._prepared_request(request)
313
272
  return Endpoint.model_validate(response)
314
273