retab 0.0.84__tar.gz → 0.0.85__tar.gz

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 (70) hide show
  1. {retab-0.0.84 → retab-0.0.85}/PKG-INFO +1 -1
  2. retab-0.0.85/retab/resources/edit/agent/__init__.py +4 -0
  3. {retab-0.0.84/retab/resources/edit → retab-0.0.85/retab/resources/edit/agent}/client.py +21 -40
  4. retab-0.0.85/retab/resources/edit/client.py +41 -0
  5. {retab-0.0.84 → retab-0.0.85}/retab/types/documents/edit.py +2 -2
  6. {retab-0.0.84 → retab-0.0.85}/retab.egg-info/PKG-INFO +1 -1
  7. {retab-0.0.84 → retab-0.0.85}/retab.egg-info/SOURCES.txt +2 -0
  8. {retab-0.0.84 → retab-0.0.85}/setup.py +1 -1
  9. {retab-0.0.84 → retab-0.0.85}/README.md +0 -0
  10. {retab-0.0.84 → retab-0.0.85}/pyproject.toml +0 -0
  11. {retab-0.0.84 → retab-0.0.85}/retab/__init__.py +0 -0
  12. {retab-0.0.84 → retab-0.0.85}/retab/_resource.py +0 -0
  13. {retab-0.0.84 → retab-0.0.85}/retab/client.py +0 -0
  14. {retab-0.0.84 → retab-0.0.85}/retab/generate_types.py +0 -0
  15. {retab-0.0.84 → retab-0.0.85}/retab/py.typed +0 -0
  16. {retab-0.0.84 → retab-0.0.85}/retab/resources/__init__.py +0 -0
  17. {retab-0.0.84 → retab-0.0.85}/retab/resources/documents/__init__.py +0 -0
  18. {retab-0.0.84 → retab-0.0.85}/retab/resources/documents/client.py +0 -0
  19. {retab-0.0.84 → retab-0.0.85}/retab/resources/edit/__init__.py +0 -0
  20. {retab-0.0.84 → retab-0.0.85}/retab/resources/edit/templates/__init__.py +0 -0
  21. {retab-0.0.84 → retab-0.0.85}/retab/resources/edit/templates/client.py +0 -0
  22. {retab-0.0.84 → retab-0.0.85}/retab/resources/extractions/__init__.py +0 -0
  23. {retab-0.0.84 → retab-0.0.85}/retab/resources/extractions/client.py +0 -0
  24. {retab-0.0.84 → retab-0.0.85}/retab/resources/models.py +0 -0
  25. {retab-0.0.84 → retab-0.0.85}/retab/resources/projects/__init__.py +0 -0
  26. {retab-0.0.84 → retab-0.0.85}/retab/resources/projects/client.py +0 -0
  27. {retab-0.0.84 → retab-0.0.85}/retab/resources/schemas.py +0 -0
  28. {retab-0.0.84 → retab-0.0.85}/retab/resources/workflows/__init__.py +0 -0
  29. {retab-0.0.84 → retab-0.0.85}/retab/resources/workflows/client.py +0 -0
  30. {retab-0.0.84 → retab-0.0.85}/retab/types/__init__.py +0 -0
  31. {retab-0.0.84 → retab-0.0.85}/retab/types/chat.py +0 -0
  32. {retab-0.0.84 → retab-0.0.85}/retab/types/documents/__init__.py +0 -0
  33. {retab-0.0.84 → retab-0.0.85}/retab/types/documents/classify.py +0 -0
  34. {retab-0.0.84 → retab-0.0.85}/retab/types/documents/correct_orientation.py +0 -0
  35. {retab-0.0.84 → retab-0.0.85}/retab/types/documents/create_messages.py +0 -0
  36. {retab-0.0.84 → retab-0.0.85}/retab/types/documents/extract.py +0 -0
  37. {retab-0.0.84 → retab-0.0.85}/retab/types/documents/parse.py +0 -0
  38. {retab-0.0.84 → retab-0.0.85}/retab/types/documents/split.py +0 -0
  39. {retab-0.0.84 → retab-0.0.85}/retab/types/edit/__init__.py +0 -0
  40. {retab-0.0.84 → retab-0.0.85}/retab/types/edit/templates.py +0 -0
  41. {retab-0.0.84 → retab-0.0.85}/retab/types/extractions/__init__.py +0 -0
  42. {retab-0.0.84 → retab-0.0.85}/retab/types/extractions/types.py +0 -0
  43. {retab-0.0.84 → retab-0.0.85}/retab/types/inference_settings.py +0 -0
  44. {retab-0.0.84 → retab-0.0.85}/retab/types/mime.py +0 -0
  45. {retab-0.0.84 → retab-0.0.85}/retab/types/modality.py +0 -0
  46. {retab-0.0.84 → retab-0.0.85}/retab/types/pagination.py +0 -0
  47. {retab-0.0.84 → retab-0.0.85}/retab/types/projects/__init__.py +0 -0
  48. {retab-0.0.84 → retab-0.0.85}/retab/types/projects/metrics.py +0 -0
  49. {retab-0.0.84 → retab-0.0.85}/retab/types/projects/model.py +0 -0
  50. {retab-0.0.84 → retab-0.0.85}/retab/types/projects/predictions.py +0 -0
  51. {retab-0.0.84 → retab-0.0.85}/retab/types/schemas/__init__.py +0 -0
  52. {retab-0.0.84 → retab-0.0.85}/retab/types/schemas/chat.py +0 -0
  53. {retab-0.0.84 → retab-0.0.85}/retab/types/schemas/generate.py +0 -0
  54. {retab-0.0.84 → retab-0.0.85}/retab/types/schemas/layout.py +0 -0
  55. {retab-0.0.84 → retab-0.0.85}/retab/types/schemas/model.py +0 -0
  56. {retab-0.0.84 → retab-0.0.85}/retab/types/schemas/templates.py +0 -0
  57. {retab-0.0.84 → retab-0.0.85}/retab/types/standards.py +0 -0
  58. {retab-0.0.84 → retab-0.0.85}/retab/types/workflows/__init__.py +0 -0
  59. {retab-0.0.84 → retab-0.0.85}/retab/types/workflows/model.py +0 -0
  60. {retab-0.0.84 → retab-0.0.85}/retab/utils/__init__.py +0 -0
  61. {retab-0.0.84 → retab-0.0.85}/retab/utils/display.py +0 -0
  62. {retab-0.0.84 → retab-0.0.85}/retab/utils/hashing.py +0 -0
  63. {retab-0.0.84 → retab-0.0.85}/retab/utils/json_schema.py +0 -0
  64. {retab-0.0.84 → retab-0.0.85}/retab/utils/mime.py +0 -0
  65. {retab-0.0.84 → retab-0.0.85}/retab/utils/stream_context_managers.py +0 -0
  66. {retab-0.0.84 → retab-0.0.85}/retab.egg-info/dependency_links.txt +0 -0
  67. {retab-0.0.84 → retab-0.0.85}/retab.egg-info/requires.txt +0 -0
  68. {retab-0.0.84 → retab-0.0.85}/retab.egg-info/top_level.txt +0 -0
  69. {retab-0.0.84 → retab-0.0.85}/setup.cfg +0 -0
  70. {retab-0.0.84 → retab-0.0.85}/tests/test_projects.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: retab
