retab 0.0.35__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 (111) hide show
  1. retab-0.0.35.dist-info/METADATA +417 -0
  2. retab-0.0.35.dist-info/RECORD +111 -0
  3. retab-0.0.35.dist-info/WHEEL +5 -0
  4. retab-0.0.35.dist-info/top_level.txt +1 -0
  5. uiform/__init__.py +4 -0
  6. uiform/_resource.py +28 -0
  7. uiform/_utils/__init__.py +0 -0
  8. uiform/_utils/ai_models.py +100 -0
  9. uiform/_utils/benchmarking copy.py +588 -0
  10. uiform/_utils/benchmarking.py +485 -0
  11. uiform/_utils/chat.py +332 -0
  12. uiform/_utils/display.py +443 -0
  13. uiform/_utils/json_schema.py +2161 -0
  14. uiform/_utils/mime.py +168 -0
  15. uiform/_utils/responses.py +163 -0
  16. uiform/_utils/stream_context_managers.py +52 -0
  17. uiform/_utils/usage/__init__.py +0 -0
  18. uiform/_utils/usage/usage.py +300 -0
  19. uiform/client.py +701 -0
  20. uiform/py.typed +0 -0
  21. uiform/resources/__init__.py +0 -0
  22. uiform/resources/consensus/__init__.py +3 -0
  23. uiform/resources/consensus/client.py +114 -0
  24. uiform/resources/consensus/completions.py +252 -0
  25. uiform/resources/consensus/completions_stream.py +278 -0
  26. uiform/resources/consensus/responses.py +325 -0
  27. uiform/resources/consensus/responses_stream.py +373 -0
  28. uiform/resources/deployments/__init__.py +9 -0
  29. uiform/resources/deployments/client.py +78 -0
  30. uiform/resources/deployments/endpoints.py +322 -0
  31. uiform/resources/deployments/links.py +452 -0
  32. uiform/resources/deployments/logs.py +211 -0
  33. uiform/resources/deployments/mailboxes.py +496 -0
  34. uiform/resources/deployments/outlook.py +531 -0
  35. uiform/resources/deployments/tests.py +158 -0
  36. uiform/resources/documents/__init__.py +3 -0
  37. uiform/resources/documents/client.py +255 -0
  38. uiform/resources/documents/extractions.py +441 -0
  39. uiform/resources/evals.py +812 -0
  40. uiform/resources/files.py +24 -0
  41. uiform/resources/finetuning.py +62 -0
  42. uiform/resources/jsonlUtils.py +1046 -0
  43. uiform/resources/models.py +45 -0
  44. uiform/resources/openai_example.py +22 -0
  45. uiform/resources/processors/__init__.py +3 -0
  46. uiform/resources/processors/automations/__init__.py +9 -0
  47. uiform/resources/processors/automations/client.py +78 -0
  48. uiform/resources/processors/automations/endpoints.py +317 -0
  49. uiform/resources/processors/automations/links.py +356 -0
  50. uiform/resources/processors/automations/logs.py +211 -0
  51. uiform/resources/processors/automations/mailboxes.py +435 -0
  52. uiform/resources/processors/automations/outlook.py +444 -0
  53. uiform/resources/processors/automations/tests.py +158 -0
  54. uiform/resources/processors/client.py +474 -0
  55. uiform/resources/prompt_optimization.py +76 -0
  56. uiform/resources/schemas.py +369 -0
  57. uiform/resources/secrets/__init__.py +9 -0
  58. uiform/resources/secrets/client.py +20 -0
  59. uiform/resources/secrets/external_api_keys.py +109 -0
  60. uiform/resources/secrets/webhook.py +62 -0
  61. uiform/resources/usage.py +271 -0
  62. uiform/types/__init__.py +0 -0
  63. uiform/types/ai_models.py +645 -0
  64. uiform/types/automations/__init__.py +0 -0
  65. uiform/types/automations/cron.py +58 -0
  66. uiform/types/automations/endpoints.py +21 -0
  67. uiform/types/automations/links.py +28 -0
  68. uiform/types/automations/mailboxes.py +60 -0
  69. uiform/types/automations/outlook.py +68 -0
  70. uiform/types/automations/webhooks.py +21 -0
  71. uiform/types/chat.py +8 -0
  72. uiform/types/completions.py +93 -0
  73. uiform/types/consensus.py +10 -0
  74. uiform/types/db/__init__.py +0 -0
  75. uiform/types/db/annotations.py +24 -0
  76. uiform/types/db/files.py +36 -0
  77. uiform/types/deployments/__init__.py +0 -0
  78. uiform/types/deployments/cron.py +59 -0
  79. uiform/types/deployments/endpoints.py +28 -0
  80. uiform/types/deployments/links.py +36 -0
  81. uiform/types/deployments/mailboxes.py +67 -0
  82. uiform/types/deployments/outlook.py +76 -0
  83. uiform/types/deployments/webhooks.py +21 -0
  84. uiform/types/documents/__init__.py +0 -0
  85. uiform/types/documents/correct_orientation.py +13 -0
  86. uiform/types/documents/create_messages.py +226 -0
  87. uiform/types/documents/extractions.py +297 -0
  88. uiform/types/evals.py +207 -0
  89. uiform/types/events.py +76 -0
  90. uiform/types/extractions.py +85 -0
  91. uiform/types/jobs/__init__.py +0 -0
  92. uiform/types/jobs/base.py +150 -0
  93. uiform/types/jobs/batch_annotation.py +22 -0
  94. uiform/types/jobs/evaluation.py +133 -0
  95. uiform/types/jobs/finetune.py +6 -0
  96. uiform/types/jobs/prompt_optimization.py +41 -0
  97. uiform/types/jobs/webcrawl.py +6 -0
  98. uiform/types/logs.py +231 -0
  99. uiform/types/mime.py +257 -0
  100. uiform/types/modalities.py +68 -0
  101. uiform/types/pagination.py +6 -0
  102. uiform/types/schemas/__init__.py +0 -0
  103. uiform/types/schemas/enhance.py +53 -0
  104. uiform/types/schemas/evaluate.py +55 -0
  105. uiform/types/schemas/generate.py +32 -0
  106. uiform/types/schemas/layout.py +58 -0
  107. uiform/types/schemas/object.py +631 -0
  108. uiform/types/schemas/templates.py +107 -0
  109. uiform/types/secrets/__init__.py +0 -0
  110. uiform/types/secrets/external_api_keys.py +22 -0
  111. uiform/types/standards.py +39 -0
