retab 0.0.82__py3-none-any.whl → 0.0.84__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/resources/documents/client.py +8 -8
- retab/resources/edit/client.py +8 -8
- retab/resources/edit/templates/client.py +8 -8
- retab/types/documents/edit.py +1 -2
- retab/types/edit/templates.py +1 -1
- {retab-0.0.82.dist-info → retab-0.0.84.dist-info}/METADATA +1 -1
- {retab-0.0.82.dist-info → retab-0.0.84.dist-info}/RECORD +9 -9
- {retab-0.0.82.dist-info → retab-0.0.84.dist-info}/WHEEL +0 -0
- {retab-0.0.82.dist-info → retab-0.0.84.dist-info}/top_level.txt +0 -0
|
@@ -119,14 +119,14 @@ class BaseDocumentsMixin:
|
|
|
119
119
|
|
|
120
120
|
def _prepare_edit(
|
|
121
121
|
self,
|
|
122
|
-
|
|
122
|
+
instructions: str,
|
|
123
123
|
document: Path | str | IOBase | MIMEData | PIL.Image.Image | HttpUrl | None = None,
|
|
124
124
|
model: str = FieldUnset,
|
|
125
125
|
template_id: str | None = FieldUnset,
|
|
126
126
|
**extra_body: Any,
|
|
127
127
|
) -> PreparedRequest:
|
|
128
128
|
request_dict: dict[str, Any] = {
|
|
129
|
-
"
|
|
129
|
+
"instructions": instructions,
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
if document is not None:
|
|
@@ -598,7 +598,7 @@ class Documents(SyncAPIResource, BaseDocumentsMixin):
|
|
|
598
598
|
|
|
599
599
|
def edit(
|
|
600
600
|
self,
|
|
601
|
-
|
|
601
|
+
instructions: str,
|
|
602
602
|
document: Path | str | IOBase | MIMEData | PIL.Image.Image | HttpUrl | None = None,
|
|
603
603
|
model: str = FieldUnset,
|
|
604
604
|
template_id: str | None = FieldUnset,
|
|
@@ -616,7 +616,7 @@ class Documents(SyncAPIResource, BaseDocumentsMixin):
|
|
|
616
616
|
Either `document` OR `template_id` must be provided, but not both.
|
|
617
617
|
|
|
618
618
|
Args:
|
|
619
|
-
|
|
619
|
+
instructions: Instructions describing how to fill the form fields.
|
|
620
620
|
document: The document to edit. Can be a file path (Path or str), file-like object, MIMEData, PIL Image, or URL.
|
|
621
621
|
Mutually exclusive with template_id.
|
|
622
622
|
model: The LLM model to use for inference. Defaults to "retab-small".
|
|
@@ -632,7 +632,7 @@ class Documents(SyncAPIResource, BaseDocumentsMixin):
|
|
|
632
632
|
HTTPException: If the request fails.
|
|
633
633
|
"""
|
|
634
634
|
request = self._prepare_edit(
|
|
635
|
-
|
|
635
|
+
instructions=instructions,
|
|
636
636
|
document=document,
|
|
637
637
|
model=model,
|
|
638
638
|
template_id=template_id,
|
|
@@ -993,7 +993,7 @@ class AsyncDocuments(AsyncAPIResource, BaseDocumentsMixin):
|
|
|
993
993
|
|
|
994
994
|
async def edit(
|
|
995
995
|
self,
|
|
996
|
-
|
|
996
|
+
instructions: str,
|
|
997
997
|
document: Path | str | IOBase | MIMEData | PIL.Image.Image | HttpUrl | None = None,
|
|
998
998
|
model: str = FieldUnset,
|
|
999
999
|
template_id: str | None = FieldUnset,
|
|
@@ -1011,7 +1011,7 @@ class AsyncDocuments(AsyncAPIResource, BaseDocumentsMixin):
|
|
|
1011
1011
|
Either `document` OR `template_id` must be provided, but not both.
|
|
1012
1012
|
|
|
1013
1013
|
Args:
|
|
1014
|
-
|
|
1014
|
+
instructions: Instructions describing how to fill the form fields.
|
|
1015
1015
|
document: The document to edit. Can be a file path (Path or str), file-like object, MIMEData, PIL Image, or URL.
|
|
1016
1016
|
Mutually exclusive with template_id.
|
|
1017
1017
|
model: The LLM model to use for inference. Defaults to "gemini-2.5-pro".
|
|
@@ -1027,7 +1027,7 @@ class AsyncDocuments(AsyncAPIResource, BaseDocumentsMixin):
|
|
|
1027
1027
|
HTTPException: If the request fails.
|
|
1028
1028
|
"""
|
|
1029
1029
|
request = self._prepare_edit(
|
|
1030
|
-
|
|
1030
|
+
instructions=instructions,
|
|
1031
1031
|
document=document,
|
|
1032
1032
|
model=model,
|
|
1033
1033
|
template_id=template_id,
|
retab/resources/edit/client.py
CHANGED
|
@@ -25,14 +25,14 @@ class BaseEditMixin:
|
|
|
25
25
|
|
|
26
26
|
def _prepare_fill_document(
|
|
27
27
|
self,
|
|
28
|
-
|
|
28
|
+
instructions: str,
|
|
29
29
|
document: Path | str | IOBase | MIMEData | PIL.Image.Image | HttpUrl | None = None,
|
|
30
30
|
model: str = FieldUnset,
|
|
31
31
|
template_id: str | None = FieldUnset,
|
|
32
32
|
**extra_body: Any,
|
|
33
33
|
) -> PreparedRequest:
|
|
34
34
|
request_dict: dict[str, Any] = {
|
|
35
|
-
"
|
|
35
|
+
"instructions": instructions,
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
if document is not None:
|
|
@@ -65,7 +65,7 @@ class Edit(SyncAPIResource, BaseEditMixin):
|
|
|
65
65
|
|
|
66
66
|
def fill_document(
|
|
67
67
|
self,
|
|
68
|
-
|
|
68
|
+
instructions: str,
|
|
69
69
|
document: Path | str | IOBase | MIMEData | PIL.Image.Image | HttpUrl | None = None,
|
|
70
70
|
model: str = FieldUnset,
|
|
71
71
|
template_id: str | None = FieldUnset,
|
|
@@ -83,7 +83,7 @@ class Edit(SyncAPIResource, BaseEditMixin):
|
|
|
83
83
|
Either `document` OR `template_id` must be provided, but not both.
|
|
84
84
|
|
|
85
85
|
Args:
|
|
86
|
-
|
|
86
|
+
instructions: Instructions describing how to fill the form fields.
|
|
87
87
|
document: The document to edit. Can be a file path (Path or str), file-like object,
|
|
88
88
|
MIMEData, PIL Image, or URL. Mutually exclusive with template_id.
|
|
89
89
|
model: The LLM model to use for inference. Defaults to "retab-small".
|
|
@@ -106,7 +106,7 @@ class Edit(SyncAPIResource, BaseEditMixin):
|
|
|
106
106
|
- XLSX/XLS: Native editing for spreadsheets
|
|
107
107
|
"""
|
|
108
108
|
request = self._prepare_fill_document(
|
|
109
|
-
|
|
109
|
+
instructions=instructions,
|
|
110
110
|
document=document,
|
|
111
111
|
model=model,
|
|
112
112
|
template_id=template_id,
|
|
@@ -125,7 +125,7 @@ class AsyncEdit(AsyncAPIResource, BaseEditMixin):
|
|
|
125
125
|
|
|
126
126
|
async def fill_document(
|
|
127
127
|
self,
|
|
128
|
-
|
|
128
|
+
instructions: str,
|
|
129
129
|
document: Path | str | IOBase | MIMEData | PIL.Image.Image | HttpUrl | None = None,
|
|
130
130
|
model: str = FieldUnset,
|
|
131
131
|
template_id: str | None = FieldUnset,
|
|
@@ -143,7 +143,7 @@ class AsyncEdit(AsyncAPIResource, BaseEditMixin):
|
|
|
143
143
|
Either `document` OR `template_id` must be provided, but not both.
|
|
144
144
|
|
|
145
145
|
Args:
|
|
146
|
-
|
|
146
|
+
instructions: Instructions describing how to fill the form fields.
|
|
147
147
|
document: The document to edit. Can be a file path (Path or str), file-like object,
|
|
148
148
|
MIMEData, PIL Image, or URL. Mutually exclusive with template_id.
|
|
149
149
|
model: The LLM model to use for inference. Defaults to "retab-small".
|
|
@@ -166,7 +166,7 @@ class AsyncEdit(AsyncAPIResource, BaseEditMixin):
|
|
|
166
166
|
- XLSX/XLS: Native editing for spreadsheets
|
|
167
167
|
"""
|
|
168
168
|
request = self._prepare_fill_document(
|
|
169
|
-
|
|
169
|
+
instructions=instructions,
|
|
170
170
|
document=document,
|
|
171
171
|
model=model,
|
|
172
172
|
template_id=template_id,
|
|
@@ -161,13 +161,13 @@ class BaseTemplatesMixin:
|
|
|
161
161
|
def _prepare_fill(
|
|
162
162
|
self,
|
|
163
163
|
template_id: str,
|
|
164
|
-
|
|
164
|
+
instructions: str,
|
|
165
165
|
model: str = FieldUnset,
|
|
166
166
|
**extra_body: Any,
|
|
167
167
|
) -> PreparedRequest:
|
|
168
168
|
request_dict: dict[str, Any] = {
|
|
169
169
|
"template_id": template_id,
|
|
170
|
-
"
|
|
170
|
+
"instructions": instructions,
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
if model is not FieldUnset:
|
|
@@ -366,7 +366,7 @@ class Templates(SyncAPIResource, BaseTemplatesMixin):
|
|
|
366
366
|
def fill(
|
|
367
367
|
self,
|
|
368
368
|
template_id: str,
|
|
369
|
-
|
|
369
|
+
instructions: str,
|
|
370
370
|
model: str = FieldUnset,
|
|
371
371
|
**extra_body: Any,
|
|
372
372
|
) -> EditResponse:
|
|
@@ -378,7 +378,7 @@ class Templates(SyncAPIResource, BaseTemplatesMixin):
|
|
|
378
378
|
|
|
379
379
|
Args:
|
|
380
380
|
template_id: The template ID to use for filling
|
|
381
|
-
|
|
381
|
+
instructions: Instructions describing how to fill the form fields
|
|
382
382
|
model: The LLM model to use for inference (default: "retab-small")
|
|
383
383
|
|
|
384
384
|
Returns:
|
|
@@ -393,7 +393,7 @@ class Templates(SyncAPIResource, BaseTemplatesMixin):
|
|
|
393
393
|
"""
|
|
394
394
|
request = self._prepare_fill(
|
|
395
395
|
template_id=template_id,
|
|
396
|
-
|
|
396
|
+
instructions=instructions,
|
|
397
397
|
model=model,
|
|
398
398
|
**extra_body,
|
|
399
399
|
)
|
|
@@ -584,7 +584,7 @@ class AsyncTemplates(AsyncAPIResource, BaseTemplatesMixin):
|
|
|
584
584
|
async def fill(
|
|
585
585
|
self,
|
|
586
586
|
template_id: str,
|
|
587
|
-
|
|
587
|
+
instructions: str,
|
|
588
588
|
model: str = FieldUnset,
|
|
589
589
|
**extra_body: Any,
|
|
590
590
|
) -> EditResponse:
|
|
@@ -596,7 +596,7 @@ class AsyncTemplates(AsyncAPIResource, BaseTemplatesMixin):
|
|
|
596
596
|
|
|
597
597
|
Args:
|
|
598
598
|
template_id: The template ID to use for filling
|
|
599
|
-
|
|
599
|
+
instructions: Instructions describing how to fill the form fields
|
|
600
600
|
model: The LLM model to use for inference (default: "retab-small")
|
|
601
601
|
|
|
602
602
|
Returns:
|
|
@@ -611,7 +611,7 @@ class AsyncTemplates(AsyncAPIResource, BaseTemplatesMixin):
|
|
|
611
611
|
"""
|
|
612
612
|
request = self._prepare_fill(
|
|
613
613
|
template_id=template_id,
|
|
614
|
-
|
|
614
|
+
instructions=instructions,
|
|
615
615
|
model=model,
|
|
616
616
|
**extra_body,
|
|
617
617
|
)
|
retab/types/documents/edit.py
CHANGED
|
@@ -109,7 +109,6 @@ class InferFormSchemaRequest(BaseModel):
|
|
|
109
109
|
|
|
110
110
|
document: MIMEData = Field(..., description="Input document (PDF or DOCX). DOCX files will be converted to PDF.")
|
|
111
111
|
model: str = Field(default="retab-small", description="LLM model to use for inference")
|
|
112
|
-
instructions: Optional[str] = Field(default=None, description="Optional instructions to guide form field detection (e.g., which fields to focus on, specific areas to look for)")
|
|
113
112
|
|
|
114
113
|
|
|
115
114
|
class EditRequest(BaseModel):
|
|
@@ -121,7 +120,7 @@ class EditRequest(BaseModel):
|
|
|
121
120
|
"""
|
|
122
121
|
document: Optional[MIMEData] = Field(default=None, description="Input document (PDF or DOCX). DOCX files will be converted to PDF. Mutually exclusive with template_id.")
|
|
123
122
|
model: str = Field(default="retab-small", description="LLM model to use for inference")
|
|
124
|
-
|
|
123
|
+
instructions: str = Field(..., description="Instructions to fill the form")
|
|
125
124
|
template_id: Optional[str] = Field(default=None, description="Template ID to use for filling. When provided, uses the template's pre-defined form fields and empty PDF. Only works for PDF documents. Mutually exclusive with document.")
|
|
126
125
|
|
|
127
126
|
class EditResponse(BaseModel):
|
retab/types/edit/templates.py
CHANGED
|
@@ -46,5 +46,5 @@ class FillTemplateRequest(BaseModel):
|
|
|
46
46
|
Uses pre-defined form fields from the template (PDF only)
|
|
47
47
|
"""
|
|
48
48
|
model: str = Field(default="retab-small", description="LLM model to use for inference")
|
|
49
|
-
|
|
49
|
+
instructions: str = Field(..., description="Instructions to fill the form")
|
|
50
50
|
template_id: str = Field(..., description="Template ID to use for filling. When provided, uses the template's pre-defined form fields and empty PDF. Only works for PDF documents. Mutually exclusive with document.")
|
|
@@ -7,11 +7,11 @@ retab/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
7
7
|
retab/resources/models.py,sha256=4WidFBnTGZEA65DSn2pLP2SRnCVXkMTw7o_m8xVCFC4,2469
|
|
8
8
|
retab/resources/schemas.py,sha256=rZ6OzfmoYv-mGaRVzvXjO09dD-KxP74mZhOO8sMgcDQ,4632
|
|
9
9
|
retab/resources/documents/__init__.py,sha256=OjXmngFN0RKqO4SI-mJBNzr6Ex6rMxfq0DxaqzP0RQs,89
|
|
10
|
-
retab/resources/documents/client.py,sha256=
|
|
10
|
+
retab/resources/documents/client.py,sha256=0ZOJojT4M9QZ53nheS_vuNZWcnmwTnKx3YqYyJ7_sGY,48912
|
|
11
11
|
retab/resources/edit/__init__.py,sha256=yycIstpTSKsz2qXbrY3Buzd35UDcPWvb5hw6Eb2rLow,69
|
|
12
|
-
retab/resources/edit/client.py,sha256=
|
|
12
|
+
retab/resources/edit/client.py,sha256=osWvuKj2SNH6-nQKsWcTYcm3jVENGlwGTvDnT45nDBY,6649
|
|
13
13
|
retab/resources/edit/templates/__init__.py,sha256=n-zA_HXo7iGgeIclSwcsxmSueXJIRMo0iZjk_sax85I,90
|
|
14
|
-
retab/resources/edit/templates/client.py,sha256=
|
|
14
|
+
retab/resources/edit/templates/client.py,sha256=Eevzy5JaQmG5-hEshugQvrhgIBAjgZ8ZYZkpBSKEdBQ,19729
|
|
15
15
|
retab/resources/extractions/__init__.py,sha256=2H1ezUG8hI5SmTRy6NFzXdYLOdGFFsFrI60uzkitV20,97
|
|
16
16
|
retab/resources/extractions/client.py,sha256=sEoNjOgX91FTOgoJUV-I1A9A9xl1ciCdPlhYwjhEjbA,11035
|
|
17
17
|
retab/resources/projects/__init__.py,sha256=tPR3_3tr7bsoYd618qmGjnYN2R23PmF5oCFd7Z5_HGY,85
|
|
@@ -29,12 +29,12 @@ retab/types/documents/__init__.py,sha256=t1jXdpYqi-zQMC_9uM0m7eA1hRU0MCROwUx89cc
|
|
|
29
29
|
retab/types/documents/classify.py,sha256=Tb6d_7kuTlWLr7bPn782dHrjtUVBCvXV3o9zm7j2lmE,1128
|
|
30
30
|
retab/types/documents/correct_orientation.py,sha256=e-ivsslI6L6Gl0YkcslXw_DH620xMGEYVp4tdeviXeM,261
|
|
31
31
|
retab/types/documents/create_messages.py,sha256=Uym0SnVUGkyt1C5AOD37BsZ3puyeu_igR6X9SboojfA,7267
|
|
32
|
-
retab/types/documents/edit.py,sha256=
|
|
32
|
+
retab/types/documents/edit.py,sha256=YOsLE4nDf5XLrgkoAxKvU5pivfTSHSjrQSIm2Ezyfn8,5424
|
|
33
33
|
retab/types/documents/extract.py,sha256=x_59fm69-icsxxGRgpFd0NN-SLRoMYqbvfCZuG7zyGc,18033
|
|
34
34
|
retab/types/documents/parse.py,sha256=MXe7zh3DusWQhGe0Sr95nPy6cB8DRX8MA4Hmjj_AP7E,1300
|
|
35
35
|
retab/types/documents/split.py,sha256=xRdJ6IpSRAPi_ZtAG2FNqg5A-v5tzfb1QQkW5UfO2pY,1246
|
|
36
36
|
retab/types/edit/__init__.py,sha256=M8hF97h7fX8RP9IsB6qpkw0eyvO0DFQvP6FmWL8caCQ,331
|
|
37
|
-
retab/types/edit/templates.py,sha256=
|
|
37
|
+
retab/types/edit/templates.py,sha256=4ndnk-MlJE7roP_YktgxLpRSd68hdwNDWiqAFMy0Ddo,2291
|
|
38
38
|
retab/types/extractions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
39
|
retab/types/extractions/types.py,sha256=mnCYSfJoEKsXN2eG-PrahnnQyR6RDjP5VO9sHC1Opmg,102
|
|
40
40
|
retab/types/projects/__init__.py,sha256=I7P_dems5_LOLgYQ-4Bzt9B6P6jRlQwP-D_9GxRDhVk,155
|
|
@@ -55,7 +55,7 @@ retab/utils/hashing.py,sha256=_BMVUvftOcJav68QL0rLkH2dbhW9RRJPzeGC2akR0fc,757
|
|
|
55
55
|
retab/utils/json_schema.py,sha256=zP4pQLpVHBKWo_abCjb_dU4kA0azhHopd-1TFUgVEvc,20655
|
|
56
56
|
retab/utils/mime.py,sha256=mTP_lqSPttOP5DYJxopiWaeFXrUCPjhwd7y53nCVGO4,6189
|
|
57
57
|
retab/utils/stream_context_managers.py,sha256=gI1gVQSj3nWz6Mvjz7Ix5AiY0g6vSL-c2tPfuP04izo,2314
|
|
58
|
-
retab-0.0.
|
|
59
|
-
retab-0.0.
|
|
60
|
-
retab-0.0.
|
|
61
|
-
retab-0.0.
|
|
58
|
+
retab-0.0.84.dist-info/METADATA,sha256=8UeP_dWkqP9GOjbR1vpSGZwa9m528VEYNqkxLvbFrfE,4532
|
|
59
|
+
retab-0.0.84.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
60
|
+
retab-0.0.84.dist-info/top_level.txt,sha256=waQR0EGdhLIQtztoE3AXg7ik5ONQ9q_bsKVpyFuJdq0,6
|
|
61
|
+
retab-0.0.84.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|