craft-ai-sdk 0.66.0__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.

Files changed (33) hide show
  1. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/PKG-INFO +1 -1
  2. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/__init__.py +1 -1
  3. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/endpoints.py +18 -8
  4. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/sdk.py +2 -1
  5. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/authentication.py +11 -1
  6. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/documentation.pdf +0 -0
  7. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/pyproject.toml +1 -1
  8. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/LICENSE +0 -0
  9. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/README.md +0 -0
  10. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/constants.py +0 -0
  11. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/data_store.py +0 -0
  12. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/deployments.py +0 -0
  13. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/environment_variables.py +0 -0
  14. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/pipeline_executions.py +0 -0
  15. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/pipeline_metrics.py +0 -0
  16. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/pipelines.py +0 -0
  17. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/resource_metrics.py +0 -0
  18. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/steps.py +0 -0
  19. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/users.py +0 -0
  20. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/core/vector_database.py +0 -0
  21. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/exceptions.py +0 -0
  22. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/io.py +0 -0
  23. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/environments.py +0 -0
  24. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/execution_context.py +0 -0
  25. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/helpers.py +0 -0
  26. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/logger.py +0 -0
  27. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/request_response_handler.py +0 -0
  28. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/types.py +0 -0
  29. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/shared/warnings.py +0 -0
  30. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/utils/__init__.py +0 -0
  31. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/utils/datetime_utils.py +0 -0
  32. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/utils/dict_utils.py +0 -0
  33. {craft_ai_sdk-0.66.0 → craft_ai_sdk-0.66.1rc1}/craft_ai_sdk/utils/file_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: craft-ai-sdk
3
- Version: 0.66.0
3
+ Version: 0.66.1rc1
4
4
  Summary: Craft AI MLOps platform SDK
5
5
  License: Apache-2.0
6
6
  Author: Craft AI
@@ -13,4 +13,4 @@ from .io import ( # noqa: F401
13
13
  )
14
14
  from .sdk import CraftAiSdk # noqa: F401
15
15
 
16
- __version__ = "0.66.0"
16
+ __version__ = "0.66.1rc1"
@@ -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
- body = {}
94
- files = {}
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
- files[input_name] = input_value
98
+ artifacts[input_name] = input_value
98
99
  else:
99
- body[input_name] = input_value
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=body,
111
- files=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=body,
125
- files=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.0" # Would be better to share it somewhere
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
- def use_authentication(action_func: Callable[..., Response]) -> Callable[..., Response]:
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "craft-ai-sdk"
3
- version = "0.66.0"
3
+ version = "0.66.1rc1"
4
4
  description = "Craft AI MLOps platform SDK"
5
5
  license = "Apache-2.0"
6
6
  authors = ["Craft AI <contact@craft.ai>"]
File without changes