retab 0.0.90__tar.gz → 0.0.92__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 (75) hide show
  1. {retab-0.0.90 → retab-0.0.92}/PKG-INFO +1 -1
  2. {retab-0.0.90 → retab-0.0.92}/retab/resources/documents/client.py +22 -21
  3. {retab-0.0.90 → retab-0.0.92}/retab/types/documents/__init__.py +4 -2
  4. {retab-0.0.90 → retab-0.0.92}/retab/types/documents/classify.py +4 -1
  5. {retab-0.0.90 → retab-0.0.92}/retab/types/documents/split.py +13 -13
  6. {retab-0.0.90 → retab-0.0.92}/retab.egg-info/PKG-INFO +1 -1
  7. {retab-0.0.90 → retab-0.0.92}/setup.py +1 -1
  8. {retab-0.0.90 → retab-0.0.92}/README.md +0 -0
  9. {retab-0.0.90 → retab-0.0.92}/pyproject.toml +0 -0
  10. {retab-0.0.90 → retab-0.0.92}/retab/__init__.py +0 -0
  11. {retab-0.0.90 → retab-0.0.92}/retab/_resource.py +0 -0
  12. {retab-0.0.90 → retab-0.0.92}/retab/client.py +0 -0
  13. {retab-0.0.90 → retab-0.0.92}/retab/generate_types.py +0 -0
  14. {retab-0.0.90 → retab-0.0.92}/retab/py.typed +0 -0
  15. {retab-0.0.90 → retab-0.0.92}/retab/resources/__init__.py +0 -0
  16. {retab-0.0.90 → retab-0.0.92}/retab/resources/documents/__init__.py +0 -0
  17. {retab-0.0.90 → retab-0.0.92}/retab/resources/edit/__init__.py +0 -0
  18. {retab-0.0.90 → retab-0.0.92}/retab/resources/edit/agent/__init__.py +0 -0
  19. {retab-0.0.90 → retab-0.0.92}/retab/resources/edit/agent/client.py +0 -0
  20. {retab-0.0.90 → retab-0.0.92}/retab/resources/edit/client.py +0 -0
  21. {retab-0.0.90 → retab-0.0.92}/retab/resources/edit/templates/__init__.py +0 -0
  22. {retab-0.0.90 → retab-0.0.92}/retab/resources/edit/templates/client.py +0 -0
  23. {retab-0.0.90 → retab-0.0.92}/retab/resources/extractions/__init__.py +0 -0
  24. {retab-0.0.90 → retab-0.0.92}/retab/resources/extractions/client.py +0 -0
  25. {retab-0.0.90 → retab-0.0.92}/retab/resources/jobs/__init__.py +0 -0
  26. {retab-0.0.90 → retab-0.0.92}/retab/resources/jobs/client.py +0 -0
  27. {retab-0.0.90 → retab-0.0.92}/retab/resources/models.py +0 -0
  28. {retab-0.0.90 → retab-0.0.92}/retab/resources/projects/__init__.py +0 -0
  29. {retab-0.0.90 → retab-0.0.92}/retab/resources/projects/client.py +0 -0
  30. {retab-0.0.90 → retab-0.0.92}/retab/resources/schemas.py +0 -0
  31. {retab-0.0.90 → retab-0.0.92}/retab/resources/workflows/__init__.py +0 -0
  32. {retab-0.0.90 → retab-0.0.92}/retab/resources/workflows/client.py +0 -0
  33. {retab-0.0.90 → retab-0.0.92}/retab/resources/workflows/runs/__init__.py +0 -0
  34. {retab-0.0.90 → retab-0.0.92}/retab/resources/workflows/runs/client.py +0 -0
  35. {retab-0.0.90 → retab-0.0.92}/retab/types/__init__.py +0 -0
  36. {retab-0.0.90 → retab-0.0.92}/retab/types/chat.py +0 -0
  37. {retab-0.0.90 → retab-0.0.92}/retab/types/documents/correct_orientation.py +0 -0
  38. {retab-0.0.90 → retab-0.0.92}/retab/types/documents/create_messages.py +0 -0
  39. {retab-0.0.90 → retab-0.0.92}/retab/types/documents/edit.py +0 -0
  40. {retab-0.0.90 → retab-0.0.92}/retab/types/documents/extract.py +0 -0
  41. {retab-0.0.90 → retab-0.0.92}/retab/types/documents/parse.py +0 -0
  42. {retab-0.0.90 → retab-0.0.92}/retab/types/edit/__init__.py +0 -0
  43. {retab-0.0.90 → retab-0.0.92}/retab/types/edit/templates.py +0 -0
  44. {retab-0.0.90 → retab-0.0.92}/retab/types/extractions/__init__.py +0 -0
  45. {retab-0.0.90 → retab-0.0.92}/retab/types/extractions/types.py +0 -0
  46. {retab-0.0.90 → retab-0.0.92}/retab/types/inference_settings.py +0 -0
  47. {retab-0.0.90 → retab-0.0.92}/retab/types/jobs.py +0 -0
  48. {retab-0.0.90 → retab-0.0.92}/retab/types/mime.py +0 -0
  49. {retab-0.0.90 → retab-0.0.92}/retab/types/modality.py +0 -0
  50. {retab-0.0.90 → retab-0.0.92}/retab/types/pagination.py +0 -0
  51. {retab-0.0.90 → retab-0.0.92}/retab/types/projects/__init__.py +0 -0
  52. {retab-0.0.90 → retab-0.0.92}/retab/types/projects/metrics.py +0 -0
  53. {retab-0.0.90 → retab-0.0.92}/retab/types/projects/model.py +0 -0
  54. {retab-0.0.90 → retab-0.0.92}/retab/types/projects/predictions.py +0 -0
  55. {retab-0.0.90 → retab-0.0.92}/retab/types/schemas/__init__.py +0 -0
  56. {retab-0.0.90 → retab-0.0.92}/retab/types/schemas/chat.py +0 -0
  57. {retab-0.0.90 → retab-0.0.92}/retab/types/schemas/generate.py +0 -0
  58. {retab-0.0.90 → retab-0.0.92}/retab/types/schemas/layout.py +0 -0
  59. {retab-0.0.90 → retab-0.0.92}/retab/types/schemas/model.py +0 -0
  60. {retab-0.0.90 → retab-0.0.92}/retab/types/schemas/templates.py +0 -0
  61. {retab-0.0.90 → retab-0.0.92}/retab/types/standards.py +0 -0
  62. {retab-0.0.90 → retab-0.0.92}/retab/types/workflows/__init__.py +0 -0
  63. {retab-0.0.90 → retab-0.0.92}/retab/types/workflows/model.py +0 -0
  64. {retab-0.0.90 → retab-0.0.92}/retab/utils/__init__.py +0 -0
  65. {retab-0.0.90 → retab-0.0.92}/retab/utils/display.py +0 -0
  66. {retab-0.0.90 → retab-0.0.92}/retab/utils/hashing.py +0 -0
  67. {retab-0.0.90 → retab-0.0.92}/retab/utils/json_schema.py +0 -0
  68. {retab-0.0.90 → retab-0.0.92}/retab/utils/mime.py +0 -0
  69. {retab-0.0.90 → retab-0.0.92}/retab/utils/stream_context_managers.py +0 -0
  70. {retab-0.0.90 → retab-0.0.92}/retab.egg-info/SOURCES.txt +0 -0
  71. {retab-0.0.90 → retab-0.0.92}/retab.egg-info/dependency_links.txt +0 -0
  72. {retab-0.0.90 → retab-0.0.92}/retab.egg-info/requires.txt +0 -0
  73. {retab-0.0.90 → retab-0.0.92}/retab.egg-info/top_level.txt +0 -0
  74. {retab-0.0.90 → retab-0.0.92}/setup.cfg +0 -0
  75. {retab-0.0.90 → retab-0.0.92}/tests/test_projects.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: retab
