craft-ai-sdk 0.66.0rc1__tar.gz → 0.66.1rc1__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.
Potentially problematic release.
This version of craft-ai-sdk might be problematic. Click here for more details.
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/PKG-INFO +1 -1
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/__init__.py +1 -1
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/endpoints.py +18 -8
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/sdk.py +2 -1
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/authentication.py +11 -1
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/documentation.pdf +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/pyproject.toml +1 -1
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/LICENSE +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/README.md +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/constants.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/data_store.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/deployments.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/environment_variables.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/pipeline_executions.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/pipeline_metrics.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/pipelines.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/resource_metrics.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/steps.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/users.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/vector_database.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/exceptions.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/io.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/environments.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/execution_context.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/helpers.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/logger.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/request_response_handler.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/types.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/warnings.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/utils/__init__.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/utils/datetime_utils.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/utils/dict_utils.py +0 -0
- {craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/utils/file_utils.py +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import io
|
|
2
|
+
import json
|
|
2
3
|
from typing import Any, Literal, TypedDict, Union, overload
|
|
3
4
|
from urllib.parse import urlencode
|
|
4
5
|
|
|
@@ -90,13 +91,20 @@ def trigger_endpoint(
|
|
|
90
91
|
if inputs is None:
|
|
91
92
|
inputs = {}
|
|
92
93
|
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
parameters = {}
|
|
95
|
+
artifacts = {}
|
|
95
96
|
for input_name, input_value in inputs.items():
|
|
96
97
|
if isinstance(input_value, io.IOBase) and input_value.readable():
|
|
97
|
-
|
|
98
|
+
artifacts[input_name] = input_value
|
|
98
99
|
else:
|
|
99
|
-
|
|
100
|
+
parameters[input_name] = input_value
|
|
101
|
+
|
|
102
|
+
data = None
|
|
103
|
+
# When using both files and parameters, parameters should
|
|
104
|
+
# be passed through `data` instead
|
|
105
|
+
if len(parameters) > 0 and len(artifacts) > 0:
|
|
106
|
+
data = {key: json.dumps(value) for key, value in parameters.items()}
|
|
107
|
+
parameters = None
|
|
100
108
|
|
|
101
109
|
if endpoint_token is None:
|
|
102
110
|
url = f"{sdk.base_environment_api_url}/deployments/{endpoint_name}/executions"
|
|
@@ -107,8 +115,9 @@ def trigger_endpoint(
|
|
|
107
115
|
sdk,
|
|
108
116
|
url,
|
|
109
117
|
allow_redirects=False,
|
|
110
|
-
json=
|
|
111
|
-
files=
|
|
118
|
+
json=parameters,
|
|
119
|
+
files=artifacts,
|
|
120
|
+
data=data,
|
|
112
121
|
)
|
|
113
122
|
|
|
114
123
|
else:
|
|
@@ -121,8 +130,9 @@ def trigger_endpoint(
|
|
|
121
130
|
"craft-ai-client": f"craft-ai-sdk@{sdk._version}",
|
|
122
131
|
},
|
|
123
132
|
allow_redirects=False,
|
|
124
|
-
json=
|
|
125
|
-
files=
|
|
133
|
+
json=parameters,
|
|
134
|
+
files=artifacts,
|
|
135
|
+
data=data,
|
|
126
136
|
)
|
|
127
137
|
response = handle_http_response(post_result)
|
|
128
138
|
execution_id = response.get("execution_id", "")
|
|
@@ -23,6 +23,7 @@ class BaseCraftAiSdk(ABC):
|
|
|
23
23
|
_MULTIPART_THRESHOLD: int
|
|
24
24
|
_MULTIPART_PART_SIZE: int
|
|
25
25
|
_version: str
|
|
26
|
+
_session: requests.Session
|
|
26
27
|
warn_on_metric_outside_of_step: bool
|
|
27
28
|
|
|
28
29
|
@abstractmethod
|
|
@@ -138,7 +139,7 @@ class CraftAiSdk(BaseCraftAiSdk):
|
|
|
138
139
|
os.environ.get("CRAFT_AI__MULTIPART_PART_SIZE__B", str(38 * 256 * 1024))
|
|
139
140
|
)
|
|
140
141
|
_access_token_margin = timedelta(seconds=30)
|
|
141
|
-
_version = "0.66.
|
|
142
|
+
_version = "0.66.1rc1" # Would be better to share it somewhere
|
|
142
143
|
|
|
143
144
|
def __init__(
|
|
144
145
|
self,
|
|
@@ -3,9 +3,19 @@ from datetime import datetime
|
|
|
3
3
|
from typing import Callable
|
|
4
4
|
|
|
5
5
|
from requests import Response
|
|
6
|
+
from typing_extensions import Concatenate, ParamSpec
|
|
6
7
|
|
|
8
|
+
import craft_ai_sdk.sdk as sdk
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
Args = ParamSpec("Args")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def use_authentication(
|
|
14
|
+
action_func: Callable[
|
|
15
|
+
Concatenate["sdk.BaseCraftAiSdk", Args],
|
|
16
|
+
Response,
|
|
17
|
+
],
|
|
18
|
+
) -> Callable[..., Response]:
|
|
9
19
|
@functools.wraps(action_func)
|
|
10
20
|
def wrapper(sdk, *args, headers=None, **kwargs):
|
|
11
21
|
actual_headers = None
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/environment_variables.py
RENAMED
|
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
|
{craft_ai_sdk-0.66.0rc1 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/request_response_handler.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|