clerk-sdk 0.5.8__tar.gz → 0.5.10__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 (86) hide show
  1. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/PKG-INFO +1 -1
  2. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/__init__.py +1 -1
  3. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/client.py +19 -69
  4. clerk_sdk-0.5.10/clerk/models/prevalidation.py +33 -0
  5. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/pyproject.toml +1 -1
  6. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/setup.py +1 -1
  7. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/.github/workflows/ci.yaml +0 -0
  8. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/.github/workflows/pypi_publish.yml +0 -0
  9. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/.gitignore +0 -0
  10. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/LICENSE +0 -0
  11. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/MANIFEST.in +0 -0
  12. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/README.md +0 -0
  13. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/base.py +0 -0
  14. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/decorator/__init__.py +0 -0
  15. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/decorator/models.py +0 -0
  16. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/decorator/task_decorator.py +0 -0
  17. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/__init__.py +0 -0
  18. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/cli.py +0 -0
  19. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/code_runner.py +0 -0
  20. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/gui/graph_checker.py +0 -0
  21. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/gui/test_session.py +0 -0
  22. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/init_project.py +0 -0
  23. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/schema/fetch_schema.py +0 -0
  24. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/templates/exceptions.py.template +0 -0
  25. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/templates/launch.json.template +0 -0
  26. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/templates/main_basic.py.template +0 -0
  27. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/templates/main_gui.py.template +0 -0
  28. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/templates/rollbacks.py.template +0 -0
  29. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/templates/states.py.template +0 -0
  30. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/templates/tasks.json.template +0 -0
  31. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/templates/test_payload.py.template +0 -0
  32. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/development/templates/transitions.py.template +0 -0
  33. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/exceptions/__init__.py +0 -0
  34. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/exceptions/exceptions.py +0 -0
  35. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/exceptions/remote_device.py +0 -0
  36. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/__init__.py +0 -0
  37. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/action_model/__init__.py +0 -0
  38. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/action_model/model.py +0 -0
  39. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/action_model/utils.py +0 -0
  40. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/client.py +0 -0
  41. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/client_actor/__init__.py +0 -0
  42. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/client_actor/client_actor.py +0 -0
  43. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/client_actor/exception.py +0 -0
  44. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/client_actor/model.py +0 -0
  45. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/decorators/__init__.py +0 -0
  46. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/decorators/gui_automation.py +0 -0
  47. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/exceptions/__init__.py +0 -0
  48. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/exceptions/agent_manager.py +0 -0
  49. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/exceptions/modality/__init__.py +0 -0
  50. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/exceptions/modality/exc.py +0 -0
  51. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/exceptions/websocket.py +0 -0
  52. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/requirements.txt +0 -0
  53. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_actions/__init__.py +0 -0
  54. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_actions/actions.py +0 -0
  55. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_actions/base.py +0 -0
  56. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_actions/support.py +0 -0
  57. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_state_inspector/__init__.py +0 -0
  58. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_state_inspector/gui_vision.py +0 -0
  59. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_state_inspector/models.py +0 -0
  60. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_state_machine/Readme.md +0 -0
  61. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_state_machine/__init__.py +0 -0
  62. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_state_machine/ai_recovery.py +0 -0
  63. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_state_machine/decorators.py +0 -0
  64. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_state_machine/exceptions.py +0 -0
  65. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/gui_automation/ui_state_machine/state_machine.py +0 -0
  66. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/models/__init__.py +0 -0
  67. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/models/document.py +0 -0
  68. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/models/document_statuses.py +0 -0
  69. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/models/file.py +0 -0
  70. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/models/remote_device.py +0 -0
  71. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/models/response_model.py +0 -0
  72. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/models/ui_operator.py +0 -0
  73. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/utils/__init__.py +0 -0
  74. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/utils/logger.py +0 -0
  75. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/clerk/utils/save_artifact.py +0 -0
  76. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/requirements.txt +0 -0
  77. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/tests/conftest.py +0 -0
  78. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/tests/test_base.py +0 -0
  79. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/tests/test_client.py +0 -0
  80. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/tests/test_document_models.py +0 -0
  81. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/tests/test_exceptions.py +0 -0
  82. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/tests/test_file_models.py +0 -0
  83. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/tests/test_gui_automation.py +0 -0
  84. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/tests/test_task_decorator.py +0 -0
  85. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/tests/test_utils.py +0 -0
  86. {clerk_sdk-0.5.8 → clerk_sdk-0.5.10}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clerk-sdk
3
- Version: 0.5.8
3
+ Version: 0.5.10
4
4
  Summary: Library for interacting with Clerk
5
5
  Project-URL: Homepage, https://github.com/F-ONE-Group/clerk_pypi
6
6
  Author-email: F-One <contact@f-one.group>
@@ -1,4 +1,4 @@
1
1
  from .client import Clerk
2
2
 
3
3
 
4
- __version__ = "0.5.8"
4
+ __version__ = "0.5.10"
@@ -2,6 +2,7 @@ from typing import Any, Dict, List, Literal
2
2
 
3
3
  from clerk.base import BaseClerk
4
4
  from clerk.models.document import Document, GetDocumentsRequest, UploadDocumentRequest
5
+ from clerk.models.prevalidation import FileClassificationResponse
5
6
  from .models.file import ParsedFile, UploadFile
6
7
 
7
8
 
@@ -70,74 +71,23 @@ class Clerk(BaseClerk):
70
71
  files_data = [f.to_multipart_format() for f in files]
71
72
  self.post_request(endpoint, params=params, files=files_data)
72
73
 