3
- Version: 0.0.90
3
+ Version: 0.0.92
4
4
  Summary: Retab official python library
5
5
  Home-page: https://github.com/retab-dev/retab
6
6
  Author: Retab
@@ -16,7 +16,8 @@ from ...types.chat import ChatCompletionRetabMessage
16
16
  from ...types.documents.edit import EditRequest, EditResponse
17
17
  from ...types.documents.extract import DocumentExtractRequest, RetabParsedChatCompletion, RetabParsedChatCompletionChunk, RetabParsedChoice, maybe_parse_to_pydantic
18
18
  from ...types.documents.parse import ParseRequest, ParseResult, TableParsingFormat
19
- from ...types.documents.split import Category, SplitRequest, SplitResponse
19
+ from ...types.documents.split import Subdocument, SplitRequest, SplitResponse
20
+ from ...types.documents.classify import Category
20
21
  from ...types.documents.classify import ClassifyRequest, ClassifyResponse
21
22
  from ...types.mime import MIMEData
22
23
  from ...types.standards import PreparedRequest, FieldUnset
@@ -148,21 +149,21 @@ class BaseDocumentsMixin:
148
149
  def _prepare_split(
149
150
  self,
150
151
  document: Path | str | IOBase | MIMEData | PIL.Image.Image | HttpUrl,
151
- categories: list[Category] | list[dict[str, str]],
152
+ subdocuments: list[Subdocument] | list[dict[str, str]],
152
153
  model: str,
153
154
  **extra_body: Any,
154
155
  ) -> PreparedRequest:
