craft-ai-sdk 0.61.1__tar.gz → 0.62.0rc1__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.61.1 → craft_ai_sdk-0.62.0rc1}/PKG-INFO +2 -1
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/__init__.py +1 -1
- craft_ai_sdk-0.62.0rc1/craft_ai_sdk/core/vector_database.py +62 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/sdk.py +6 -2
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/documentation.pdf +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/pyproject.toml +7 -1
- craft_ai_sdk-0.61.1/craft_ai_sdk/core/vector_database.py +0 -21
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/LICENSE +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/README.md +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/constants.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/core/data_store.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/core/deployments.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/core/endpoints.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/core/environment_variables.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/core/pipeline_executions.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/core/pipeline_metrics.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/core/pipelines.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/core/resource_metrics.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/core/steps.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/core/users.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/exceptions.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/io.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/shared/authentication.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/shared/environments.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/shared/execution_context.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/shared/helpers.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/shared/logger.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/shared/request_response_handler.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/shared/warnings.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/utils/__init__.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/utils/datetime_utils.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/utils/dict_utils.py +0 -0
- {craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/craft_ai_sdk/utils/file_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: craft-ai-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.62.0rc1
|
|
4
4
|
Summary: Craft AI MLOps platform SDK
|
|
5
5
|
Home-page: https://www.craft.ai/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Provides-Extra: full
|
|
16
17
|
Requires-Dist: PyJWT (>=2.3.0,<3.0.0)
|
|
17
18
|
Requires-Dist: StrEnum (>=0.4.9,<0.5.0)
|
|
18
19
|
Requires-Dist: requests (>=2.27.1,<3.0.0)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from craft_ai_sdk.shared.environments import get_environment_id
|
|
2
|
+
|
|
3
|
+
from ..sdk import BaseCraftAiSdk
|
|
4
|
+
from ..shared.logger import log_action, log_func_result
|
|
5
|
+
|
|
6
|
+
import weaviate
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_vector_database_credentials(sdk: BaseCraftAiSdk):
|
|
10
|
+
"""Get the credentials of the vector database.
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
:obj:`dict`: The vector database credentials, with the following keys:
|
|
14
|
+
* ``"vector_database_url"`` (:obj:`str`): URL of the vector database.
|
|
15
|
+
* ``"vector_database_token"`` (:obj:`str`): Token to connect to the vector
|
|
16
|
+
database.
|
|
17
|
+
"""
|
|
18
|
+
environment_id = get_environment_id(sdk)
|
|
19
|
+
|
|
20
|
+
vector_database_url = (
|
|
21
|
+
f"{sdk.base_control_api_url}/environments/{environment_id}/vector-database"
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
return sdk._get(vector_database_url)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@log_func_result("Connecting to Weaviate")
|
|
28
|
+
def get_weaviate_client(sdk: BaseCraftAiSdk):
|
|
29
|
+
"""Get the Weaviate client.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
:obj:`weaviate.WeaviateClient`: The Weaviate client.
|
|
33
|
+
"""
|
|
34
|
+
credentials = get_vector_database_credentials(sdk)
|
|
35
|
+
|
|
36
|
+
is_secure = credentials["vector_database_url"].startswith("https://")
|
|
37
|
+
|
|
38
|
+
vector_database_url = (
|
|
39
|
+
credentials["vector_database_url"]
|
|
40
|
+
.replace("http://", "")
|
|
41
|
+
.replace("https://", "")
|
|
42
|
+
).rstrip("/")
|
|
43
|
+
|
|
44
|
+
log_action(sdk, "Connecting to Weaviate")
|
|
45
|
+
|
|
46
|
+
weaviate_client = weaviate.connect_to_custom(
|
|
47
|
+
http_host=vector_database_url,
|
|
48
|
+
http_port=8080,
|
|
49
|
+
grpc_host=vector_database_url,
|
|
50
|
+
grpc_port=8082,
|
|
51
|
+
http_secure=is_secure,
|
|
52
|
+
grpc_secure=is_secure,
|
|
53
|
+
headers={
|
|
54
|
+
"craft-vector-database-token": credentials["vector_database_token"],
|
|
55
|
+
"craft-vector-database-url": credentials["vector_database_url"],
|
|
56
|
+
},
|
|
57
|
+
auth_credentials=None,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
log_action(sdk, "Connected to Weaviate, using version", weaviate.__version__)
|
|
61
|
+
|
|
62
|
+
return weaviate_client
|
|
@@ -116,7 +116,11 @@ class CraftAiSdk(BaseCraftAiSdk):
|
|
|
116
116
|
list_steps,
|
|
117
117
|
)
|
|
118
118
|
from .core.users import get_user
|
|
119
|
-
|
|
119
|
+
|
|
120
|
+
from .core.vector_database import (
|
|
121
|
+
get_vector_database_credentials,
|
|
122
|
+
get_weaviate_client,
|
|
123
|
+
)
|
|
120
124
|
|
|
121
125
|
# Size (in bytes) from which datastore upload will switch to multipart
|
|
122
126
|
# AWS: minimum part size is 5MiB
|
|
@@ -132,7 +136,7 @@ class CraftAiSdk(BaseCraftAiSdk):
|
|
|
132
136
|
os.environ.get("CRAFT_AI__MULTIPART_PART_SIZE__B", str(38 * 256 * 1024))
|
|
133
137
|
)
|
|
134
138
|
_access_token_margin = timedelta(seconds=30)
|
|
135
|
-
_version = "0.
|
|
139
|
+
_version = "0.62.0rc1" # Would be better to share it somewhere
|
|
136
140
|
|
|
137
141
|
def __init__(
|
|
138
142
|
self,
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "craft-ai-sdk"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.62.0rc1"
|
|
4
4
|
description = "Craft AI MLOps platform SDK"
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
authors = ["Craft AI <contact@craft.ai>"]
|
|
@@ -30,6 +30,9 @@ requests = "^2.27.1"
|
|
|
30
30
|
PyJWT = "^2.3.0"
|
|
31
31
|
StrEnum = "^0.4.9"
|
|
32
32
|
|
|
33
|
+
[tool.poetry.group.weaviate.dependencies]
|
|
34
|
+
weaviate-client = { version = "^4.10.4" }
|
|
35
|
+
|
|
33
36
|
[tool.poetry.group.dev.dependencies]
|
|
34
37
|
ipython = "^8.18.1"
|
|
35
38
|
ipykernel = "^6.29.5"
|
|
@@ -48,6 +51,9 @@ doc8 = "^0.10.1"
|
|
|
48
51
|
Sphinx = "^5.0.1"
|
|
49
52
|
sphinxcontrib-restbuilder = "^0.3"
|
|
50
53
|
|
|
54
|
+
[tool.poetry.extras]
|
|
55
|
+
full = ["weaviate-client"]
|
|
56
|
+
|
|
51
57
|
[build-system]
|
|
52
58
|
requires = ["poetry-core>=1.0.0"]
|
|
53
59
|
build-backend = "poetry.core.masonry.api"
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from craft_ai_sdk.shared.environments import get_environment_id
|
|
2
|
-
|
|
3
|
-
from ..sdk import BaseCraftAiSdk
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def get_vector_database_credentials(sdk: BaseCraftAiSdk):
|
|
7
|
-
"""Get the credentials of the vector database.
|
|
8
|
-
|
|
9
|
-
Returns:
|
|
10
|
-
:obj:`dict`: The vector database credentials, with the following keys:
|
|
11
|
-
* ``"vector_database_url"`` (:obj:`str`): URL of the vector database.
|
|
12
|
-
* ``"vector_database_token"`` (:obj:`str`): Token to connect to the vector
|
|
13
|
-
database.
|
|
14
|
-
"""
|
|
15
|
-
environment_id = get_environment_id(sdk)
|
|
16
|
-
|
|
17
|
-
vector_database_url = (
|
|
18
|
-
f"{sdk.base_control_api_url}/environments/{environment_id}/vector-database"
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
return sdk._get(vector_database_url)
|
|
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
|
{craft_ai_sdk-0.61.1 → craft_ai_sdk-0.62.0rc1}/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
|