@@ -0,0 +1,417 @@
1
+ Metadata-Version: 2.1
2
+ Name: retab
3
+ Version: 0.0.35
4
+ Summary: UiForm official python library
5
+ Home-page: https://github.com/UiForm/uiform
6
+ Author: UiForm
7
+ Author-email: contact@uiform.com
8
+ Project-URL: Team website, https://uiform.com
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: POSIX :: Linux
12
+ Classifier: Operating System :: MacOS
13
+ Classifier: Intended Audience :: Science/Research
14
+ Requires-Python: >=3.6
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: Pillow
17
+ Requires-Dist: httpx
18
+ Requires-Dist: pydantic
19
+ Requires-Dist: pydantic-core
20
+ Requires-Dist: requests
21
+ Requires-Dist: tqdm
22
+ Requires-Dist: types-tqdm
23
+ Requires-Dist: backoff
24
+ Requires-Dist: termplotlib
25
+ Requires-Dist: Levenshtein
26
+ Requires-Dist: pandas
27
+ Requires-Dist: numpy
28
+ Requires-Dist: motor
29
+ Requires-Dist: rich
30
+ Requires-Dist: puremagic
31
+ Requires-Dist: pycountry
32
+ Requires-Dist: phonenumbers
33
+ Requires-Dist: email-validator
34
+ Requires-Dist: python-stdnum
35
+ Requires-Dist: nanoid
36
+ Requires-Dist: openai
37
+ Requires-Dist: google-genai
38
+ Requires-Dist: google-generativeai
39
+ Requires-Dist: anthropic
40
+ Requires-Dist: tiktoken
41
+ Requires-Dist: truststore
42
+
43
+ # UiForm
44
+
45
+ <div align="center" style="margin-bottom: 1em;">
46
+
47
+ <img src="https://raw.githubusercontent.com/UiForm/uiform/refs/heads/main/assets/uiform-logo.png" alt="UiForm Logo" width="150">
48
+
49
+
50
+ *The AI Automation Platform*
51
+
52
+ Made with love by the team at [UiForm](https://uiform.com) 🤍.
53
+
54
+ [Our Website](https://uiform.com) | [Documentation](https://docs.uiform.com/get-started/introduction) | [Discord](https://discord.com/invite/vc5tWRPqag) | [Twitter](https://x.com/uiformAPI)
55
+
56
+
57
+ </div>
58
+
59
+ ---
60
+
61
+ ## How It Works
62
+
63
+ UiForm allows you to easily create document processing automations. Here is the general workflow:
64
+
65
+ ```mermaid
66
+ sequenceDiagram
67
+ User ->> UiForm: File Upload
68
+ UiForm -->> UiForm: Preprocessing
69
+ UiForm ->> AI Provider: Request on your behalf
70
+ AI Provider -->> UiForm: Structured Generation
71
+ UiForm ->> Webhook: Send result
72
+ UiForm ->> User: Send Confirmation
73
+ ```
74
+
75
+ ---
76
+
77
+ ## General philosophy
78
+
79
+ Many people haven't yet realized how powerful LLMs have become at document processing tasks - **we're here to help you unlock these capabilities**.
80
+
81
+ Our mission can be described as follows:
82
+
83
+ - **Smarter Document Processing**
84
+ > Convert any file type (PDFs, Excel, emails, etc.) into LLM-ready format without touching any line of code.
85
+
86
+ - **Scalable Workflow Automation**
87
+ > Create custom automation loops to process documents at scale.
88
+
89
+ - **Model Efficiency & Cost Optimization**
90
+ > Get consistent, reliable outputs using schema-based prompt engineering to reduce costs and improve performance.
91
+
92
+ You come with your own API key from your favorite AI provider, and we handle the rest in an **easy** and **transparent** way.
93
+
94
+ We currently support [OpenAI](https://platform.openai.com/docs/overview), [Anthropic](https://www.anthropic.com/api), [Gemini](https://aistudio.google.com/prompts/new_chat) and [xAI](https://x.ai/api) models.
95
+
96
+ <p align="center">
97
+ <img src="https://raw.githubusercontent.com/UiForm/uiform/refs/heads/main/assets/supported_models.png" alt="Supported Models" width="600">
98
+ </p>
99
+
100
+ ---
101
+
102
+ ## Quickstart
103
+
104
+ Explore our [Playground](https://www.uiform.com/dashboard/playground) and create your first automations easily 🚀!
105
+
106
+ <p align="center">
107
+ <img src="https://raw.githubusercontent.com/UiForm/uiform/refs/heads/main/assets/uiform-playground.png" alt="UiForm Playground" width="600">
108
+ </p>
109
+
110
+ ---
111
+
112
+ ---
113
+
114
+ ## Dev Mode 🔧
115
+
116
+ You need more control? You can access the [Documentation](https://docs.uiform.com/get-started/introduction) of our **Python SDK**.
117
+
118
+ 1. **Setup the Python SDK**
119
+ > Install the UiForm Python SDK and configure your API keys to start processing documents with your preferred AI provider.
120
+
121
+ 2. **Create your JSON schema**
122
+ > Define the structure of the data you want to extract from your documents using our schema format with custom prompting capabilities.
123
+
124
+ 3. **Create your FastAPI server with a webhook**
125
+ > Set up an endpoint that will receive the structured data extracted from your documents after processing.
126
+
127
+ 4. **Create your automation**
128
+ > Configure an automation (mailbox or link) that will automatically process incoming documents using your schema and send results to your webhook.
129
+
130
+ 5. **Test your automation**
131
+ > Validate your setup by sending test documents through your automation and verify the extracted data matches your requirements.
132
+
133
+ ### Step 1: Setup of the Python SDK
134
+
135
+ To get started, install the `uiform` package using pip:
136
+
137
+ ```bash
138
+ pip install uiform
139
+ ```
140
+
141
+ Then, [create your API key on uiform.com](https://www.uiform.com).
142
+
143
+ Create another API key by you favorite API key provider.
144
+
145
+ **Reminder**: We currently support [OpenAI](https://platform.openai.com/docs/overview), [Anthropic](https://www.anthropic.com/api), [Gemini](https://aistudio.google.com/prompts/new_chat) and [xAI](https://x.ai/api) models.
146
+
147
+ As we will use your API key to make requests to OpenAI on your behalf within an automation, you need to store your API key in the UiForm secrets manager:
148
+
149
+ ```
150
+ OPENAI_API_KEY=sk-xxxxxxxxx
151
+ UIFORM_API_KEY=sk_uiform_xxxxxxxxx
152
+ ```
153
+
154
+ ```bash
155
+ import uiform
156
+ import os
157
+
158
+ uiclient = uiform.UiForm()
159
+
160
+ uiclient.secrets.external_api_keys.create(
161
+ provider="OpenAI",
162
+ api_key=os.getenv("OPENAI_API_KEY")
163
+ )
164
+ ```
165
+
166
+ #### Process your first document with the create_messages method:
167
+
168
+ ```bash
169
+ from uiform import UiForm
170
+ from openai import OpenAI
171
+
172
+ # Initialize UiForm client
173
+ uiclient = UiForm()
174
+
175
+ # Convert any document into LLM-ready format
176
+ doc_msg = uiclient.documents.create_messages(
177
+ document = "invoice.pdf" # Works with PDFs, Excel, emails, etc.
178
+ )
179
+
180
+ client = OpenAI()
181
+ completion = client.chat.completions.create(
182
+ model="gpt-4.1-nano",
183
+ messages=doc_msg.openai_messages + [
184
+ {
185
+ "role": "user",
186
+ "content": "Summarize the document"
187
+ }
188
+ ]
189
+ )
190
+ ```
191
+
192
+ ### Step 2: Create your JSON Schema
193
+
194
+ We use a standard JSON Schema with custom annotations (`X-SystemPrompt`, `X-FieldPrompt`, and `X-ReasoningPrompt`) as a prompt-engineering framework for the extraction process.
195
+
196
+ These annotations help guide the LLM’s behavior and improve extraction accuracy.
197
+
198
+ You can learn more about these in our [JSON Schema documentation](https://docs.uiform.com/get-started/prompting-with-the-JSON-schema).
199
+
200
+ ```bash
201
+ from uiform import UiForm
202
+ from openai import OpenAI
203
+ from pydantic import BaseModel, Field, ConfigDict
204
+
205
+ # Define your extraction schema
206
+ class Invoice(BaseModel):
207
+ model_config = ConfigDict(
208
+ json_schema_extra = {
209
+ "X-SystemPrompt": "You are an expert at analyzing invoice documents."
210
+ }
211
+ )
212
+
213
+ total_amount: float = Field(...,
214
+ description="The total invoice amount",
215
+ json_schema_extra={
216
+ "X-FieldPrompt": "Find the final total amount including taxes"
217
+ }
218
+ )
219
+ date: str = Field(...,
220
+ description="Invoice date in YYYY-MM-DD format",
221
+ json_schema_extra={
222
+ "X-ReasoningPrompt": "Look for dates labeled as 'Invoice Date', 'Date', etc."
223
+ }
224
+ )
225
+
226
+ # Process document and extract data
227
+ uiclient = UiForm()
228
+ doc_msg = uiclient.documents.create_messages(
229
+ document = "invoice.pdf"
230
+ )
231
+ schema_obj = uiclient.schemas.load(
232
+ pydantic_model = Invoice
233
+ )
234
+
235
+ # Extract structured data with any LLM
236
+ client = OpenAI()
237
+ completion = client.beta.chat.completions.parse(
238
+ model="gpt-4o",
239
+ messages=schema_obj.openai_messages + doc_msg.openai_messages,
240
+ response_format=schema_obj.inference_pydantic_model
241
+ )
242
+
243
+ print("Extracted data:", completion.choices[0].message.parsed)
244
+
245
+ # Validate the response against the original schema if you want to remove the reasoning fields
246
+ from uiform._utils.json_schema import filter_auxiliary_fields_json
247
+ assert completion.choices[0].message.content is not None
248
+ extraction = schema_obj.pydantic_model.model_validate(
249
+ filter_auxiliary_fields_json(completion.choices[0].message.content, schema_obj.pydantic_model)
250
+ )
251
+
252
+ print("Extracted data without the reasoning fields:", extraction)
253
+ ```
254
+
255
+ ### Step 3: Create your FastAPI server with a webhook
256
+
257
+ Next, set up a FastAPI route that will handle incoming webhook POST requests.
258
+
259
+ Below is an example of a simple FastAPI application with a webhook endpoint:
260
+
261
+ ```bash
262
+ from fastapi import FastAPI, Request
263
+ from fastapi.responses import JSONResponse
264
+ from uiform.types.automations.webhooks import WebhookRequest
265
+ from pydantic import BaseModel, Field, ConfigDict
266
+
267
+ app = FastAPI()
268
+
269
+ @app.post("/webhook")
270
+ async def webhook(request: WebhookRequest):
271
+ invoice_object = request.completion.choices[0].message.parsed # The parsed object is the same Invoice object as the one you defined in the Pydantic model
272
+ print("Received payload:", invoice_object)
273
+ return JSONResponse(content={"status": "success", "data": invoice_object})
274
+
275
+ # To run the FastAPI app locally, use the command:
276
+ # uvicorn your_module_name:app --reload
277
+ if __name__ == "__main__":
278
+ import uvicorn
279
+ uvicorn.run(app, host="0.0.0.0", port=8000)
280
+ ```
281
+
282
+ You can test the webhook endpoint locally with a tool like curl or Postman - for example, using curl:
283
+
284
+ ```bash
285
+ curl -X POST "http://localhost:8000/webhook" \
286
+ -H "Content-Type: application/json" \
287
+ -d '{"name": "Team Meeting", "date": "2023-12-31"}'
288
+ ```
289
+
290
+ > ⚠️ **To continue**, you need to deploy your FastAPI app to a server to make your webhook endpoint publicly accessible.
291
+ > We recommend using [Replit](https://replit.com) to get started quickly if you don’t have a server yet.
292
+
293
+ ### Step 4: Create your automation
294
+
295
+ Finally, integrate the webhook with your automation system using the `uiform` client.
296
+
297
+ This example demonstrates how to create an automation that triggers the webhook when a matching event occurs:
298
+
299
+ ```bash
300
+ from uiform import UiForm
301
+
302
+ # Initialize the UiForm client
303
+ uiclient = UiForm()
304
+
305
+ # Create an automation that uses the webhook URL from Step 2
306
+ automation = uiclient.processors.automations.mailboxes.create(
307
+ email="invoices@mailbox.uiform.com",
308
+ model="gpt-4.1-nano",
309
+ json_schema=Invoice.model_json_schema(), # use the pydantic model to create the json schema
310
+ webhook_url="https://your-server.com/webhook", # Replace with your actual webhook URL
311
+ )
312
+ ```
313
+
314
+ At any email sent to `invoices@mailbox.uiform.com`, the automation will send a POST request to your FastAPI webhook endpoint, where the payload can be processed.
315
+
316
+ You can see the automation you just created on your [dashboard](https://www.uiform.com/dashboard/processors)!
317
+
318
+ ### Step 5: Test your automation
319
+
320
+ Finally, you can test the automation rapidly with the test functions of the sdk:
321
+
322
+ ```bash
323
+ from uiform import UiForm
324
+
325
+ # Initialize the UiForm client
326
+ uiclient = UiForm()
327
+
328
+ # If you just want to send a test request to your webhook
329
+ log = uiclient.processors.automations.mailboxes.tests.webhook(
330
+ email="test-mailbox-local@devmail.uiform.com",
331
+ )
332
+
333
+ # If you want to test the file processing logic:
334
+ log = uiclient.processors.automations.mailboxes.tests.process(
335
+ email="test-mailbox-local@devmail.uiform.com",
336
+ document="your_invoice_email.eml"
337
+ )
338
+
339
+ # If you want to test a full email forwarding
340
+ log = uiclient.processors.automations.mailboxes.tests.forward(
341
+ email="uiform-quickstart@mailbox.uiform.com",
342
+ document="your_invoice_email.eml"
343
+ )
344
+ ```
345
+
346
+ > 💡 **Tip:** You can also test your webhook locally by overriding the webhook URL set in the automation.
347
+
348
+ ```bash
349
+ from uiform import UiForm
350
+
351
+ uiclient = UiForm()
352
+
353
+ # If you just want to send a test request to your webhook
354
+ log = uiclient.processors.automations.mailboxes.tests.webhook(
355
+ email="test-mailbox-local@devmail.uiform.com",
356
+ webhook_url="http://localhost:8000/webhook" # If you want to try your webhook locally, you can override the webhook url set in the automation
357
+ )
358
+ ```
359
+
360
+ And that's it! You can start processing documents at scale!
361
+ You have 1000 free requests to get started, and you can [subscribe](https://www.uiform.com) to the pro plan to get more.
362
+
363
+ But this minimalistic example is just the beginning.
364
+
365
+ Continue reading to learn more about how to use UiForm **to its full potential** 🔥.
366
+
367
+ ---
368
+
369
+ ## Go further
370
+
371
+ - [Prompt Engineering Guide](https://docs.uiform.com/get-started/prompting-with-the-json-schema)
372
+ - [General Concepts](https://docs.uiform.com/get-started/General-Concepts)
373
+ - [Consensus](https://docs.uiform.com/SDK/General-Concepts#consensus)
374
+ - [Create mailboxes](https://docs.uiform.com/SDK/Automations#mailbox)
375
+ - [Create links](https://docs.uiform.com/SDK/Automations#link)
376
+ - Finetuning (coming soon)
377
+ - Prompt optimization (coming soon)
378
+ - Data-Labelling with our AI-powered annotator (coming soon)
379
+
380
+ ---
381
+
382
+ ## Jupyter Notebooks
383
+
384
+ You can view minimal notebooks that demonstrate how to use UiForm to process documents:
385
+
386
+ - [Mailbox creation quickstart](https://github.com/UiForm/uiform/blob/main/notebooks/mailboxes_quickstart.ipynb)
387
+ - [Upload Links creation quickstart](https://github.com/UiForm/uiform/blob/main/notebooks/links_quickstart.ipynb)
388
+ - [Document Extractions quickstart](https://github.com/UiForm/uiform/blob/main/notebooks/Quickstart.ipynb)
389
+ - [Document Extractions quickstart - Async](https://github.com/UiForm/uiform/blob/main/notebooks/Quickstart-Async.ipynb)
390
+
391
+ ---
392
+
393
+ ## Community
394
+
395
+ Let's create the future of document processing together!
396
+
397
+ Join our [discord community](https://discord.com/invite/vc5tWRPqag) to share tips, discuss best practices, and showcase what you build. Or just [tweet](https://x.com/uiformAPI) at us.
398
+
399
+ We can't wait to see how you'll use UiForm.
400
+
401
+ - [Discord](https://discord.com/invite/vc5tWRPqag)
402
+ - [Twitter](https://x.com/uiformAPI)
403
+
404
+
405
+ ## Roadmap
406
+
407
+ We publicly share our Roadmap with the community.
408
+
409
+ Please open an issue or [contact us on X](https://x.com/sachaicb) if you have suggestions or ideas.
410
+
411
+ - [ ] node client with ZOD
412
+ - [ ] Make a json-schema zoo
413
+ - [ ] Offer tools to display tokens usage to our users
414
+ - [ ] Launch the data-labelling API (Dataset Upload / Creation / Management / Labelling / Distillation)
415
+ - [ ] Launch the data-labelling platform: A web app based on the data-labelling API with a nice UI
416
+ - [ ] Launch the prompt-optimisation sdk
417
+ - [ ] Launch the finetuning sdk
@@ -0,0 +1,111 @@
1
+ uiform/__init__.py,sha256=ojlcab4e684LddcAO8k-i2thE_3jtgZIeGvGZg_pxSE,128
2
+ uiform/_resource.py,sha256=qixWTeG8JEFU7ZyQdntZq9Z88L5clTMZOL3-fIAxk3o,583
3
+ uiform/client.py,sha256=G1yqNMPnGfns8OJLdbt1Grki-XROydQ5JQjwKlA3AE4,29927
4
+ uiform/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ uiform/_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ uiform/_utils/ai_models.py,sha256=5HQW4Jv5kUEbXw5cGR8Q9NOO11dDyIJTwxcGsu_Ti5w,3845
7
+ uiform/_utils/benchmarking copy.py,sha256=NiJ7gbgbaLzcjocHAeMTGuwktdhEu2VERFO4Adb2vQE,25406
8
+ uiform/_utils/benchmarking.py,sha256=bvDXT7kvPfquJURhOitH-X12DoYDpbKCy-DE47m-kF4,17745
9
+ uiform/_utils/chat.py,sha256=QPpPnEAkW1qAAeU2HnLXwompjEmuGNLF-393J9HKjxo,14610
10
+ uiform/_utils/display.py,sha256=zEOn9o3OB3murEGBXGZQOpHgvoQuwEACw0ASiPdajks,18875
11
+ uiform/_utils/json_schema.py,sha256=xXEKCbkgmwwPzmO9nSyAw89WE6vuqdKDnm0r5FxZneE,82263
12
+ uiform/_utils/mime.py,sha256=N8HFN07YdKp542pB1aJ-9VzF7EoOSKGY0K8TTFUWV2U,5774
13
+ uiform/_utils/responses.py,sha256=qQCKzxxCGNx8HeGTvJbhmIHpuTNAe80sB802klCaLMA,6813
14
+ uiform/_utils/stream_context_managers.py,sha256=54rVaPp0Vslh3Z1G7Dg_-uDQd4x7XpmaTQ7X4cLwEYY,2314
15
+ uiform/_utils/usage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ uiform/_utils/usage/usage.py,sha256=MQdgyZCJ5eXSvnuVyq99QMXLPGROnofk8OYG3fZdl9A,13023
17
+ uiform/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ uiform/resources/evals.py,sha256=5lzWawaLozeBeBfCp4uu5Buzz2Ppwx23eUaD-n-q5Y4,29967
19
+ uiform/resources/files.py,sha256=2EH8NuOHnB9qIW604ju956fNOZRkBkXfWNc8zApuPXo,954
20
+ uiform/resources/finetuning.py,sha256=Rx8XcqB00UIjEDZcCGp5fM2yz5TW1j36aBicrTa0uAY,2587
21
+ uiform/resources/jsonlUtils.py,sha256=ZdjOnDDblVxonoSzFTlqxU148DJjUDshss-iB8gDnxA,44530
22
+ uiform/resources/models.py,sha256=Hn2g1FFriDnpTGMV2RA0AliJy1A0DHSBweJwi9-JuYE,1213
23
+ uiform/resources/openai_example.py,sha256=yz34KvfCvHTZ-AJ9GV-N7ljTTSWBmQEQNMHY2FUbEi4,522
24
+ uiform/resources/prompt_optimization.py,sha256=BJkE7L1w0Z88sR9c1evD8ti4Zqr_xHCFSK4OJmV_M0k,3489
25
+ uiform/resources/schemas.py,sha256=nw3WfOFSegLCwskzdv12CJqgrWgMpUHZkrzE0X69O8I,16024
26
+ uiform/resources/usage.py,sha256=Rnm8FZloEq8ipf9LEMKJjCw2lgF-akSYOoNsVpt6EVw,12212
27
+ uiform/resources/consensus/__init__.py,sha256=0b3MSOFiYPwkNTrs_dBPRhwSl3kuk8BtG5QXofIUb9M,89
28
+ uiform/resources/consensus/client.py,sha256=WajRr4WtU6Dfo6UREZvMUQI5nadckGFVRTUVujL_e-w,4011
29
+ uiform/resources/consensus/completions.py,sha256=AFjRfoA8ubaD-8VLpf1EW7kogRde4l7p3v_E-CZm1xY,9076
30
+ uiform/resources/consensus/completions_stream.py,sha256=RUtfpGlxoIcyqup9Xz54OLca5cGJOBQKClg83ulWna4,11174
31
+ uiform/resources/consensus/responses.py,sha256=gqrRA2cTSRSdMWOhMYu9RJoSYEXL45Z_7KHxGQXHkPI,12006
32
+ uiform/resources/consensus/responses_stream.py,sha256=o373nrVY2vetxQXcqJoAiDqWYPr4sqsGSkMoht9hrXs,13653
33
+ uiform/resources/deployments/__init__.py,sha256=OVgAPOTjQ5Ao4LgkdkHTMpNN_EIH0a_FjZIYy7swQng,121
34
+ uiform/resources/deployments/client.py,sha256=98G-bediZYMq16xlInFb4rjTgT4QYDn89Wy93dzEDuY,2675
35
+ uiform/resources/deployments/endpoints.py,sha256=v5Xi_9Do9bsPeMP6xoxjJHydt9BrmPvCQRZC-aFFpec,13002
36
+ uiform/resources/deployments/links.py,sha256=bgOZvjVxZmGTWXLNxKhQtYSnJvaijZKMfAxQuBE64bU,18223
37
+ uiform/resources/deployments/logs.py,sha256=PsgrdjLUITkRDQLuTqFTleVyRGfxSFvgED_V_b5Qeu8,8003
38
+ uiform/resources/deployments/mailboxes.py,sha256=bkPFaUQ2LWUa23xtKR8NlGzkBuiGWXSkMxDyPAnV5w0,20084
39
+ uiform/resources/deployments/outlook.py,sha256=ZglnPgtPfD64qgOf18aMe6zrbULxuFIM16Yn22k0sPc,20887
40
+ uiform/resources/deployments/tests.py,sha256=bMvQD_oXaMTCX2ZSLoxvDR27I166-7SOVLx-zyq8FUE,6028
41
+ uiform/resources/documents/__init__.py,sha256=OjXmngFN0RKqO4SI-mJBNzr6Ex6rMxfq0DxaqzP0RQs,89
42
+ uiform/resources/documents/client.py,sha256=kDEY1v-p7adzsK4Q0LJ2SnGf73D_D3CoO-njOfdb1Kg,11356
43
+ uiform/resources/documents/extractions.py,sha256=5_2C0BWBltkPsfgcLVDP9w55oU6gsVritIUnqt3ZDvM,20898
44
+ uiform/resources/processors/__init__.py,sha256=w1HrMdSi3xlrcEDFMQ9BA7rbUhOFWSTkTKkkR2PfFHQ,93
45
+ uiform/resources/processors/client.py,sha256=E5WDn29yF2JRfHSZ1pJY6dKIaHCoX0txVf1NBBuz2Kc,19200
46
+ uiform/resources/processors/automations/__init__.py,sha256=Iej-_yIxc8xAuhYmR0e2VI7j_EXVsNk1_L98OJSD82E,121
47
+ uiform/resources/processors/automations/client.py,sha256=hFsUilvXW7PDZZtBT1l5l0Ch2XxABpIaN5sVYE3gR6U,2676
48
+ uiform/resources/processors/automations/endpoints.py,sha256=6-cO0ZFfOF9STUsURLuSZhoTYkZSaTxtBvvY46fg9FQ,13070
49
+ uiform/resources/processors/automations/links.py,sha256=3YvDXSPpf8Usiu60tiaDgSrE_M9PCEReQgdfBJyJMTw,14379
50
+ uiform/resources/processors/automations/logs.py,sha256=mYfNjHN4on7mql0jsVO0NWsFIit_O6MIcuRWC1-WC0U,8119
51
+ uiform/resources/processors/automations/mailboxes.py,sha256=vBSglhT5OdA9VGt5bP78mEgYo01LjFX2UMPYts6FI-w,17524
52
+ uiform/resources/processors/automations/outlook.py,sha256=KiI9WqOhm8opeGI-YJsZAGAHhPJJjsua-25xktQ7NLw,17426
53
+ uiform/resources/processors/automations/tests.py,sha256=8q2mr5COxotKiNdiwV8dF5OQeRr1xOM7EUxbVR6FLlQ,6235
54
+ uiform/resources/secrets/__init__.py,sha256=SwofMyk96k0YSyj1d_GRxhpVx4wb4TA97TISsTjB0Kc,105
55
+ uiform/resources/secrets/client.py,sha256=nXt1cgvkWqhA99WTnC1PWbWJq-EbwvoDuCQOa0GJOOU,599
56
+ uiform/resources/secrets/external_api_keys.py,sha256=JaB1AuX72vhv7horDXHZq2Ibd9srsGeVZu8pSL09754,3837
57
+ uiform/resources/secrets/webhook.py,sha256=dY3yM7EXeuT37zuXnF8hz-fP8It-PU9m0aQ_epBatr0,1670
58
+ uiform/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
+ uiform/types/ai_models.py,sha256=kk3XxnqiIFhn0TLTB7XNhj968mW9SAn93u9ccK5icI4,27940
60
+ uiform/types/chat.py,sha256=am7KJI_I8d3vKVyk3hV3WrJCOc08ThL3jauS88ZYeTY,435
61
+ uiform/types/completions.py,sha256=ApeH75tnxre54pMsTW_qQNij5c4N-ihXal70wRUNeqY,5396
62
+ uiform/types/consensus.py,sha256=jcNwSbg_uzGqvHWbWFORoLAc-8hX2F8HIdySCpzFydM,390
63
+ uiform/types/evals.py,sha256=7QHuyxebms-9Iu_8iHd9XjNIeZRELWQ3NVRsDC7Gc1c,9728
64
+ uiform/types/events.py,sha256=szkvlKzmw6hcwqpz0DOKqweHd2JPiGURKSjaB5FCUbA,2145
65
+ uiform/types/extractions.py,sha256=ZrZHaw_sYRzUJ0HhiRrZ6Rv9kslOP9fKhC3RXbwOVu8,4677
66
+ uiform/types/logs.py,sha256=gV-Q9_L8fllYp3DeweZfOp4UGvwODhxnW7zvQpzP158,9258
67
+ uiform/types/mime.py,sha256=9Od0MKWYrW7DgG817ohtREfzh9ReXf01EovGaO8W_2g,10929
68
+ uiform/types/modalities.py,sha256=545ITBBA62t-qIaVKRQE3zxBv401jfn5I19gOtKIFP0,1581
69
+ uiform/types/pagination.py,sha256=-XrKILKX_5isTHTfShLiK3Kwp21Y6Wqy0Jci8lIFQig,109
70
+ uiform/types/standards.py,sha256=nBrMatmdINCezS3YwtK84Cg2RaHkoc18T43Z-YayJLg,1173
71
+ uiform/types/automations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
72
+ uiform/types/automations/cron.py,sha256=ZIdRAFXu7Fjdz-G59-2AqwcWH0pc5HA-uygCXOjal-I,3035
73
+ uiform/types/automations/endpoints.py,sha256=jO5awlqQvC1_AsYRuFLrnzwK3nSOQl-sZfrq8hMztlA,643
74
+ uiform/types/automations/links.py,sha256=mQBanQ32fWs6R_XvlbXZO3yHEElrOJCOjLKv8DBFIjc,856
75
+ uiform/types/automations/mailboxes.py,sha256=pZXnUtXY1GlIH57WbMa1zr3fAhvXC3cK0Zic9V_GWO8,2387
76
+ uiform/types/automations/outlook.py,sha256=a8aDqgs-7l2OfLj1hmNb0NdHjVEZgUoJTUELwmvL61w,3060
77
+ uiform/types/automations/webhooks.py,sha256=I_zaART2V_XrC3bzHO7wB0UlxNGLiblTltfue6BCgb0,563
78
+ uiform/types/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
+ uiform/types/db/annotations.py,sha256=Npy3IHwrCPl4NCxfNtiI1X3cKkLYA7BvkncBPuBLzxA,1034
80
+ uiform/types/db/files.py,sha256=bey3MeaoIuc_FklhQ8GBiluQV8IvGjK52BwmdfYqZhY,1191
81
+ uiform/types/deployments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
+ uiform/types/deployments/cron.py,sha256=DDlYNAAv8rXMnty_xHnMLZaVdWTgyJCBYxupQjm_X34,3065
83
+ uiform/types/deployments/endpoints.py,sha256=T6yoI8o6Qkc4Fe4R4leyH25uEpLvAABivw7aTtXoC-E,976
84
+ uiform/types/deployments/links.py,sha256=hRh7dkczCGZKUx2Hrh35XzBtLC2G9i-fz3tnBOeUYkg,1215
85
+ uiform/types/deployments/mailboxes.py,sha256=QU7KChIYB-Hr9-1hqxNHJyNVUJqU8h6dOuZQEO3YTJQ,2653
86
+ uiform/types/deployments/outlook.py,sha256=UENQs74_X7cB_2kpj6yL2e7hMHLIowaUx3UkJU1Vtew,3395
87
+ uiform/types/deployments/webhooks.py,sha256=I_zaART2V_XrC3bzHO7wB0UlxNGLiblTltfue6BCgb0,563
88
+ uiform/types/documents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
+ uiform/types/documents/correct_orientation.py,sha256=e-ivsslI6L6Gl0YkcslXw_DH620xMGEYVp4tdeviXeM,261
90
+ uiform/types/documents/create_messages.py,sha256=dazBa-H4OQQcNsuu0BuUlXb5dIaBYcR0bzyeLZQAnJ8,10439
91
+ uiform/types/documents/extractions.py,sha256=wUsej18gG8ssLln6o_Akcq2D10x7AGBC5dPsgAyRyWE,16339
92
+ uiform/types/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
93
+ uiform/types/jobs/base.py,sha256=48cXlGe7ewmME83a2GohdPn0F0PU3uJSZd0H9vFR1YY,5112
94
+ uiform/types/jobs/batch_annotation.py,sha256=wnW9alidnEjnmnxrcva2v8W9l9V5ld6PgRi5mBlSaY4,645
95
+ uiform/types/jobs/evaluation.py,sha256=4nR_jmqphRo7dCkWt99TKyOQlKugjkF01cy5_Gtk27E,4630
96
+ uiform/types/jobs/finetune.py,sha256=6O9NUy-ap_aqZ73tYx-NRRdFgKOIvk8WcItGhEUvrSQ,187
97
+ uiform/types/jobs/prompt_optimization.py,sha256=dCWPwqnxZX5QgMYvHSlIEWLUvSxbs6qlbqsLHNCTRdM,1307
98
+ uiform/types/jobs/webcrawl.py,sha256=C3_7mW2mmOXs6ypktDIHdjMnify90pFo70wmhrs_TP8,183
99
+ uiform/types/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
100
+ uiform/types/schemas/enhance.py,sha256=Dt37aB6YQWvNeDEh39DmENknZWxzI84RF325enpVu6c,2139
101
+ uiform/types/schemas/evaluate.py,sha256=XQKRrI4yy_SKpaccQrKzElUhFXVel2VEVOF-4ApyDjc,2182
102
+ uiform/types/schemas/generate.py,sha256=Q1Jm-1pUCiBhJYrmdSzNtOgiy81DdfoKmAJaiZm2yuE,1162
103
+ uiform/types/schemas/layout.py,sha256=JHBhL5s9sVGG7ZOUiQucgnA4zE0uW4UyLDve3K3bthw,1492
104
+ uiform/types/schemas/object.py,sha256=T25SvBfM6l6ekJz66yV8ISqJQjJMYGw1QW19cceEV90,25496
105
+ uiform/types/schemas/templates.py,sha256=xvfweRVGvW1Y9D42rJykqRZ_AXi_CJE_QnRusiDxgW4,3468
106
+ uiform/types/secrets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
107
+ uiform/types/secrets/external_api_keys.py,sha256=TYyyHAs7hl8ktQSEwcjtiUugZ0q-SZIXxYShM8NfjjA,459
108
+ retab-0.0.35.dist-info/METADATA,sha256=fcVljRz67OIaFchTb62S4vnJIdJnWX8uDHM8PtirW-c,14183
109
+ retab-0.0.35.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
110
+ retab-0.0.35.dist-info/top_level.txt,sha256=2_46xeTCMIhYaZjPkGg3BgX3idio6qXgF4Xt0LxlSgg,7
111
+ retab-0.0.35.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (72.2.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ uiform
uiform/__init__.py ADDED
@@ -0,0 +1,4 @@
1
+ from .client import AsyncUiForm, UiForm
2
+ from .types.schemas.object import Schema
3
+
4
+ __all__ = ["UiForm", "AsyncUiForm", "Schema"]
uiform/_resource.py ADDED
@@ -0,0 +1,28 @@
1
+ from __future__ import annotations
2
+
3
+ import asyncio
4
+ import time
5
+ from typing import TYPE_CHECKING
6
+
7
+ if TYPE_CHECKING:
8
+ from .client import AsyncUiForm, UiForm
9
+
10
+
11
+ class SyncAPIResource:
12
+ _client: UiForm
13
+
14
+ def __init__(self, client: UiForm) -> None:
15
+ self._client = client
16
+
17
+ def _sleep(self, seconds: float) -> None:
18
+ time.sleep(seconds)
19
+
20
+
21
+ class AsyncAPIResource:
22
+ _client: AsyncUiForm
23
+
24
+ def __init__(self, client: AsyncUiForm) -> None:
25
+ self._client = client
26
+
27
+ async def _sleep(self, seconds: float) -> None:
28
+ await asyncio.sleep(seconds)
File without changes
@@ -0,0 +1,100 @@
1
+ from typing import get_args
2
+
3
+ from ..types.ai_models import AIProvider, GeminiModel, OpenAIModel, xAI_Model
4
+
5
+
6
+ def find_provider_from_model(model: str) -> AIProvider:
7
+ if model in get_args(OpenAIModel):
8
+ return "OpenAI"
9
+ elif ":" in model:
10
+ # Handle fine-tuned models
11
+ ft, base_model, model_id = model.split(":", 2)
12
+ if base_model in get_args(OpenAIModel):
13
+ return "OpenAI"
14
+ # elif model in get_args(AnthropicModel):
15
+ # return "Anthropic"
16
+ elif model in get_args(xAI_Model):
17
+ return "xAI"
18
+ elif model in get_args(GeminiModel):
19
+ return "Gemini"
20
+ raise ValueError(f"Could not determine AI provider for model: {model}")
21
+
22
+
23
+ def assert_valid_model_extraction(model: str) -> None:
24
+ if model in get_args(OpenAIModel):
25
+ return
26
+ elif ":" in model:
27
+ # Handle fine-tuned models
28
+ ft, base_model, model_id = model.split(":", 2)
29
+ if base_model in get_args(OpenAIModel):
30
+ return
31
+ # elif model in get_args(AnthropicModel):
32
+ # return
33
+ elif model in get_args(xAI_Model):
34
+ return
35
+ elif model in get_args(GeminiModel):
36
+ return
37
+ raise ValueError(
38
+ f"Invalid model for extraction: {model}.\nValid OpenAI models: {get_args(OpenAIModel)}\n"
39
+ # f"Valid Anthropic models: {get_args(AnthropicModel)}\n"
40
+ # f"Valid xAI models: {get_args(xAI_Model)}\n"
41
+ # f"Valid Gemini models: {get_args(GeminiModel)}"
42
+ )
43
+
44
+
45
+ def assert_valid_model_batch_processing(model: str) -> None:
46
+ """Assert that the model is either a standard OpenAI model or a valid fine-tuned model.
47
+
48
+ Valid formats:
49
+ - Standard model: Must be in OpenAIModel
50
+ - Fine-tuned model: Must be {base_model}:{id} where base_model is in OpenAIModel
51
+
52
+ Raises:
53
+ ValueError: If the model format is invalid
54
+ """
55
+ if model in get_args(OpenAIModel):
56
+ return
57
+
58
+ try:
59
+ ft, base_model, model_id = model.split(":", 2)
60
+ if base_model not in get_args(OpenAIModel):
61
+ raise ValueError(f"Invalid base model in fine-tuned model '{model}'. Base model must be one of: {get_args(OpenAIModel)}")
62
+ if not model_id or not model_id.strip():
63
+ raise ValueError(f"Model ID cannot be empty in fine-tuned model '{model}'")
64
+ except ValueError as e:
65
+ if ":" not in model:
66
+ raise ValueError(
67
+ f"Invalid model format: {model}. Must be either:\n"
68
+ f"1. A standard model: {get_args(OpenAIModel)}\n"
69
+ f"2. A fine-tuned model in format 'base_model:id' where base_model is one of the standard models"
70
+ ) from None
71
+ raise
72
+
73
+
74
+ def assert_valid_model_schema_generation(model: str) -> None:
75
+ """Assert that the model is either a standard OpenAI model or a valid fine-tuned model.
76
+
77
+ Valid formats:
78
+ - Standard model: Must be in OpenAIModel
79
+ - Fine-tuned model: Must be {base_model}:{id} where base_model is in OpenAIModel
80
+
81
+ Raises:
82
+ ValueError: If the model format is invalid
83
+ """
84
+ if model in get_args(OpenAIModel):
85
+ return
86
+
87
+ try:
88
+ ft, base_model, model_id = model.split(":", 2)
89
+ if base_model not in get_args(OpenAIModel):
90
+ raise ValueError(f"Invalid base model in fine-tuned model '{model}'. Base model must be one of: {get_args(OpenAIModel)}")
91
+ if not model_id or not model_id.strip():
92
+ raise ValueError(f"Model ID cannot be empty in fine-tuned model '{model}'")
93
+ except ValueError as e:
94
+ if ":" not in model:
95
+ raise ValueError(
96
+ f"Invalid model format: {model}. Must be either:\n"
97
+ f"1. A standard model: {get_args(OpenAIModel)}\n"
98
+ f"2. A fine-tuned model in format 'base_model:id' where base_model is one of the standard models"
99
+ ) from None
100
+ raise