codemie-sdk-python 0.1.199__py3-none-any.whl → 0.1.201__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.
Potentially problematic release.
This version of codemie-sdk-python might be problematic. Click here for more details.
- codemie_sdk/client/client.py +4 -0
- codemie_sdk/models/file_operation.py +25 -0
- codemie_sdk/models/workflow_execution_payload.py +17 -0
- codemie_sdk/services/files.py +61 -0
- codemie_sdk/services/workflow.py +17 -2
- codemie_sdk/services/workflow_execution.py +11 -4
- {codemie_sdk_python-0.1.199.dist-info → codemie_sdk_python-0.1.201.dist-info}/METADATA +1 -1
- {codemie_sdk_python-0.1.199.dist-info → codemie_sdk_python-0.1.201.dist-info}/RECORD +9 -6
- {codemie_sdk_python-0.1.199.dist-info → codemie_sdk_python-0.1.201.dist-info}/WHEEL +0 -0
codemie_sdk/client/client.py
CHANGED
|
@@ -11,6 +11,7 @@ from ..services.integration import IntegrationService
|
|
|
11
11
|
from ..services.task import TaskService
|
|
12
12
|
from ..services.user import UserService
|
|
13
13
|
from ..services.workflow import WorkflowService
|
|
14
|
+
from ..services.files import FileOperationService
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class CodeMieClient:
|
|
@@ -81,6 +82,9 @@ class CodeMieClient:
|
|
|
81
82
|
self.conversations = ConversationService(
|
|
82
83
|
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
83
84
|
)
|
|
85
|
+
self.files = FileOperationService(
|
|
86
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
87
|
+
)
|
|
84
88
|
|
|
85
89
|
@property
|
|
86
90
|
def token(self) -> str:
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""File operation models."""
|
|
2
|
+
|
|
3
|
+
from typing import Optional, List, Any, Dict
|
|
4
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class FileResponse(BaseModel):
|
|
8
|
+
"""Individual file response model."""
|
|
9
|
+
|
|
10
|
+
model_config = ConfigDict(extra="ignore")
|
|
11
|
+
|
|
12
|
+
file_url: str = Field(..., description="URL or identifier for the uploaded file")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class FileBulkCreateResponse(BaseModel):
|
|
16
|
+
"""Response model for bulk file creation."""
|
|
17
|
+
|
|
18
|
+
model_config = ConfigDict(extra="ignore")
|
|
19
|
+
|
|
20
|
+
files: List[FileResponse] = Field(
|
|
21
|
+
..., description="List of successfully uploaded files with their URLs"
|
|
22
|
+
)
|
|
23
|
+
failed_files: Optional[List[Dict[str, Any]]] = Field(
|
|
24
|
+
None, description="List of files that failed to upload, null if no failures"
|
|
25
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Workflow execution payload models."""
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class WorkflowExecutionCreateRequest(BaseModel):
|
|
8
|
+
"""Request model for workflow execution creation."""
|
|
9
|
+
|
|
10
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
11
|
+
|
|
12
|
+
user_input: Optional[str] = Field(
|
|
13
|
+
None, description="User input for the workflow execution"
|
|
14
|
+
)
|
|
15
|
+
file_name: Optional[str] = Field(
|
|
16
|
+
None, description="File name associated with the workflow execution"
|
|
17
|
+
)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""File operation service implementation."""
|
|
2
|
+
|
|
3
|
+
import mimetypes
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import List
|
|
6
|
+
|
|
7
|
+
from ..models.file_operation import FileBulkCreateResponse
|
|
8
|
+
from ..utils import ApiRequestHandler
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class FileOperationService:
|
|
12
|
+
"""Service for managing file operations."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, api_domain: str, token: str, verify_ssl: bool = True):
|
|
15
|
+
"""Initialize the file operation service.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
api_domain: Base URL for the CodeMie API
|
|
19
|
+
token: Authentication token
|
|
20
|
+
verify_ssl: Whether to verify SSL certificates
|
|
21
|
+
"""
|
|
22
|
+
self._api = ApiRequestHandler(api_domain, token, verify_ssl)
|
|
23
|
+
|
|
24
|
+
def bulk_upload(self, files: List[Path]) -> FileBulkCreateResponse:
|
|
25
|
+
"""Upload multiple files in a single operation.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
files: List of File paths (required)
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
FileBulkCreateResponse: Results of the bulk operation including
|
|
32
|
+
|
|
33
|
+
Raises:
|
|
34
|
+
ValueError: If items in files is not a Path
|
|
35
|
+
ApiError: If bulk creation fails or validation errors occur
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
files_to_upload = []
|
|
39
|
+
|
|
40
|
+
for file_path in files:
|
|
41
|
+
if isinstance(file_path, Path):
|
|
42
|
+
# File path provided - read file and detect MIME type
|
|
43
|
+
with open(file_path, "rb") as file:
|
|
44
|
+
content = file.read()
|
|
45
|
+
|
|
46
|
+
# Basic MIME type detection
|
|
47
|
+
mime_type = (
|
|
48
|
+
mimetypes.guess_type(file_path.name)[0]
|
|
49
|
+
or "application/octet-stream"
|
|
50
|
+
)
|
|
51
|
+
files_to_upload.append(("files", (file_path.name, content, mime_type)))
|
|
52
|
+
else:
|
|
53
|
+
raise ValueError("Each item in list must be a Path")
|
|
54
|
+
|
|
55
|
+
response = self._api.post_multipart(
|
|
56
|
+
"/v1/files/bulk",
|
|
57
|
+
files=files_to_upload,
|
|
58
|
+
response_model=FileBulkCreateResponse,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
return response
|
codemie_sdk/services/workflow.py
CHANGED
|
@@ -130,8 +130,23 @@ class WorkflowService:
|
|
|
130
130
|
"""
|
|
131
131
|
return self._api.delete(f"/v1/workflows/{workflow_id}", dict)
|
|
132
132
|
|
|
133
|
-
def run(
|
|
134
|
-
|
|
133
|
+
def run(
|
|
134
|
+
self,
|
|
135
|
+
workflow_id: str,
|
|
136
|
+
user_input: Optional[str] = None,
|
|
137
|
+
file_name: Optional[str] = None,
|
|
138
|
+
) -> dict:
|
|
139
|
+
"""Run a workflow with optional input parameters.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
workflow_id: ID of the workflow to run
|
|
143
|
+
user_input: Optional user input for the workflow execution
|
|
144
|
+
file_name: Optional file name for the workflow execution
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
dict: Created workflow execution details
|
|
148
|
+
"""
|
|
149
|
+
return self.executions(workflow_id).create(user_input, file_name)
|
|
135
150
|
|
|
136
151
|
def executions(self, workflow_id: str) -> WorkflowExecutionService:
|
|
137
152
|
"""Get workflow execution service for the specified workflow.
|
|
@@ -4,6 +4,7 @@ from typing import List, Optional
|
|
|
4
4
|
|
|
5
5
|
from ..models.common import PaginationParams
|
|
6
6
|
from ..models.workflow import WorkflowExecution
|
|
7
|
+
from ..models.workflow_execution_payload import WorkflowExecutionCreateRequest
|
|
7
8
|
from ..models.workflow_thoughts import WorkflowExecutionThought
|
|
8
9
|
from .workflow_execution_state import WorkflowExecutionStateService
|
|
9
10
|
from ..utils import ApiRequestHandler
|
|
@@ -44,19 +45,25 @@ class WorkflowExecutionService:
|
|
|
44
45
|
params=params,
|
|
45
46
|
)
|
|
46
47
|
|
|
47
|
-
def create(
|
|
48
|
+
def create(
|
|
49
|
+
self, user_input: Optional[str] = None, file_name: Optional[str] = None
|
|
50
|
+
) -> dict:
|
|
48
51
|
"""Create a new workflow execution.
|
|
49
52
|
|
|
50
53
|
Args:
|
|
51
54
|
user_input: Optional input data for the workflow execution.
|
|
52
|
-
|
|
55
|
+
file_name: Optional file name associated with the workflow execution.
|
|
53
56
|
|
|
54
57
|
Returns:
|
|
55
58
|
dict: Created workflow execution details
|
|
56
59
|
"""
|
|
57
|
-
payload =
|
|
60
|
+
payload = WorkflowExecutionCreateRequest(
|
|
61
|
+
user_input=user_input, file_name=file_name
|
|
62
|
+
)
|
|
58
63
|
return self._api.post(
|
|
59
|
-
f"/v1/workflows/{self._workflow_id}/executions",
|
|
64
|
+
f"/v1/workflows/{self._workflow_id}/executions",
|
|
65
|
+
dict,
|
|
66
|
+
json_data=payload.model_dump(),
|
|
60
67
|
)
|
|
61
68
|
|
|
62
69
|
def get(self, execution_id: str) -> WorkflowExecution:
|
|
@@ -2,32 +2,35 @@ codemie_sdk/__init__.py,sha256=leeACpTc2113BsY_IgO-ceFHPrQKC2WhuOfuuyyIqDE,567
|
|
|
2
2
|
codemie_sdk/auth/__init__.py,sha256=IksEj223xEZtJ-cQ0AT9L0Bs9psIJ8QNzDXrPTUQ3xQ,126
|
|
3
3
|
codemie_sdk/auth/credentials.py,sha256=OzR_CXPBNTEC6VmNdzcCHF7rWWGrVf3agAlGKgPtTiU,4361
|
|
4
4
|
codemie_sdk/client/__init__.py,sha256=yf6C39MmrJ6gK9ZHMhBeynKwUUYVSUTQbKxU8-4qpKg,101
|
|
5
|
-
codemie_sdk/client/client.py,sha256=
|
|
5
|
+
codemie_sdk/client/client.py,sha256=kEXMztYJr3Ti1soZuAz1IxMgeLqiwLgBHWIL3PqVqfw,5348
|
|
6
6
|
codemie_sdk/exceptions.py,sha256=XoVPyognx-JmyVxLHkZPAcX1CMi1OoT1diBFJLU54so,1183
|
|
7
7
|
codemie_sdk/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
codemie_sdk/models/assistant.py,sha256=zb_k9EZ7rVFD7T2BwSqu_UA0psLKn7VHbY6JB6SyMOo,10946
|
|
9
9
|
codemie_sdk/models/common.py,sha256=gmZ-ps8TbaieNKr0kUKoQEjhVrHD2CAYomOpZQRatH8,1195
|
|
10
10
|
codemie_sdk/models/conversation.py,sha256=tGlqtVnoRCbTm8J8Y1BUmBvMpLW3IRFE0CIHJYoNU_Y,4238
|
|
11
11
|
codemie_sdk/models/datasource.py,sha256=yCFB_wg9Lo2V6mzF2N3lsVBXJoyc8pyfMgMZUorn0ng,10852
|
|
12
|
+
codemie_sdk/models/file_operation.py,sha256=D2hnsxOO9lzVMw0BNCgKPfHf28bWQmbw5rccgaTXI90,747
|
|
12
13
|
codemie_sdk/models/integration.py,sha256=IxTbbyEHsD8HWWFDtZDoWuE1ZwR9wwiBk3XUwlf1KZI,2328
|
|
13
14
|
codemie_sdk/models/llm.py,sha256=ppb9-1dx1UFhRuJpSR3ij7H6Pfhe9nO4C4BEOIbToy4,1192
|
|
14
15
|
codemie_sdk/models/task.py,sha256=J4ZFRY3s8qBGrqB5NLQF0rMbInLh4s7OEZ0ZfmnW0Ho,1476
|
|
15
16
|
codemie_sdk/models/user.py,sha256=Q0rjimZh-IbeaPfq6b6fk6ZaCtwLqWHEIlU863suCS4,1777
|
|
16
17
|
codemie_sdk/models/workflow.py,sha256=qfk0rBJnFUMpcEDq_E5GB3hzYKbe_bb2NYJlLZJwUEE,2453
|
|
18
|
+
codemie_sdk/models/workflow_execution_payload.py,sha256=iEGkdw1jm09aniZiXswbQeLtoiUYIxhc3vsBvZL00JE,515
|
|
17
19
|
codemie_sdk/models/workflow_state.py,sha256=okEMKzkiBU3GHs9VNBoiEMOnOeZRMXGYtpL0NYSg-FY,1374
|
|
18
20
|
codemie_sdk/models/workflow_thoughts.py,sha256=CjHaIPgca9kQAjpoq8IpX4MuDeql1SvaoKS5RmyU2SE,616
|
|
19
21
|
codemie_sdk/services/assistant.py,sha256=BsTR_uoPoZtta6icfw2M0Ea6w2VIhYndDUVqsHJuZJo,7888
|
|
20
22
|
codemie_sdk/services/conversation.py,sha256=Ss0mkGaBi4u8-YKzhRYUJOfoFqJueDp9JurI5DRCGT8,2566
|
|
21
23
|
codemie_sdk/services/datasource.py,sha256=d8LImpireGOnXKvj4h8iafq_ZQMn177_GGLLiE5g7wU,7405
|
|
24
|
+
codemie_sdk/services/files.py,sha256=MKLJEv208yUkeRO2JfC4XWPeJ4TKg5ZGaxaBU5GXzoM,1955
|
|
22
25
|
codemie_sdk/services/integration.py,sha256=SdwFwR3hCPyJYilzzlkpKPLNbO89nfqmIXXoT7bDEBI,5410
|
|
23
26
|
codemie_sdk/services/llm.py,sha256=0-e4_7RvLHs2giCyoQ5U4KDTh6p5VXgPKNxnDP9ZDFU,1100
|
|
24
27
|
codemie_sdk/services/task.py,sha256=3e9t8_LMkR4xfeMBwMCo7ZF87PxPS-ZbzDg85ilda2M,1031
|
|
25
28
|
codemie_sdk/services/user.py,sha256=7B-Qw451qKPD5Io6qLda-kbFDaPRQ3TamJamiGwCQu4,1013
|
|
26
|
-
codemie_sdk/services/workflow.py,sha256=
|
|
27
|
-
codemie_sdk/services/workflow_execution.py,sha256=
|
|
29
|
+
codemie_sdk/services/workflow.py,sha256=cAGv2jEnb3dOSk5xxqg3L15mTcSkAVxaZHVZwTYjT-w,5407
|
|
30
|
+
codemie_sdk/services/workflow_execution.py,sha256=P57fz3fsUnKLg8qUYszMxCn_ykovh22BQuUk0EGnC9I,4654
|
|
28
31
|
codemie_sdk/services/workflow_execution_state.py,sha256=tXoaa8yT09xgYEUNiHhVULe76TwGwVgZupMIUyyLxdo,2070
|
|
29
32
|
codemie_sdk/utils/__init__.py,sha256=BXAJJfAzO89-kMYvWWo9wSNhSbGgF3vB1In9sePFhMM,109
|
|
30
33
|
codemie_sdk/utils/http.py,sha256=ZtXb-hlwqXmjSTKRncgO-9MYoXnmHt2Dljno0kPy7mA,9506
|
|
31
|
-
codemie_sdk_python-0.1.
|
|
32
|
-
codemie_sdk_python-0.1.
|
|
33
|
-
codemie_sdk_python-0.1.
|
|
34
|
+
codemie_sdk_python-0.1.201.dist-info/METADATA,sha256=D1b21D4ExSKWNq3jEKxOhZYYFat6temEKVBN7KV459I,24494
|
|
35
|
+
codemie_sdk_python-0.1.201.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
36
|
+
codemie_sdk_python-0.1.201.dist-info/RECORD,,
|
|
File without changes
|