clerk-sdk 0.4.0__tar.gz → 0.4.2__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.
- {clerk_sdk-0.4.0/clerk_sdk.egg-info → clerk_sdk-0.4.2}/PKG-INFO +1 -1
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/client.py +22 -1
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/decorator/task_decorator.py +4 -4
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/models/document.py +25 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2/clerk_sdk.egg-info}/PKG-INFO +1 -1
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/setup.py +1 -1
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/LICENSE +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/MANIFEST.in +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/README.md +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/base.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/decorator/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/decorator/models.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/exceptions/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/exceptions/exceptions.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/exceptions/remote_device.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/action_model/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/action_model/model.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/action_model/utils.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/client.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/client_actor/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/client_actor/client_actor.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/client_actor/exception.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/client_actor/model.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/decorators/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/decorators/gui_automation.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/exceptions/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/exceptions/agent_manager.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/exceptions/modality/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/exceptions/modality/exc.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/exceptions/websocket.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/requirements.txt +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_actions/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_actions/actions.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_actions/base.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_actions/support.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_state_inspector/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_state_inspector/gui_vision.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_state_inspector/models.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_state_machine/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_state_machine/ai_recovery.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_state_machine/decorators.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_state_machine/exceptions.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_state_machine/models.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/gui_automation/ui_state_machine/state_machine.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/models/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/models/document_statuses.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/models/file.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/models/remote_device.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/models/response_model.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/models/ui_operator.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/utils/__init__.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/utils/logger.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk/utils/save_artifact.py +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk_sdk.egg-info/SOURCES.txt +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk_sdk.egg-info/dependency_links.txt +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk_sdk.egg-info/requires.txt +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/clerk_sdk.egg-info/top_level.txt +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/pyproject.toml +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/requirements.txt +0 -0
- {clerk_sdk-0.4.0 → clerk_sdk-0.4.2}/setup.cfg +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from typing import Any, Dict, List, Literal
|
|
2
2
|
|
|
3
3
|
from clerk.base import BaseClerk
|
|
4
|
-
from clerk.models.document import Document, UploadDocumentRequest
|
|
4
|
+
from clerk.models.document import Document, GetDocumentsRequest, UploadDocumentRequest
|
|
5
5
|
from .models.file import ParsedFile, UploadFile
|
|
6
6
|
|
|
7
7
|
|
|
@@ -28,6 +28,27 @@ class Clerk(BaseClerk):
|
|
|
28
28
|
res = self.get_request(endpoint=endpoint)
|
|
29
29
|
return Document(**res.data[0])
|
|
30
30
|
|
|
31
|
+
def get_documents(self, request: GetDocumentsRequest) -> List[Document]:
|
|
32
|
+
if not any(
|
|
33
|
+
[
|
|
34
|
+
request.organization_id,
|
|
35
|
+
request.project_id,
|
|
36
|
+
request.start_date,
|
|
37
|
+
request.end_date,
|
|
38
|
+
request.query,
|
|
39
|
+
request.include_statuses,
|
|
40
|
+
]
|
|
41
|
+
):
|
|
42
|
+
raise ValueError(
|
|
43
|
+
"At least one query parameter (organization_id, project_id, start_date, end_date, query, or include_statuses) must be provided."
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
endpoint = f"/documents"
|
|
47
|
+
params = request.model_dump(mode="json")
|
|
48
|
+
res = self.get_request(endpoint, params=params)
|
|
49
|
+
|
|
50
|
+
return [Document(**d) for d in res.data]
|
|
51
|
+
|
|
31
52
|
def get_files_document(self, document_id: str) -> List[ParsedFile]:
|
|
32
53
|
endpoint = f"/document/{document_id}/files"
|
|
33
54
|
res = self.get_request(endpoint=endpoint)
|
|
@@ -13,7 +13,9 @@ output_pkl: str = "/app/data/output/output.pkl"
|
|
|
13
13
|
def clerk_code():
|
|
14
14
|
def decorator(func: Callable[[ClerkCodePayload], ClerkCodePayload]):
|
|
15
15
|
@wraps(func)
|
|
16
|
-
def wrapper(
|
|
16
|
+
def wrapper(
|
|
17
|
+
payload: Optional[ClerkCodePayload] = None,
|
|
18
|
+
) -> ClerkCodePayload | None:
|
|
17
19
|
# 1. Load payload from file if not provided
|
|
18
20
|
use_pickle = False
|
|
19
21
|
output: ClerkCodePayload | BaseException | None = None
|
|
@@ -57,6 +59,7 @@ def clerk_code():
|
|
|
57
59
|
message=str(e),
|
|
58
60
|
traceback=traceback.format_exc(),
|
|
59
61
|
)
|
|
62
|
+
output = error_info
|
|
60
63
|
|
|
61
64
|
# 3. write to output.pkl
|
|
62
65
|
try:
|
|
@@ -88,9 +91,6 @@ def clerk_code():
|
|
|
88
91
|
if isinstance(output, Exception):
|
|
89
92
|
raise output
|
|
90
93
|
|
|
91
|
-
if output is None:
|
|
92
|
-
raise RuntimeError("output object cannot be None")
|
|
93
|
-
|
|
94
94
|
return output
|
|
95
95
|
|
|
96
96
|
return wrapper
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
|
+
import json
|
|
2
3
|
import mimetypes
|
|
3
4
|
import os
|
|
4
5
|
from typing import Any, Dict, List, Optional
|
|
@@ -28,6 +29,7 @@ class UploadDocumentRequest(BaseModel):
|
|
|
28
29
|
message_subject: Optional[str] = None
|
|
29
30
|
message_content: Optional[str] = None
|
|
30
31
|
files: List[str | ParsedFile] = []
|
|
32
|
+
input_structured_data: Dict[str, Any] | None = None
|
|
31
33
|
|
|
32
34
|
def _define_files(self):
|
|
33
35
|
formatted_files: List[
|
|
@@ -70,12 +72,35 @@ class UploadDocumentRequest(BaseModel):
|
|
|
70
72
|
|
|
71
73
|
@property
|
|
72
74
|
def data(self) -> Dict[str, Any]:
|
|
75
|
+
|
|
76
|
+
serialized_input_structured_data: str | None = None
|
|
77
|
+
if self.input_structured_data:
|
|
78
|
+
try:
|
|
79
|
+
serialized_input_structured_data = json.dumps(
|
|
80
|
+
self.input_structured_data
|
|
81
|
+
)
|
|
82
|
+
except Exception as e:
|
|
83
|
+
raise ValueError(
|
|
84
|
+
f"`input_structured_data` is not JSON serializable: {e}"
|
|
85
|
+
)
|
|
86
|
+
|
|
73
87
|
return dict(
|
|
74
88
|
project_id=self.project_id,
|
|
75
89
|
message_subject=self.message_subject,
|
|
76
90
|
mesasge_content=self.message_content,
|
|
91
|
+
input_structured_data=serialized_input_structured_data,
|
|
77
92
|
)
|
|
78
93
|
|
|
79
94
|
@property
|
|
80
95
|
def files_(self):
|
|
81
96
|
return self._define_files()
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class GetDocumentsRequest(BaseModel):
|
|
100
|
+
organization_id: str | None = None
|
|
101
|
+
project_id: str | None = None
|
|
102
|
+
start_date: datetime | None = None
|
|
103
|
+
end_date: datetime | None = None
|
|
104
|
+
query: str | None = None
|
|
105
|
+
include_statuses: List[DocumentStatuses] | None = None
|
|
106
|
+
limit: int = 50
|
|
@@ -13,7 +13,7 @@ gui_requirements = get_requirements("./clerk/gui_automation")
|
|
|
13
13
|
|
|
14
14
|
setup(
|
|
15
15
|
name="clerk-sdk",
|
|
16
|
-
version="0.4.
|
|
16
|
+
version="0.4.2",
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|