155
156
  mime_document = prepare_mime_document(document)
156
157
 
157
- # Convert dict categories to Category objects if needed
158
- category_objects = [
159
- Category(**cat) if isinstance(cat, dict) else cat
160
- for cat in categories
158
+ # Convert dict subdocuments to Subdocument objects if needed
159
+ subdocument_objects = [
160
+ Subdocument(**subdoc) if isinstance(subdoc, dict) else subdoc
161
+ for subdoc in subdocuments
161
162
  ]
162
163
 
163
164
  request_dict: dict[str, Any] = {
164
165
  "document": mime_document,
165
- "categories": category_objects,
166
+ "subdocuments": subdocument_objects,
166
167
  "model": model,
167
168
  }
168
169
 
@@ -644,20 +645,20 @@ class Documents(SyncAPIResource, BaseDocumentsMixin):
644
645
  def split(
645
646
  self,
646
647
  document: Path | str | IOBase | MIMEData | PIL.Image.Image | HttpUrl,
647
- categories: list[Category] | list[dict[str, str]],
648
+ subdocuments: list[Subdocument] | list[dict[str, str]],
648
649
  model: str,
649
650
  **extra_body: Any,
650
651
  ) -> SplitResponse:
651
652
  """
652
- Split a document into sections based on provided categories.
653
+ Split a document into sections based on provided subdocuments.
653
654
 
654
655
  This method analyzes a multi-page document and classifies pages into
655
- user-defined categories, returning the page ranges for each section.
656
+ user-defined subdocuments, returning the page ranges for each section.
656
657
 
657
658
  Args:
658
659
  document: The document to split. Can be a file path (Path or str), file-like object, MIMEData, PIL Image, or URL.
659
- categories: List of categories to split the document into. Each category should have a 'name' and 'description'.
660
- Can be Category objects or dicts with 'name' and 'description' keys.
660
+ subdocuments: List of subdocuments to split the document into. Each subdocument should have a 'name' and 'description'.
661
+ Can be Subdocument objects or dicts with 'name' and 'description' keys.
661
662
  model: The AI model to use for document splitting (e.g., "gemini-2.5-flash").
662
663
 
663
664
  Returns:
@@ -672,7 +673,7 @@ class Documents(SyncAPIResource, BaseDocumentsMixin):
672
673
  response = retab.documents.split(
673
674
  document="invoice_batch.pdf",
674
675
  model="gemini-2.5-flash",
675
- categories=[
676
+ subdocuments=[
676
677
  {"name": "invoice", "description": "Invoice documents with billing information"},
677
678
  {"name": "receipt", "description": "Receipt documents for payments"},
678
679
  {"name": "contract", "description": "Legal contract documents"},
@@ -684,7 +685,7 @@ class Documents(SyncAPIResource, BaseDocumentsMixin):
684
685
  """
685
686
  request = self._prepare_split(
686
687
  document=document,
687
- categories=categories,
688
+ subdocuments=subdocuments,
688
689
  model=model,
689
690
  **extra_body,
690
691
  )
@@ -1039,20 +1040,20 @@ class AsyncDocuments(AsyncAPIResource, BaseDocumentsMixin):
1039
1040
  async def split(
1040
1041
  self,
1041
1042
  document: Path | str | IOBase | MIMEData | PIL.Image.Image | HttpUrl,
1042
- categories: list[Category] | list[dict[str, str]],
1043
+ subdocuments: list[Subdocument] | list[dict[str, str]],
1043
1044
  model: str,
1044
1045
  **extra_body: Any,
1045
1046
  ) -> SplitResponse:
1046
1047
  """
1047
- Split a document into sections based on provided categories asynchronously.
1048
+ Split a document into sections based on provided subdocuments asynchronously.
1048
1049
 
1049
1050
  This method analyzes a multi-page document and classifies pages into
1050
- user-defined categories, returning the page ranges for each section.
1051
+ user-defined subdocuments, returning the page ranges for each section.
1051
1052
 
1052
1053
  Args:
1053
1054
  document: The document to split. Can be a file path (Path or str), file-like object, MIMEData, PIL Image, or URL.
1054
- categories: List of categories to split the document into. Each category should have a 'name' and 'description'.
1055
- Can be Category objects or dicts with 'name' and 'description' keys.
1055
+ subdocuments: List of subdocuments to split the document into. Each subdocument should have a 'name' and 'description'.
1056
+ Can be Subdocument objects or dicts with 'name' and 'description' keys.
1056
1057
  model: The AI model to use for document splitting (e.g., "gemini-2.5-flash").
1057
1058
 
1058
1059
  Returns:
@@ -1067,7 +1068,7 @@ class AsyncDocuments(AsyncAPIResource, BaseDocumentsMixin):
1067
1068
  response = await retab.documents.split(
1068
1069
  document="invoice_batch.pdf",
1069
1070
  model="gemini-2.5-flash",
1070
- categories=[
1071
+ subdocuments=[
1071
1072
  {"name": "invoice", "description": "Invoice documents with billing information"},
1072
1073
  {"name": "receipt", "description": "Receipt documents for payments"},
1073
1074
  {"name": "contract", "description": "Legal contract documents"},
@@ -1079,7 +1080,7 @@ class AsyncDocuments(AsyncAPIResource, BaseDocumentsMixin):
1079
1080
  """
1080
1081
  request = self._prepare_split(
1081
1082
  document=document,
1082
- categories=categories,
1083
+ subdocuments=subdocuments,
1083
1084
  model=model,
1084
1085
  **extra_body,
1085
1086
  )
@@ -1,12 +1,14 @@
1
1
  from .parse import ParseRequest, ParseResult, RetabUsage
2
- from .split import Category, SplitRequest, SplitResult, SplitResponse
3
- from .classify import ClassifyRequest, ClassifyResult, ClassifyResponse
2
+ from .split import Subdocument, SplitRequest, SplitResult, SplitResponse
3
+ from .classify import ClassifyRequest, ClassifyResult, ClassifyResponse, Category
4
+
4
5
 
5
6
  __all__ = [
6
7
  "ParseRequest",
7
8
  "ParseResult",
8
9
  "RetabUsage",
9
10
  "Category",
11
+ "Subdocument",
10
12
  "SplitRequest",
11
13
  "SplitResult",
12
14
  "SplitResponse",
@@ -1,13 +1,16 @@
1
1
  from pydantic import BaseModel, Field
2
2
  from ..mime import MIMEData
3
- from .split import Category
4
3
 
4
+ class Category(BaseModel):
5
+ name: str = Field(..., description="The name of the category")
6
+ description: str = Field(..., description="The description of the category")
5
7
 
6
8
  class ClassifyRequest(BaseModel):
7
9
  document: MIMEData = Field(..., description="The document to classify")
8
10
  categories: list[Category] = Field(..., description="The categories to classify the document into")
9
11
  model: str = Field(default="retab-small", description="The model to use for classification")
10
12
  first_n_pages: int | None = Field(default=None, description="Only use the first N pages of the document for classification. Useful for large documents where classification can be determined from early pages.")
13
+ context: str | None = Field(default=None, description="Additional context for classification (e.g., iteration context from a loop)")
11
14
 
12
15
 
13
16
  class ClassifyResult(BaseModel):
@@ -1,17 +1,17 @@
1
1
  from pydantic import BaseModel, Field
2
2
  from ..mime import MIMEData
3
3
 
4
-
5
- class Category(BaseModel):
6
- name: str = Field(..., description="The name of the category")
7
- description: str = Field(..., description="The description of the category")
8
- partition_key: str | None = Field(default=None, description="The key to partition the category")
4
+ class Subdocument(BaseModel):
5
+ name: str = Field(..., description="The name of the subdocument")
6
+ description: str = Field(..., description="The description of the subdocument")
7
+ partition_key: str | None = Field(default=None, description="The key to partition the subdocument")
9
8
 
10
9
 
11
10
  class SplitRequest(BaseModel):
12
11
  document: MIMEData = Field(..., description="The document to split")
13
- categories: list[Category] = Field(..., description="The categories to split the document into")
12
+ subdocuments: list[Subdocument] = Field(..., description="The subdocuments to split the document into")
14
13
  model: str = Field(default="retab-small", description="The model to use to split the document")
14
+ context: str | None = Field(default=None, description="Additional context for the split operation (e.g., iteration context from a loop)")
15
15
 
16
16
 
17
17
  class Partition(BaseModel):
@@ -21,9 +21,9 @@ class Partition(BaseModel):
21
21
  last_page_y_end: float = Field(default=1.0, description="The y coordinate of the last page of the partition")
22
22
 
23
23
  class SplitResult(BaseModel):
24
- name: str = Field(..., description="The name of the category")
25
- pages: list[int] = Field(..., description="The pages of the category (1-indexed)")
26
- partitions: list[Partition] = Field(default_factory=list, description="The partitions of the category")
24
+ name: str = Field(..., description="The name of the subdocument")
25
+ pages: list[int] = Field(..., description="The pages of the subdocument (1-indexed)")
26
+ partitions: list[Partition] = Field(default_factory=list, description="The partitions of the subdocument")
27
27
 
28
28
 
29
29
  class SplitResponse(BaseModel):
@@ -32,14 +32,14 @@ class SplitResponse(BaseModel):
32
32
 
33
33
  class SplitOutputItem(BaseModel):
34
34
  """Internal schema item for LLM structured output validation."""
35
- name: str = Field(..., description="The name of the category")
36
- start_page: int = Field(..., description="The start page of the category (1-indexed)")
37
- end_page: int = Field(..., description="The end page of the category (1-indexed, inclusive)")
35
+ name: str = Field(..., description="The name of the subdocument")
36
+ start_page: int = Field(..., description="The start page of the subdocument (1-indexed)")
37
+ end_page: int = Field(..., description="The end page of the subdocument (1-indexed, inclusive)")
38
38
 
39
39
 
40
40
  class SplitOutputSchema(BaseModel):
41
41
  """Schema for LLM structured output."""
42
42
  splits: list[SplitOutputItem] = Field(
43
43
  ...,
44
- description="List of document sections, each classified into one of the provided categories with their page ranges"
44
+ description="List of document sections, each classified into one of the provided subdocuments with their page ranges"
45
45
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: retab
3
- Version: 0.0.90
3
+ Version: 0.0.92
4
4
  Summary: Retab official python library
5
5
  Home-page: https://github.com/retab-dev/retab
6
6
  Author: Retab
@@ -6,7 +6,7 @@ with open("requirements.txt") as f:
6
6
 
7
7
  setup(
8
8
  name="retab",
9
- version="0.0.90",
9
+ version="0.0.92",
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
File without changes