luml-api 0.1.0rc0__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 luml-api might be problematic. Click here for more details.
- luml_api-0.1.0rc0/.gitignore +23 -0
- luml_api-0.1.0rc0/.python-version +1 -0
- luml_api-0.1.0rc0/PKG-INFO +10 -0
- luml_api-0.1.0rc0/README.md +0 -0
- luml_api-0.1.0rc0/examples/async_demo.py +244 -0
- luml_api-0.1.0rc0/examples/demo.py +242 -0
- luml_api-0.1.0rc0/luml_api/__init__.py +51 -0
- luml_api-0.1.0rc0/luml_api/_base_client.py +268 -0
- luml_api-0.1.0rc0/luml_api/_client.py +589 -0
- luml_api-0.1.0rc0/luml_api/_exceptions.py +203 -0
- luml_api-0.1.0rc0/luml_api/_types.py +257 -0
- luml_api-0.1.0rc0/luml_api/_utils.py +21 -0
- luml_api-0.1.0rc0/luml_api/handlers/__init__.py +0 -0
- luml_api-0.1.0rc0/luml_api/handlers/azure_file_handler.py +139 -0
- luml_api-0.1.0rc0/luml_api/handlers/base_file_handler.py +126 -0
- luml_api-0.1.0rc0/luml_api/handlers/file_handler_factory.py +15 -0
- luml_api-0.1.0rc0/luml_api/handlers/model_artifacts.py +121 -0
- luml_api-0.1.0rc0/luml_api/handlers/s3_file_handler.py +166 -0
- luml_api-0.1.0rc0/luml_api/py.typed +0 -0
- luml_api-0.1.0rc0/luml_api/resources/__init__.py +0 -0
- luml_api-0.1.0rc0/luml_api/resources/_listed_resource.py +60 -0
- luml_api-0.1.0rc0/luml_api/resources/_validators.py +42 -0
- luml_api-0.1.0rc0/luml_api/resources/artifacts.py +2054 -0
- luml_api-0.1.0rc0/luml_api/resources/bucket_secrets.py +820 -0
- luml_api-0.1.0rc0/luml_api/resources/collections.py +895 -0
- luml_api-0.1.0rc0/luml_api/resources/orbits.py +576 -0
- luml_api-0.1.0rc0/luml_api/resources/organizations.py +219 -0
- luml_api-0.1.0rc0/luml_api/services/__init__.py +0 -0
- luml_api-0.1.0rc0/luml_api/services/upload_service.py +98 -0
- luml_api-0.1.0rc0/pyproject.toml +88 -0
- luml_api-0.1.0rc0/pytest.ini +21 -0
- luml_api-0.1.0rc0/tests/__init__.py +0 -0
- luml_api-0.1.0rc0/tests/conftest.py +180 -0
- luml_api-0.1.0rc0/tests/unit/__init__.py +0 -0
- luml_api-0.1.0rc0/tests/unit/test_bucket_resource.py +243 -0
- luml_api-0.1.0rc0/tests/unit/test_client.py +107 -0
- luml_api-0.1.0rc0/tests/unit/test_collection_resource.py +384 -0
- luml_api-0.1.0rc0/tests/unit/test_model_artifact_resource.py +380 -0
- luml_api-0.1.0rc0/tests/unit/test_orbit_resource.py +233 -0
- luml_api-0.1.0rc0/tests/unit/test_organization_resources.py +118 -0
- luml_api-0.1.0rc0/uv.lock +1079 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
wasm/packages/dfs_webworker/dfs_webworker/prompt_optimization/serialization/__fnnx_autogen_content.py
|
|
2
|
+
wasm/test_*.py
|
|
3
|
+
/backend/.env
|
|
4
|
+
/.idea/.gitignore
|
|
5
|
+
/backend/.coverage
|
|
6
|
+
/backend/luml/factories/
|
|
7
|
+
/.gitignore
|
|
8
|
+
__pycache__/
|
|
9
|
+
*.py[cod]
|
|
10
|
+
.DS_Store
|
|
11
|
+
/sdk/python/venv/
|
|
12
|
+
/.idea/
|
|
13
|
+
/satellite/.env
|
|
14
|
+
/lumlflow/.idea
|
|
15
|
+
/lumlflow/frontend/node_modules
|
|
16
|
+
/lumlflow/frontend/dist
|
|
17
|
+
/lumlflow/lumlflow/static
|
|
18
|
+
/sdk/python/sdk_docs_generate.py
|
|
19
|
+
node_modules
|
|
20
|
+
/lumlflow/.idea/
|
|
21
|
+
/lumlflow/.env
|
|
22
|
+
/sdk/python/api/.venv/
|
|
23
|
+
/sdk/python/sdk/.venv/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: luml-api
|
|
3
|
+
Version: 0.1.0rc0
|
|
4
|
+
Summary: LUML Python API Client
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Requires-Dist: cloudpickle<4.0.0,>=3.1.2
|
|
7
|
+
Requires-Dist: fnnx<0.1.0,>=0.0.8
|
|
8
|
+
Requires-Dist: httpx<1.0.0,>=0.28.1
|
|
9
|
+
Requires-Dist: pydantic<3.0.0,>=2.11.7
|
|
10
|
+
Requires-Dist: pyfnx-utils<1.0.0,>=0.0.1
|
|
File without changes
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# ruff: noqa: T201
|
|
2
|
+
import asyncio
|
|
3
|
+
|
|
4
|
+
from luml_api import AsyncLumlClient
|
|
5
|
+
from luml_api._types import CollectionType, ModelArtifactStatus
|
|
6
|
+
|
|
7
|
+
# Will use Luml API Production url "https://api.luml.ai"
|
|
8
|
+
# And search for LUML_API_KEY in .env
|
|
9
|
+
luml_simple = AsyncLumlClient()
|
|
10
|
+
|
|
11
|
+
# No default organization, orbit and collection are set
|
|
12
|
+
luml = AsyncLumlClient(api_key="luml_your_api_key_here")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
async def demo_client_defaults() -> None:
|
|
16
|
+
# Set up defaults
|
|
17
|
+
await luml.setup_config(
|
|
18
|
+
organization="0199c455-21ec-7c74-8efe-41470e29bae5",
|
|
19
|
+
orbit="0199c455-21ed-7aba-9fe5-5231611220de",
|
|
20
|
+
collection="0199c455-21ee-74c6-b747-19a82f1a1e75",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# Get client defaults ids
|
|
24
|
+
default_organization_id = luml.organization
|
|
25
|
+
default_orbit_id = luml.orbit
|
|
26
|
+
default_collection_id = luml.collection
|
|
27
|
+
|
|
28
|
+
print(default_organization_id, default_orbit_id, default_collection_id)
|
|
29
|
+
|
|
30
|
+
# Set default resources
|
|
31
|
+
luml.organization = "0199c455-21ec-7c74-8efe-41470e29bae5"
|
|
32
|
+
luml.orbit = "0199c455-21ed-7aba-9fe5-5231611220de"
|
|
33
|
+
luml.collection = "0199c455-21ee-74c6-b747-19a82f1a1e75"
|
|
34
|
+
|
|
35
|
+
print(luml.organization, luml.orbit, luml.collection)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
async def demo_organizations() -> None:
|
|
39
|
+
# List all available organization for user
|
|
40
|
+
all_my_organization = await luml.organizations.list()
|
|
41
|
+
print(f"All user organization: {all_my_organization}")
|
|
42
|
+
|
|
43
|
+
# Get default organization
|
|
44
|
+
default_org_details = await luml.organizations.get()
|
|
45
|
+
print(f"Default organization: {default_org_details}")
|
|
46
|
+
|
|
47
|
+
# Get organization by name
|
|
48
|
+
organization_by_name = await luml.organizations.get("My Organization")
|
|
49
|
+
print(f"Organization by name: {organization_by_name}")
|
|
50
|
+
|
|
51
|
+
# Get organization by id
|
|
52
|
+
organization_by_id = await luml.organizations.get(
|
|
53
|
+
"0199c455-21ec-7c74-8efe-41470e29bae5"
|
|
54
|
+
)
|
|
55
|
+
print(f"Organization by id: {organization_by_id}")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
async def demo_bucket_secrets() -> None:
|
|
59
|
+
# Create a new bucket secret
|
|
60
|
+
bucket_secret = await luml.bucket_secrets.create(
|
|
61
|
+
endpoint="s3.amazonaws.com",
|
|
62
|
+
bucket_name="my-ml-models-bucket",
|
|
63
|
+
access_key="AKIAIOSFODNN7EXAMPLE",
|
|
64
|
+
secret_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
65
|
+
secure=True,
|
|
66
|
+
region="us-east-1",
|
|
67
|
+
)
|
|
68
|
+
print(f"Created bucket secret: {bucket_secret}")
|
|
69
|
+
|
|
70
|
+
# List all bucket secrets
|
|
71
|
+
secrets = await luml.bucket_secrets.list()
|
|
72
|
+
print(f"Bucket secrets: {secrets}")
|
|
73
|
+
|
|
74
|
+
# Get bucket secret by name
|
|
75
|
+
secret = await luml.bucket_secrets.get("my-ml-models-bucket")
|
|
76
|
+
print(f"Bucket secret by name: {secret}")
|
|
77
|
+
|
|
78
|
+
# Get bucket secret by id
|
|
79
|
+
secret = await luml.bucket_secrets.get("0199c455-21ed-7aba-9fe5-5231611220de")
|
|
80
|
+
print(f"Bucket secret by id: {secret}")
|
|
81
|
+
|
|
82
|
+
# Update bucket secret
|
|
83
|
+
updated_secret = await luml.bucket_secrets.update(
|
|
84
|
+
secret_id=bucket_secret.id, secure=False, region="us-west-2"
|
|
85
|
+
)
|
|
86
|
+
print(f"Updated bucket secret: {updated_secret}")
|
|
87
|
+
|
|
88
|
+
# Delete bucket secret
|
|
89
|
+
await luml.bucket_secrets.delete("0199c455-21ed-7aba-9fe5-5231611220de")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
async def demo_orbits() -> None:
|
|
93
|
+
# Create a new orbit
|
|
94
|
+
orbit = await luml.orbits.create(
|
|
95
|
+
name="ML Production Orbit",
|
|
96
|
+
bucket_secret_id="0199c455-21ed-7aba-9fe5-5231611220de",
|
|
97
|
+
)
|
|
98
|
+
print(f"Created orbit: {orbit}")
|
|
99
|
+
|
|
100
|
+
# Get Orbit by name
|
|
101
|
+
orbit_by_name = await luml.orbits.get("ML Production Orbit")
|
|
102
|
+
print(f"Orbit by name: {orbit_by_name}")
|
|
103
|
+
|
|
104
|
+
# Get Orbit by id
|
|
105
|
+
orbit_by_id = await luml.orbits.get("0199c455-21ed-7aba-9fe5-5231611220de")
|
|
106
|
+
print(f"Orbit by id: {orbit_by_id}")
|
|
107
|
+
|
|
108
|
+
# List all orbits
|
|
109
|
+
orbits = await luml.orbits.list()
|
|
110
|
+
print(f"Orbits: {orbits}")
|
|
111
|
+
|
|
112
|
+
# Update orbit
|
|
113
|
+
updated_orbit = await luml.orbits.update(name="ML Production Environment")
|
|
114
|
+
print(f"Updated orbit: {updated_orbit}")
|
|
115
|
+
|
|
116
|
+
# Delete Orbit
|
|
117
|
+
await luml.orbits.delete("0199c455-21ed-7aba-9fe5-5231611220de")
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
async def demo_collections() -> None:
|
|
121
|
+
# Create a model collection
|
|
122
|
+
collection = await luml.collections.create(
|
|
123
|
+
name="Production Models",
|
|
124
|
+
description="Trained models ready for production deployment",
|
|
125
|
+
type=CollectionType.MODEL,
|
|
126
|
+
tags=["production", "ml", "models"],
|
|
127
|
+
)
|
|
128
|
+
print(f"Created collection: {collection}")
|
|
129
|
+
|
|
130
|
+
# Get default collection
|
|
131
|
+
default_collection = await luml.collections.get()
|
|
132
|
+
print(f"Get Default Collection Details: {default_collection}")
|
|
133
|
+
|
|
134
|
+
# Get collection by name
|
|
135
|
+
collection_by_name = await luml.collections.get("Production Models")
|
|
136
|
+
print(f"Collection by name: {collection_by_name}")
|
|
137
|
+
|
|
138
|
+
# Get collection by id
|
|
139
|
+
collection_by_id = await luml.collections.get(
|
|
140
|
+
"0199c455-21ee-74c6-b747-19a82f1a1e75"
|
|
141
|
+
)
|
|
142
|
+
print(f"Collection by id: {collection_by_id}")
|
|
143
|
+
|
|
144
|
+
# List all collections in the orbit
|
|
145
|
+
collections = await luml.collections.list()
|
|
146
|
+
print(f"Collection: {collections}")
|
|
147
|
+
|
|
148
|
+
# Update collection with new tags
|
|
149
|
+
updated_collection = await luml.collections.update(
|
|
150
|
+
collection_id="0199c455-21ee-74c6-b747-19a82f1a1e75",
|
|
151
|
+
description="Updated: Production-ready ML models",
|
|
152
|
+
)
|
|
153
|
+
print(f"Updated collection: {updated_collection}")
|
|
154
|
+
|
|
155
|
+
# Delete collection
|
|
156
|
+
await luml.collections.delete("0199c455-21ee-74c6-b747-19a82f1a1e75")
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
async def demo_artifacts() -> None:
|
|
160
|
+
# Create new model artifact record with upload URL
|
|
161
|
+
model_created = await luml.artifacts.create(
|
|
162
|
+
file_name="customer_churn_model.fnnx",
|
|
163
|
+
extra_values={"accuracy": 0.95, "precision": 0.92, "recall": 0.88},
|
|
164
|
+
manifest={"version": "1.0", "framework": "xgboost"},
|
|
165
|
+
file_hash="abc123def456",
|
|
166
|
+
file_index={"layer1": (0, 1024), "layer2": (1024, 2048)},
|
|
167
|
+
size=1048576,
|
|
168
|
+
name="Customer Churn Predictor",
|
|
169
|
+
description="XGBoost model predicting customer churn probability",
|
|
170
|
+
tags=["xgboost", "churn", "production"],
|
|
171
|
+
)
|
|
172
|
+
print(f"Created model: {model_created}")
|
|
173
|
+
|
|
174
|
+
# List all model artifacts in the collection
|
|
175
|
+
models = await luml.artifacts.list()
|
|
176
|
+
print(f"All models in collection: {models}")
|
|
177
|
+
|
|
178
|
+
# Get model by ID
|
|
179
|
+
artifact_by_id = await luml.artifacts.get("0199c455-21ee-74c6-b747-19a82f1a1e75")
|
|
180
|
+
print(f"Artifact by id: {artifact_by_id}")
|
|
181
|
+
|
|
182
|
+
# Get model by name
|
|
183
|
+
artifact_by_name = await luml.artifacts.get("Customer Churn Predictor")
|
|
184
|
+
print(f"Artifact by name: {artifact_by_name}")
|
|
185
|
+
|
|
186
|
+
# Get model from specific collection
|
|
187
|
+
artifact_by_id_collection = await luml.artifacts.get(
|
|
188
|
+
"0199c455-21ee-74c6-b747-19a82f1a1e75",
|
|
189
|
+
collection_id="0199c455-21ee-74c6-b747-19a82f1a1e75",
|
|
190
|
+
)
|
|
191
|
+
print(f"Artifact by id: {artifact_by_id_collection}")
|
|
192
|
+
|
|
193
|
+
# Update model metadata
|
|
194
|
+
updated_model = await luml.artifacts.update(
|
|
195
|
+
artifact_id="0199c455-21ee-74c6-b747-19a82f1a1e75",
|
|
196
|
+
description="Updated: Advanced churn prediction model",
|
|
197
|
+
tags=["xgboost", "churn", "production", "v2.1"],
|
|
198
|
+
status=ModelArtifactStatus.UPLOADED,
|
|
199
|
+
)
|
|
200
|
+
print(f"Updated artifact: {updated_model}")
|
|
201
|
+
|
|
202
|
+
# Get download URL
|
|
203
|
+
download_url = await luml.artifacts.download_url(
|
|
204
|
+
"0199c455-21ee-74c6-b747-19a82f1a1e75"
|
|
205
|
+
)
|
|
206
|
+
print(f"Artifact Download URL: {download_url}")
|
|
207
|
+
|
|
208
|
+
# Get delete URL
|
|
209
|
+
delete_url = await luml.artifacts.delete_url("0199c455-21ee-74c6-b747-19a82f1a1e75")
|
|
210
|
+
print(f"Artifact Delete URL: {delete_url}")
|
|
211
|
+
|
|
212
|
+
# Upload a model file (example - file should exist)
|
|
213
|
+
uploaded_model = await luml.artifacts.upload(
|
|
214
|
+
file_path="/path/to/your/model.dfs",
|
|
215
|
+
model_name="Customer Churn Predictor",
|
|
216
|
+
description="XGBoost model predicting customer churn probability",
|
|
217
|
+
tags=["xgboost", "churn", "production"],
|
|
218
|
+
)
|
|
219
|
+
print(f"Uploaded artifact: {uploaded_model}")
|
|
220
|
+
|
|
221
|
+
# Download model
|
|
222
|
+
await luml.artifacts.download("0199c455-21ee-74c6-b747-19a82f1a1e75", "output.dfs")
|
|
223
|
+
|
|
224
|
+
# Delete model permanently
|
|
225
|
+
await luml.artifacts.delete("0199c455-21ee-74c6-b747-19a82f1a1e75")
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
async def async_main() -> None:
|
|
229
|
+
print("\n--------------------------------\n")
|
|
230
|
+
await demo_client_defaults()
|
|
231
|
+
print("\n--------------------------------\n")
|
|
232
|
+
await demo_organizations()
|
|
233
|
+
print("\n--------------------------------\n")
|
|
234
|
+
await demo_bucket_secrets()
|
|
235
|
+
print("\n--------------------------------\n")
|
|
236
|
+
await demo_orbits()
|
|
237
|
+
print("\n--------------------------------\n")
|
|
238
|
+
await demo_collections()
|
|
239
|
+
print("\n--------------------------------\n")
|
|
240
|
+
await demo_artifacts()
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
if __name__ == "__main__":
|
|
244
|
+
asyncio.run(async_main())
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
from luml_api import LumlClient
|
|
2
|
+
from luml_api._types import ArtifactStatus, CollectionType
|
|
3
|
+
|
|
4
|
+
# Will use LUML API Production url "https://api.luml.ai"
|
|
5
|
+
# And search for LUML_API_KEY in .env
|
|
6
|
+
luml_simple = LumlClient()
|
|
7
|
+
|
|
8
|
+
# No default organization, orbit and collection are set
|
|
9
|
+
luml_without_defaults = LumlClient(api_key="luml_your_api_key_here")
|
|
10
|
+
|
|
11
|
+
# Recommended initialization with default resources.
|
|
12
|
+
# Resources initialized by their names
|
|
13
|
+
luml_with_defaults_names = LumlClient(
|
|
14
|
+
api_key="luml_your_api_key_here",
|
|
15
|
+
organization="My Organization",
|
|
16
|
+
orbit="Default Orbit",
|
|
17
|
+
collection="Default Collection",
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Recommended initialization with default resources.
|
|
21
|
+
# Resources initialized by their ids
|
|
22
|
+
luml = LumlClient(
|
|
23
|
+
api_key="luml_your_api_key_here",
|
|
24
|
+
organization="0199c455-21ec-7c74-8efe-41470e29bae5",
|
|
25
|
+
orbit="0199c455-21ed-7aba-9fe5-5231611220de",
|
|
26
|
+
collection="0199c455-21ee-74c6-b747-19a82f1a1e75",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def demo_client_defaults() -> None:
|
|
31
|
+
# Get client defaults ids
|
|
32
|
+
default_organization_id = luml.organization
|
|
33
|
+
default_orbit_id = luml.orbit
|
|
34
|
+
default_collection_id = luml.collection
|
|
35
|
+
|
|
36
|
+
print(default_organization_id, default_orbit_id, default_collection_id)
|
|
37
|
+
|
|
38
|
+
# Set default resources
|
|
39
|
+
luml.organization = "0199c455-21ec-7c74-8efe-41470e29bae5"
|
|
40
|
+
luml.orbit = "0199c455-21ed-7aba-9fe5-5231611220de"
|
|
41
|
+
luml.collection = "0199c455-21ee-74c6-b747-19a82f1a1e75"
|
|
42
|
+
|
|
43
|
+
print(luml.organization, luml.orbit, luml.collection)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def demo_organizations() -> None:
|
|
47
|
+
# List all available organization for user
|
|
48
|
+
all_my_organization = luml.organizations.list()
|
|
49
|
+
print(f"All user organization: {all_my_organization}")
|
|
50
|
+
|
|
51
|
+
# Get default organization
|
|
52
|
+
default_org_details = luml.organizations.get()
|
|
53
|
+
print(f"Default organization: {default_org_details}")
|
|
54
|
+
|
|
55
|
+
# Get organization by name
|
|
56
|
+
organization_by_name = luml.organizations.get("My Organization")
|
|
57
|
+
print(f"Organization by name: {organization_by_name}")
|
|
58
|
+
|
|
59
|
+
# Get organization by id
|
|
60
|
+
organization_by_id = luml.organizations.get("0199c455-21ec-7c74-8efe-41470e29bae5")
|
|
61
|
+
print(f"Organization by id: {organization_by_id}")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def demo_bucket_secrets() -> None:
|
|
65
|
+
# Create a new bucket secret
|
|
66
|
+
bucket_secret = luml.bucket_secrets.create(
|
|
67
|
+
endpoint="s3.amazonaws.com",
|
|
68
|
+
bucket_name="my-ml-artifacts-bucket",
|
|
69
|
+
access_key="AKIAIOSFODNN7EXAMPLE",
|
|
70
|
+
secret_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
71
|
+
secure=True,
|
|
72
|
+
region="us-east-1",
|
|
73
|
+
)
|
|
74
|
+
print(f"Created bucket secret: {bucket_secret}")
|
|
75
|
+
|
|
76
|
+
# List all bucket secrets
|
|
77
|
+
secrets = luml.bucket_secrets.list()
|
|
78
|
+
print(f"Bucket secrets: {secrets}")
|
|
79
|
+
|
|
80
|
+
# Get bucket secret by name
|
|
81
|
+
secret = luml.bucket_secrets.get("my-ml-artifacts-bucket")
|
|
82
|
+
print(f"Bucket secret by name: {secret}")
|
|
83
|
+
|
|
84
|
+
# Get bucket secret by id
|
|
85
|
+
secret = luml.bucket_secrets.get("0199c455-21ed-7aba-9fe5-5231611220de")
|
|
86
|
+
print(f"Bucket secret by id: {secret}")
|
|
87
|
+
|
|
88
|
+
# Update bucket secret
|
|
89
|
+
updated_secret = luml.bucket_secrets.update(
|
|
90
|
+
secret_id=bucket_secret.id, secure=False, region="us-west-2"
|
|
91
|
+
)
|
|
92
|
+
print(f"Updated bucket secret: {updated_secret}")
|
|
93
|
+
|
|
94
|
+
# Delete bucket secret
|
|
95
|
+
luml.bucket_secrets.delete("0199c455-21ed-7aba-9fe5-5231611220de")
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def demo_orbits() -> None:
|
|
99
|
+
# Create a new orbit
|
|
100
|
+
orbit = luml.orbits.create(
|
|
101
|
+
name="ML Production Orbit",
|
|
102
|
+
bucket_secret_id="0199c455-21ed-7aba-9fe5-5231611220de",
|
|
103
|
+
)
|
|
104
|
+
print(f"Created orbit: {orbit}")
|
|
105
|
+
|
|
106
|
+
# Get Orbit by name
|
|
107
|
+
orbit_by_name = luml.orbits.get("ML Production Orbit")
|
|
108
|
+
print(f"Orbit by name: {orbit_by_name}")
|
|
109
|
+
|
|
110
|
+
# Get Orbit by id
|
|
111
|
+
orbit_by_id = luml.orbits.get("0199c455-21ed-7aba-9fe5-5231611220de")
|
|
112
|
+
print(f"Orbit by id: {orbit_by_id}")
|
|
113
|
+
|
|
114
|
+
# List all orbits
|
|
115
|
+
orbits = luml.orbits.list()
|
|
116
|
+
print(f"Orbits: {orbits}")
|
|
117
|
+
|
|
118
|
+
# Update orbit
|
|
119
|
+
updated_orbit = luml.orbits.update(name="ML Production Environment")
|
|
120
|
+
print(f"Updated orbit: {updated_orbit}")
|
|
121
|
+
|
|
122
|
+
# Delete Orbit
|
|
123
|
+
luml.orbits.delete("0199c455-21ed-7aba-9fe5-5231611220de")
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def demo_collections() -> None:
|
|
127
|
+
# Create a artifact collection
|
|
128
|
+
collection = luml.collections.create(
|
|
129
|
+
name="Production artifacts",
|
|
130
|
+
description="Trained artifacts ready for production deployment",
|
|
131
|
+
type=CollectionType.MODEL,
|
|
132
|
+
tags=["production", "ml", "artifacts"],
|
|
133
|
+
)
|
|
134
|
+
print(f"Created collection: {collection}")
|
|
135
|
+
|
|
136
|
+
# Get default collection
|
|
137
|
+
default_collection = luml.collections.get()
|
|
138
|
+
print(f"Get Default Collection Details: {default_collection}")
|
|
139
|
+
|
|
140
|
+
# Get collection by name
|
|
141
|
+
collection_by_name = luml.collections.get("Production artifacts")
|
|
142
|
+
print(f"Collection by name: {collection_by_name}")
|
|
143
|
+
|
|
144
|
+
# Get collection by id
|
|
145
|
+
collection_by_id = luml.collections.get("0199c455-21ee-74c6-b747-19a82f1a1e75")
|
|
146
|
+
print(f"Collection by id: {collection_by_id}")
|
|
147
|
+
|
|
148
|
+
# List all collections in the orbit
|
|
149
|
+
collections = luml.collections.list()
|
|
150
|
+
print(f"Collection: {collections}")
|
|
151
|
+
|
|
152
|
+
# Update collection with new tags
|
|
153
|
+
updated_collection = luml.collections.update(
|
|
154
|
+
collection_id="0199c455-21ee-74c6-b747-19a82f1a1e75",
|
|
155
|
+
description="Updated: Production-ready ML artifacts",
|
|
156
|
+
)
|
|
157
|
+
print(f"Updated collection: {updated_collection}")
|
|
158
|
+
|
|
159
|
+
# Delete collection
|
|
160
|
+
luml.collections.delete("0199c455-21ee-74c6-b747-19a82f1a1e75")
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def demo_artifacts() -> None:
|
|
164
|
+
# Create new artifact artifact record with upload URL
|
|
165
|
+
artifact_created = luml.artifacts.create(
|
|
166
|
+
file_name="customer_churn_artifact.fnnx",
|
|
167
|
+
extra_values={"accuracy": 0.95, "precision": 0.92, "recall": 0.88},
|
|
168
|
+
manifest={"version": "1.0", "framework": "xgboost"},
|
|
169
|
+
file_hash="abc123def456",
|
|
170
|
+
file_index={"layer1": (0, 1024), "layer2": (1024, 2048)},
|
|
171
|
+
size=1048576,
|
|
172
|
+
name="Customer Churn Predictor",
|
|
173
|
+
description="XGBoost artifact predicting customer churn probability",
|
|
174
|
+
tags=["xgboost", "churn", "production"],
|
|
175
|
+
)
|
|
176
|
+
print(f"Created artifact: {artifact_created}")
|
|
177
|
+
|
|
178
|
+
# List all artifact artifacts in the collection
|
|
179
|
+
artifacts = luml.artifacts.list()
|
|
180
|
+
print(f"All artifacts in collection: {artifacts}")
|
|
181
|
+
|
|
182
|
+
# Get artifact by ID
|
|
183
|
+
artifact_by_id = luml.artifacts.get("0199c455-21ee-74c6-b747-19a82f1a1e75")
|
|
184
|
+
print(f"artifact by id: {artifact_by_id}")
|
|
185
|
+
|
|
186
|
+
# Get artifact by name
|
|
187
|
+
artifact_by_name = luml.artifacts.get("Customer Churn Predictor")
|
|
188
|
+
print(f"artifact by name: {artifact_by_name}")
|
|
189
|
+
|
|
190
|
+
# Get artifact from specific collection
|
|
191
|
+
artifact_by_id_collection = luml.artifacts.get(
|
|
192
|
+
"0199c455-21ee-74c6-b747-19a82f1a1e75",
|
|
193
|
+
collection_id="0199c455-21ee-74c6-b747-19a82f1a1e75",
|
|
194
|
+
)
|
|
195
|
+
print(f"artifact by id: {artifact_by_id_collection}")
|
|
196
|
+
|
|
197
|
+
# Update artifact metadata
|
|
198
|
+
updated_artifact = luml.artifacts.update(
|
|
199
|
+
artifact_id="0199c455-21ee-74c6-b747-19a82f1a1e75",
|
|
200
|
+
description="Updated: Advanced churn prediction artifact",
|
|
201
|
+
tags=["xgboost", "churn", "production", "v2.1"],
|
|
202
|
+
status=ArtifactStatus.UPLOADED,
|
|
203
|
+
)
|
|
204
|
+
print(f"Updated artifact: {updated_artifact}")
|
|
205
|
+
|
|
206
|
+
# Get download URL
|
|
207
|
+
download_url = luml.artifacts.download_url("0199c455-21ee-74c6-b747-19a82f1a1e75")
|
|
208
|
+
print(f"artifact Download URL: {download_url}")
|
|
209
|
+
|
|
210
|
+
# Get delete URL
|
|
211
|
+
delete_url = luml.artifacts.delete_url("0199c455-21ee-74c6-b747-19a82f1a1e75")
|
|
212
|
+
print(f"artifact Delete URL: {delete_url}")
|
|
213
|
+
|
|
214
|
+
# Upload a artifact file (example - file should exist)
|
|
215
|
+
uploaded_artifact = luml.artifacts.upload(
|
|
216
|
+
file_path="/path/to/your/artifact.dfs",
|
|
217
|
+
name="Customer Churn Predictor",
|
|
218
|
+
description="XGBoost artifact predicting customer churn probability",
|
|
219
|
+
tags=["xgboost", "churn", "production"],
|
|
220
|
+
)
|
|
221
|
+
print(f"Uploaded artifact: {uploaded_artifact}")
|
|
222
|
+
|
|
223
|
+
# Download artifact
|
|
224
|
+
luml.artifacts.download("0199c455-21ee-74c6-b747-19a82f1a1e75", "output.dfs")
|
|
225
|
+
|
|
226
|
+
# Delete artifact permanently
|
|
227
|
+
luml.artifacts.delete("0199c455-21ee-74c6-b747-19a82f1a1e75")
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
if __name__ == "__main__":
|
|
231
|
+
print("\n--------------------------------\n")
|
|
232
|
+
demo_client_defaults()
|
|
233
|
+
print("\n--------------------------------\n")
|
|
234
|
+
demo_organizations()
|
|
235
|
+
print("\n--------------------------------\n")
|
|
236
|
+
demo_bucket_secrets()
|
|
237
|
+
print("\n--------------------------------\n")
|
|
238
|
+
demo_orbits()
|
|
239
|
+
print("\n--------------------------------\n")
|
|
240
|
+
demo_collections()
|
|
241
|
+
print("\n--------------------------------\n")
|
|
242
|
+
demo_artifacts()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
__version__ = "0.1.0rc0"
|
|
2
|
+
__title__ = "luml-sdk"
|
|
3
|
+
|
|
4
|
+
from luml_api._client import AsyncLumlClient, LumlClient
|
|
5
|
+
from luml_api._exceptions import (
|
|
6
|
+
APIError,
|
|
7
|
+
APIResponseValidationError,
|
|
8
|
+
APIStatusError,
|
|
9
|
+
AuthenticationError,
|
|
10
|
+
BadRequestError,
|
|
11
|
+
ConflictError,
|
|
12
|
+
InternalServerError,
|
|
13
|
+
LumlAPIError,
|
|
14
|
+
NotFoundError,
|
|
15
|
+
PermissionDeniedError,
|
|
16
|
+
UnprocessableEntityError,
|
|
17
|
+
)
|
|
18
|
+
from luml_api._types import (
|
|
19
|
+
ArtifactSortBy,
|
|
20
|
+
ArtifactStatus,
|
|
21
|
+
ArtifactType,
|
|
22
|
+
CollectionSortBy,
|
|
23
|
+
CollectionType,
|
|
24
|
+
CollectionTypeFilter,
|
|
25
|
+
SortOrder,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
__all__ = [
|
|
29
|
+
"__version__",
|
|
30
|
+
"__title__",
|
|
31
|
+
"LumlClient",
|
|
32
|
+
"AsyncLumlClient",
|
|
33
|
+
"LumlAPIError",
|
|
34
|
+
"APIError",
|
|
35
|
+
"APIResponseValidationError",
|
|
36
|
+
"APIStatusError",
|
|
37
|
+
"BadRequestError",
|
|
38
|
+
"AuthenticationError",
|
|
39
|
+
"PermissionDeniedError",
|
|
40
|
+
"NotFoundError",
|
|
41
|
+
"ConflictError",
|
|
42
|
+
"UnprocessableEntityError",
|
|
43
|
+
"InternalServerError",
|
|
44
|
+
"ArtifactSortBy",
|
|
45
|
+
"ArtifactStatus",
|
|
46
|
+
"ArtifactType",
|
|
47
|
+
"CollectionSortBy",
|
|
48
|
+
"CollectionType",
|
|
49
|
+
"CollectionTypeFilter",
|
|
50
|
+
"SortOrder",
|
|
51
|
+
]
|