73
-
74
- class ClerkDocument(BaseClerk):
75
- endpoint: str = "/document"
76
-
77
- def upload_document(self, request: UploadDocumentRequest) -> Document:
78
- endpoint = "/document"
74
+ def prevalidate_file(
75
+ self, project_id: str, workflow_id: str, file: UploadFile
76
+ ) -> Dict[str, Any]:
77
+ """Submit a prevalidation for a specific file. Returns the id for fetching the results later."""
78
+ endpoint = f"/prevalidation/file"
79
+ files_data = [file.to_multipart_format()]
79
80
  res = self.post_request(
80
- endpoint=endpoint, data=request.data, files=request.files_
81
+ endpoint,
82
+ files=files_data,
83
+ data={"project_id": project_id, "workflow_id": workflow_id},
81
84
  )
82
- return Document(**res.data[0])
83
-
84
- def reprocess_document(self, document_id: str, workflow_id: str) -> Document:
85
- endpoint = f"/document/{document_id}/reprocess"
86
- res = self.put_request(endpoint=endpoint, data={"workflow_id": workflow_id})
87
- return Document(**res.data[0])
88
-
89
- def cancel_document_run(self, document_id: str) -> Document:
90
- endpoint = f"/document/{document_id}/cancel"
91
- res = self.post_request(endpoint=endpoint)
92
- return Document(**res.data[0])
93
-
94
- def update_document_structured_data(
95
- self, document_id: str, updated_structured_data: Dict[str, Any]
96
- ) -> Document:
97
- endpoint = f"/document/{document_id}"
98
- payload = dict(structured_data=updated_structured_data)
99
- res = self.put_request(endpoint, json=payload)
100
-
101
- return Document(**res.data[0])
102
-
103
- def get_document(self, document_id: str) -> Document:
104
- endpoint = f"/document/{document_id}"
105
- res = self.get_request(endpoint=endpoint)
106
- return Document(**res.data[0])
107
-
108
- def get_documents(self, request: GetDocumentsRequest) -> List[Document]:
109
- if not any(
110
- [
111
- request.organization_id,
112
- request.project_id,
113
- request.start_date,
114
- request.end_date,
115
- request.query,
116
- request.include_statuses,
117
- ]
118
- ):
119
- raise ValueError(
120
- "At least one query parameter (organization_id, project_id, start_date, end_date, query, or include_statuses) must be provided."
121
- )
122
-
123
- endpoint = f"/documents"
124
- params = request.model_dump(mode="json")
125
- res = self.get_request(endpoint, params=params)
126
-
127
- return [Document(**d) for d in res.data]
128
-
129
- def get_files_document(self, document_id: str) -> List[ParsedFile]:
130
- endpoint = f"/document/{document_id}/files"
131
- res = self.get_request(endpoint=endpoint)
132
- return [ParsedFile(**d) for d in res.data]
133
-
134
- def add_files_to_document(
135
- self,
136
- document_id: str,
137
- type: Literal["input", "output"],
138
- files: List[UploadFile],
139
- ):
140
- endpoint = f"/document/{document_id}/files/upload"
141
- params = {"type": type}
142
- files_data = [f.to_multipart_format() for f in files]
143
- self.post_request(endpoint, params=params, files=files_data)
85
+ return res.data[0]
86
+
87
+ def get_prevalidation_results(
88
+ self, workflow_run_id: str
89
+ ) -> FileClassificationResponse:
90
+ """Fetch the results of a previously submitted prevalidation."""
91
+ endpoint = f"/prevalidation/file"
92
+ res = self.get_request(endpoint, params={"workflow_run_id": workflow_run_id})
93
+ return FileClassificationResponse(**res.data[0])
@@ -0,0 +1,33 @@
1
+ from typing import Dict, List, Optional
2
+ from pydantic import BaseModel, Field
3
+
4
+
5
+ class LabelWithDescriptions(BaseModel):
6
+ label: str = Field(..., description="The label/category name")
7
+ description: Optional[str] = Field(
8
+ None, description="Optional description of the label/category"
9
+ )
10
+ attributes: Optional[List[str]] = Field(
11
+ None, description="Optional attributes for the label/category"
12
+ )
13
+ start_page: Optional[int] = Field(
14
+ None, description="Start page for classification (0-based, inclusive)"
15
+ )
16
+ end_page: Optional[int] = Field(
17
+ None, description="End page for classification (0-based, exclusive)"
18
+ )
19
+
20
+
21
+ class FileClassificationResponse(BaseModel):
22
+ valid: bool = Field(False, description="Whether the file classification is valid")
23
+ filename: str = Field(..., description="The name of the file that was classified")
24
+ classification: Optional[str] = Field(
25
+ None, description="The selected classification category"
26
+ )
27
+ reason: Optional[str] = Field(
28
+ None,
29
+ description="The reasoning behind the classification. To be filled if no classification is made.",
30
+ )
31
+ possible_categories: Optional[Dict[str, LabelWithDescriptions]] = Field(
32
+ None, description="Possible categories for classification"
33
+ )
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "clerk-sdk"
7
- version = "0.5.8"
7
+ version = "0.5.10"
8
8
  description = "Library for interacting with Clerk"
9
9
  readme = "README.md"
10
10
  authors = [
@@ -13,7 +13,7 @@ gui_requirements = get_requirements("./clerk/gui_automation")
13
13
 
14
14
  setup(
15
15
  name="clerk-sdk",
16
- version="0.5.8",
16
+ version="0.5.10",
17
17
  description="Library for interacting with Clerk",
18
18
  long_description=open("README.md").read(),
19
19
  long_description_content_type="text/markdown",
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