3
- Version: 0.0.84
3
+ Version: 0.0.85
4
4
  Summary: Retab official python library
5
5
  Home-page: https://github.com/retab-dev/retab
6
6
  Author: Retab
@@ -0,0 +1,4 @@
1
+ from .client import Agent, AsyncAgent
2
+
3
+ __all__ = ["Agent", "AsyncAgent"]
4
+
@@ -1,5 +1,5 @@
1
1
  """
2
- Edit SDK client - Wrapper for document editing functionality.
2
+ Agent Edit SDK client - Wrapper for agent-based document editing functionality.
3
3
  """
4
4
 
5
5
  from io import IOBase
@@ -9,26 +9,24 @@ from typing import Any
9
9
  import PIL.Image
10
10
  from pydantic import HttpUrl
11
11
 
12
- from ..._resource import AsyncAPIResource, SyncAPIResource
13
- from ...utils.mime import prepare_mime_document
14
- from ...types.documents.edit import (
12
+ from ...._resource import AsyncAPIResource, SyncAPIResource
13
+ from ....utils.mime import prepare_mime_document
14
+ from ....types.documents.edit import (
15
15
  EditRequest,
16
16
  EditResponse,
17
17
  )
18
- from ...types.mime import MIMEData
19
- from ...types.standards import PreparedRequest, FieldUnset
20
- from .templates import Templates, AsyncTemplates
18
+ from ....types.mime import MIMEData
19
+ from ....types.standards import PreparedRequest, FieldUnset
21
20
 
22
21
 
23
- class BaseEditMixin:
24
- """Shared methods for preparing edit API requests."""
22
+ class BaseAgentMixin:
23
+ """Shared methods for preparing agent edit API requests."""
25
24
 
26
- def _prepare_fill_document(
25
+ def _prepare_fill(
27
26
  self,
28
27
  instructions: str,
29
28
  document: Path | str | IOBase | MIMEData | PIL.Image.Image | HttpUrl | None = None,
30
29
  model: str = FieldUnset,
31
- template_id: str | None = FieldUnset,
32
30
  **extra_body: Any,
33
31
  ) -> PreparedRequest:
34
32
  request_dict: dict[str, Any] = {
@@ -41,8 +39,6 @@ class BaseEditMixin:
41
39
 
42
40
  if model is not FieldUnset:
43
41
  request_dict["model"] = model
44
- if template_id is not FieldUnset:
45
- request_dict["template_id"] = template_id
46
42
 
47
43
  # Merge any extra fields provided by the caller
48
44
  if extra_body:
@@ -51,24 +47,22 @@ class BaseEditMixin:
51
47
  edit_request = EditRequest(**request_dict)
52
48
  return PreparedRequest(
53
49
  method="POST",
54
- url="/v1/edit/fill-document",
50
+ url="/v1/edit/agent/fill",
55
51
  data=edit_request.model_dump(mode="json", exclude_unset=True),
56
52
  )
57
53
 
58
54
 
59
- class Edit(SyncAPIResource, BaseEditMixin):
60
- """Edit API wrapper for synchronous usage."""
55
+ class Agent(SyncAPIResource, BaseAgentMixin):
56
+ """Agent Edit API wrapper for synchronous usage."""
61
57
 
62
58
  def __init__(self, client: Any) -> None:
63
59
  super().__init__(client=client)
64
- self.templates = Templates(client=client)
65
60
 
66
- def fill_document(
61
+ def fill(
67
62
  self,
68
63
  instructions: str,
69
64
  document: Path | str | IOBase | MIMEData | PIL.Image.Image | HttpUrl | None = None,
70
65
  model: str = FieldUnset,
71
- template_id: str | None = FieldUnset,
72
66
  **extra_body: Any,
73
67
  ) -> EditResponse:
74
68
  """
@@ -80,16 +74,11 @@ class Edit(SyncAPIResource, BaseEditMixin):
80
74
  3. LLM-based form filling using the provided instructions
81
75
  4. Returns the filled document with form field values populated
82
76
 
83
- Either `document` OR `template_id` must be provided, but not both.
84
-
85
77
  Args:
86
78
  instructions: Instructions describing how to fill the form fields.
87
79
  document: The document to edit. Can be a file path (Path or str), file-like object,
88
- MIMEData, PIL Image, or URL. Mutually exclusive with template_id.
80
+ MIMEData, PIL Image, or URL.
89
81
  model: The LLM model to use for inference. Defaults to "retab-small".
90
- template_id: Template ID to use for filling. When provided, uses the template's
91
- pre-defined form fields and empty PDF. Only works for PDF documents.
92
- Mutually exclusive with document.
93
82
 
94
83
  Returns:
95
84
  EditResponse: Response containing:
@@ -105,30 +94,27 @@ class Edit(SyncAPIResource, BaseEditMixin):
105
94
  - PPTX/PPT: Native editing for presentations
106
95
  - XLSX/XLS: Native editing for spreadsheets
107
96
  """
108
- request = self._prepare_fill_document(
97
+ request = self._prepare_fill(
109
98
  instructions=instructions,
110
99
  document=document,
111
100
  model=model,
112
- template_id=template_id,
113
101
  **extra_body,
114
102
  )
115
103
  response = self._client._prepared_request(request)
116
104
  return EditResponse.model_validate(response)
117
105
 
118
106
 
119
- class AsyncEdit(AsyncAPIResource, BaseEditMixin):
120
- """Edit API wrapper for asynchronous usage."""
107
+ class AsyncAgent(AsyncAPIResource, BaseAgentMixin):
108
+ """Agent Edit API wrapper for asynchronous usage."""
121
109
 
122
110
  def __init__(self, client: Any) -> None:
123
111
  super().__init__(client=client)
124
- self.templates = AsyncTemplates(client=client)
125
112
 
126
- async def fill_document(
113
+ async def fill(
127
114
  self,
128
115
  instructions: str,
129
116
  document: Path | str | IOBase | MIMEData | PIL.Image.Image | HttpUrl | None = None,
130
117
  model: str = FieldUnset,
131
- template_id: str | None = FieldUnset,
132
118
  **extra_body: Any,
133
119
  ) -> EditResponse:
134
120
  """
@@ -140,16 +126,11 @@ class AsyncEdit(AsyncAPIResource, BaseEditMixin):
140
126
  3. LLM-based form filling using the provided instructions
141
127
  4. Returns the filled document with form field values populated
142
128
 
143
- Either `document` OR `template_id` must be provided, but not both.
144
-
145
129
  Args:
146
130
  instructions: Instructions describing how to fill the form fields.
147
131
  document: The document to edit. Can be a file path (Path or str), file-like object,
148
- MIMEData, PIL Image, or URL. Mutually exclusive with template_id.
132
+ MIMEData, PIL Image, or URL.
149
133
  model: The LLM model to use for inference. Defaults to "retab-small".
150
- template_id: Template ID to use for filling. When provided, uses the template's
151
- pre-defined form fields and empty PDF. Only works for PDF documents.
152
- Mutually exclusive with document.
153
134
 
154
135
  Returns:
155
136
  EditResponse: Response containing:
@@ -165,12 +146,12 @@ class AsyncEdit(AsyncAPIResource, BaseEditMixin):
165
146
  - PPTX/PPT: Native editing for presentations
166
147
  - XLSX/XLS: Native editing for spreadsheets
167
148
  """
168
- request = self._prepare_fill_document(
149
+ request = self._prepare_fill(
169
150
  instructions=instructions,
170
151
  document=document,
171
152
  model=model,
172
- template_id=template_id,
173
153
  **extra_body,
174
154
  )
175
155
  response = await self._client._prepared_request(request)
176
156
  return EditResponse.model_validate(response)
157
+
@@ -0,0 +1,41 @@
1
+ """
2
+ Edit SDK client - Wrapper for document editing functionality.
3
+
4
+ Provides access to:
5
+ - edit.agent.fill() - Agent-based document editing (PDF, DOCX, PPTX, XLSX)
6
+ - edit.templates.* - Template-based PDF form filling
7
+ """
8
+
9
+ from typing import Any
10
+
11
+ from ..._resource import AsyncAPIResource, SyncAPIResource
12
+ from .templates import Templates, AsyncTemplates
13
+ from .agent import Agent, AsyncAgent
14
+
15
+
16
+ class Edit(SyncAPIResource):
17
+ """Edit API wrapper for synchronous usage.
18
+
19
+ Sub-clients:
20
+ agent: Agent-based document editing (fill any document with AI)
21
+ templates: Template-based PDF form filling (for batch processing)
22
+ """
23
+
24
+ def __init__(self, client: Any) -> None:
25
+ super().__init__(client=client)
26
+ self.agent = Agent(client=client)
27
+ self.templates = Templates(client=client)
28
+
29
+
30
+ class AsyncEdit(AsyncAPIResource):
31
+ """Edit API wrapper for asynchronous usage.
32
+
33
+ Sub-clients:
34
+ agent: Agent-based document editing (fill any document with AI)
35
+ templates: Template-based PDF form filling (for batch processing)
36
+ """
37
+
38
+ def __init__(self, client: Any) -> None:
39
+ super().__init__(client=client)
40
+ self.agent = AsyncAgent(client=client)
41
+ self.templates = AsyncTemplates(client=client)
@@ -107,7 +107,7 @@ class OCRResult(BaseModel):
107
107
  class InferFormSchemaRequest(BaseModel):
108
108
  """Request to infer form schema from a PDF or DOCX document."""
109
109
 
110
- document: MIMEData = Field(..., description="Input document (PDF or DOCX). DOCX files will be converted to PDF.")
110
+ document: MIMEData = Field(..., description="Input document (PDF, DOCX, XLSX or PPTX).")
111
111
  model: str = Field(default="retab-small", description="LLM model to use for inference")
112
112
 
113
113
 
@@ -118,7 +118,7 @@ class EditRequest(BaseModel):
118
118
  - When `document` is provided: OCR + LLM inference to detect and fill form fields
119
119
  - When `template_id` is provided: Uses pre-defined form fields from the template (PDF only)
120
120
  """
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.")
121
+ document: Optional[MIMEData] = Field(default=None, description="Input document (PDF, DOCX, XLSX or PPTX). Mutually exclusive with template_id.")
122
122
  model: str = Field(default="retab-small", description="LLM model to use for inference")
123
123
  instructions: str = Field(..., description="Instructions to fill the form")
124
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.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: retab
3
- Version: 0.0.84
3
+ Version: 0.0.85
4
4
  Summary: Retab official python library
5
5
  Home-page: https://github.com/retab-dev/retab
6
6
  Author: Retab
@@ -18,6 +18,8 @@ retab/resources/documents/__init__.py
18
18
  retab/resources/documents/client.py
19
19
  retab/resources/edit/__init__.py
20
20
  retab/resources/edit/client.py
21
+ retab/resources/edit/agent/__init__.py
22
+ retab/resources/edit/agent/client.py
21
23
  retab/resources/edit/templates/__init__.py
22
24
  retab/resources/edit/templates/client.py
23
25
  retab/resources/extractions/__init__.py
@@ -6,7 +6,7 @@ with open("requirements.txt") as f:
6
6
 
7
7
  setup(
8
8
  name="retab",
9
- version="0.0.84",
9
+ version="0.0.85",
10
10
  author="Retab",
11
11
  author_email="contact@retab.com",
12
12
  description="Retab official python library",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes