lightning-sdk 2025.8.8__py3-none-any.whl → 2025.8.14__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.
- lightning_sdk/__init__.py +1 -1
- lightning_sdk/api/studio_api.py +26 -4
- lightning_sdk/job/base.py +12 -5
- lightning_sdk/lightning_cloud/openapi/__init__.py +7 -0
- lightning_sdk/lightning_cloud/openapi/api/cloud_space_environment_template_service_api.py +5 -1
- lightning_sdk/lightning_cloud/openapi/api/cloud_space_service_api.py +113 -0
- lightning_sdk/lightning_cloud/openapi/api/cloudy_service_api.py +0 -97
- lightning_sdk/lightning_cloud/openapi/api/k8_s_cluster_service_api.py +339 -0
- lightning_sdk/lightning_cloud/openapi/models/__init__.py +7 -0
- lightning_sdk/lightning_cloud/openapi/models/cluster_id_metrics_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/create.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/externalv1_cloud_space_instance_status.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/id_sleepconfig_body.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_billing_tier.py +0 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_transfer_metadata.py +69 -17
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_metrics.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_data_connection.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_get_user_response.py +1 -27
- lightning_sdk/lightning_cloud/openapi/models/v1_google_cloud_direct_v1.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_direct_v1.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_namespace_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_namespace_user_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_lustre_data_connection.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_magic_link_login_request.py +1 -27
- lightning_sdk/lightning_cloud/openapi/models/v1_namespace_metrics.py +591 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_namespace_user_metrics.py +435 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_pod_metrics.py +55 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_storage_asset.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_update_user_request.py +1 -27
- lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +27 -79
- lightning_sdk/llm/llm.py +67 -37
- lightning_sdk/llm/public_assistants.py +3 -3
- lightning_sdk/studio.py +11 -3
- lightning_sdk/utils/resolve.py +13 -0
- {lightning_sdk-2025.8.8.dist-info → lightning_sdk-2025.8.14.dist-info}/METADATA +1 -1
- {lightning_sdk-2025.8.8.dist-info → lightning_sdk-2025.8.14.dist-info}/RECORD +41 -34
- {lightning_sdk-2025.8.8.dist-info → lightning_sdk-2025.8.14.dist-info}/LICENSE +0 -0
- {lightning_sdk-2025.8.8.dist-info → lightning_sdk-2025.8.14.dist-info}/WHEEL +0 -0
- {lightning_sdk-2025.8.8.dist-info → lightning_sdk-2025.8.14.dist-info}/entry_points.txt +0 -0
- {lightning_sdk-2025.8.8.dist-info → lightning_sdk-2025.8.14.dist-info}/top_level.txt +0 -0
|
@@ -77,6 +77,7 @@ class V1UserFeatures(object):
|
|
|
77
77
|
'f242': 'bool',
|
|
78
78
|
'f243': 'bool',
|
|
79
79
|
'f244': 'bool',
|
|
80
|
+
'f245': 'bool',
|
|
80
81
|
'fair_share': 'bool',
|
|
81
82
|
'featured_studios_admin': 'bool',
|
|
82
83
|
'gcp_overprovisioning': 'bool',
|
|
@@ -92,8 +93,6 @@ class V1UserFeatures(object):
|
|
|
92
93
|
'mmt_fault_tolerance': 'bool',
|
|
93
94
|
'mmt_strategy_selector': 'bool',
|
|
94
95
|
'model_api_dashboard': 'bool',
|
|
95
|
-
'model_api_dashboard_clickhouse': 'bool',
|
|
96
|
-
'multicloud_folders': 'bool',
|
|
97
96
|
'multiple_studio_versions': 'bool',
|
|
98
97
|
'nerf_fs_nonpaying': 'bool',
|
|
99
98
|
'onboarding_v2': 'bool',
|
|
@@ -105,7 +104,6 @@ class V1UserFeatures(object):
|
|
|
105
104
|
'plugin_label_studio': 'bool',
|
|
106
105
|
'plugin_langflow': 'bool',
|
|
107
106
|
'plugin_python_profiler': 'bool',
|
|
108
|
-
'plugin_service': 'bool',
|
|
109
107
|
'plugin_sweeps': 'bool',
|
|
110
108
|
'pricing_updates': 'bool',
|
|
111
109
|
'product_generator': 'bool',
|
|
@@ -170,6 +168,7 @@ class V1UserFeatures(object):
|
|
|
170
168
|
'f242': 'f242',
|
|
171
169
|
'f243': 'f243',
|
|
172
170
|
'f244': 'f244',
|
|
171
|
+
'f245': 'f245',
|
|
173
172
|
'fair_share': 'fairShare',
|
|
174
173
|
'featured_studios_admin': 'featuredStudiosAdmin',
|
|
175
174
|
'gcp_overprovisioning': 'gcpOverprovisioning',
|
|
@@ -185,8 +184,6 @@ class V1UserFeatures(object):
|
|
|
185
184
|
'mmt_fault_tolerance': 'mmtFaultTolerance',
|
|
186
185
|
'mmt_strategy_selector': 'mmtStrategySelector',
|
|
187
186
|
'model_api_dashboard': 'modelApiDashboard',
|
|
188
|
-
'model_api_dashboard_clickhouse': 'modelApiDashboardClickhouse',
|
|
189
|
-
'multicloud_folders': 'multicloudFolders',
|
|
190
187
|
'multiple_studio_versions': 'multipleStudioVersions',
|
|
191
188
|
'nerf_fs_nonpaying': 'nerfFsNonpaying',
|
|
192
189
|
'onboarding_v2': 'onboardingV2',
|
|
@@ -198,7 +195,6 @@ class V1UserFeatures(object):
|
|
|
198
195
|
'plugin_label_studio': 'pluginLabelStudio',
|
|
199
196
|
'plugin_langflow': 'pluginLangflow',
|
|
200
197
|
'plugin_python_profiler': 'pluginPythonProfiler',
|
|
201
|
-
'plugin_service': 'pluginService',
|
|
202
198
|
'plugin_sweeps': 'pluginSweeps',
|
|
203
199
|
'pricing_updates': 'pricingUpdates',
|
|
204
200
|
'product_generator': 'productGenerator',
|
|
@@ -226,7 +222,7 @@ class V1UserFeatures(object):
|
|
|
226
222
|
'writable_s3_connections': 'writableS3Connections'
|
|
227
223
|
}
|
|
228
224
|
|
|
229
|
-
def __init__(self, academic_tier: 'bool' =None, add_data_v2: 'bool' =None, affiliate_links: 'bool' =None, agents_v2: 'bool' =None, ai_hub_monetization: 'bool' =None, auto_fast_load: 'bool' =None, auto_join_orgs: 'bool' =None, b2c_experience: 'bool' =None, byo_machine_type: 'bool' =None, cap_add: 'list[str]' =None, cap_drop: 'list[str]' =None, capacity_reservation_byoc: 'bool' =None, capacity_reservation_dry_run: 'bool' =None, chat_models: 'bool' =None, cloudspace_schedules: 'bool' =None, code_tab: 'bool' =None, collab_screen_sharing: 'bool' =None, control_center_monitoring: 'bool' =None, cost_attribution_settings: 'bool' =None, custom_app_domain: 'bool' =None, datasets: 'bool' =None, default_one_cluster: 'bool' =None, deployment_persistent_disk: 'bool' =None, drive_v2: 'bool' =None, enterprise_compute_admin: 'bool' =None, f227: 'bool' =None, f234: 'bool' =None, f236: 'bool' =None, f237: 'bool' =None, f238: 'bool' =None, f239: 'bool' =None, f240: 'bool' =None, f241: 'bool' =None, f242: 'bool' =None, f243: 'bool' =None, f244: 'bool' =None, fair_share: 'bool' =None, featured_studios_admin: 'bool' =None, gcp_overprovisioning: 'bool' =None, gcs_connections_optimized: 'bool' =None, gcs_folders: 'bool' =None, instant_capacity_reservation: 'bool' =None, job_artifacts_v2: 'bool' =None, kubernetes_cluster_ui: 'bool' =None, kubernetes_clusters: 'bool' =None, landing_studios: 'bool' =None, lit_logger: 'bool' =None, marketplace: 'bool' =None, mmt_fault_tolerance: 'bool' =None, mmt_strategy_selector: 'bool' =None, model_api_dashboard: 'bool' =None,
|
|
225
|
+
def __init__(self, academic_tier: 'bool' =None, add_data_v2: 'bool' =None, affiliate_links: 'bool' =None, agents_v2: 'bool' =None, ai_hub_monetization: 'bool' =None, auto_fast_load: 'bool' =None, auto_join_orgs: 'bool' =None, b2c_experience: 'bool' =None, byo_machine_type: 'bool' =None, cap_add: 'list[str]' =None, cap_drop: 'list[str]' =None, capacity_reservation_byoc: 'bool' =None, capacity_reservation_dry_run: 'bool' =None, chat_models: 'bool' =None, cloudspace_schedules: 'bool' =None, code_tab: 'bool' =None, collab_screen_sharing: 'bool' =None, control_center_monitoring: 'bool' =None, cost_attribution_settings: 'bool' =None, custom_app_domain: 'bool' =None, datasets: 'bool' =None, default_one_cluster: 'bool' =None, deployment_persistent_disk: 'bool' =None, drive_v2: 'bool' =None, enterprise_compute_admin: 'bool' =None, f227: 'bool' =None, f234: 'bool' =None, f236: 'bool' =None, f237: 'bool' =None, f238: 'bool' =None, f239: 'bool' =None, f240: 'bool' =None, f241: 'bool' =None, f242: 'bool' =None, f243: 'bool' =None, f244: 'bool' =None, f245: 'bool' =None, fair_share: 'bool' =None, featured_studios_admin: 'bool' =None, gcp_overprovisioning: 'bool' =None, gcs_connections_optimized: 'bool' =None, gcs_folders: 'bool' =None, instant_capacity_reservation: 'bool' =None, job_artifacts_v2: 'bool' =None, kubernetes_cluster_ui: 'bool' =None, kubernetes_clusters: 'bool' =None, landing_studios: 'bool' =None, lit_logger: 'bool' =None, marketplace: 'bool' =None, mmt_fault_tolerance: 'bool' =None, mmt_strategy_selector: 'bool' =None, model_api_dashboard: 'bool' =None, multiple_studio_versions: 'bool' =None, nerf_fs_nonpaying: 'bool' =None, onboarding_v2: 'bool' =None, org_level_member_permissions: 'bool' =None, org_usage_limits: 'bool' =None, persistent_disk: 'bool' =None, plugin_distributed: 'bool' =None, plugin_inference: 'bool' =None, plugin_label_studio: 'bool' =None, plugin_langflow: 'bool' =None, plugin_python_profiler: 'bool' =None, plugin_sweeps: 'bool' =None, pricing_updates: 'bool' =None, product_generator: 'bool' =None, product_license: 'bool' =None, project_selector: 'bool' =None, publish_pipelines: 'bool' =None, r2_data_connections: 'bool' =None, reserved_machines_tab: 'bool' =None, restartable_jobs: 'bool' =None, runnable_public_studio_page: 'bool' =None, security_docs: 'bool' =None, show_dev_admin: 'bool' =None, single_wallet: 'bool' =None, slurm: 'bool' =None, specialised_studios: 'bool' =None, storage_overuse_deletion: 'bool' =None, studio_config: 'bool' =None, studio_sharing_v2: 'bool' =None, studio_version_visibility: 'bool' =None, trainium2: 'bool' =None, use_internal_data_connection_mounts: 'bool' =None, use_rclone_mounts_only: 'bool' =None, vultr: 'bool' =None, weka: 'bool' =None, writable_s3_connections: 'bool' =None): # noqa: E501
|
|
230
226
|
"""V1UserFeatures - a model defined in Swagger""" # noqa: E501
|
|
231
227
|
self._academic_tier = None
|
|
232
228
|
self._add_data_v2 = None
|
|
@@ -264,6 +260,7 @@ class V1UserFeatures(object):
|
|
|
264
260
|
self._f242 = None
|
|
265
261
|
self._f243 = None
|
|
266
262
|
self._f244 = None
|
|
263
|
+
self._f245 = None
|
|
267
264
|
self._fair_share = None
|
|
268
265
|
self._featured_studios_admin = None
|
|
269
266
|
self._gcp_overprovisioning = None
|
|
@@ -279,8 +276,6 @@ class V1UserFeatures(object):
|
|
|
279
276
|
self._mmt_fault_tolerance = None
|
|
280
277
|
self._mmt_strategy_selector = None
|
|
281
278
|
self._model_api_dashboard = None
|
|
282
|
-
self._model_api_dashboard_clickhouse = None
|
|
283
|
-
self._multicloud_folders = None
|
|
284
279
|
self._multiple_studio_versions = None
|
|
285
280
|
self._nerf_fs_nonpaying = None
|
|
286
281
|
self._onboarding_v2 = None
|
|
@@ -292,7 +287,6 @@ class V1UserFeatures(object):
|
|
|
292
287
|
self._plugin_label_studio = None
|
|
293
288
|
self._plugin_langflow = None
|
|
294
289
|
self._plugin_python_profiler = None
|
|
295
|
-
self._plugin_service = None
|
|
296
290
|
self._plugin_sweeps = None
|
|
297
291
|
self._pricing_updates = None
|
|
298
292
|
self._product_generator = None
|
|
@@ -391,6 +385,8 @@ class V1UserFeatures(object):
|
|
|
391
385
|
self.f243 = f243
|
|
392
386
|
if f244 is not None:
|
|
393
387
|
self.f244 = f244
|
|
388
|
+
if f245 is not None:
|
|
389
|
+
self.f245 = f245
|
|
394
390
|
if fair_share is not None:
|
|
395
391
|
self.fair_share = fair_share
|
|
396
392
|
if featured_studios_admin is not None:
|
|
@@ -421,10 +417,6 @@ class V1UserFeatures(object):
|
|
|
421
417
|
self.mmt_strategy_selector = mmt_strategy_selector
|
|
422
418
|
if model_api_dashboard is not None:
|
|
423
419
|
self.model_api_dashboard = model_api_dashboard
|
|
424
|
-
if model_api_dashboard_clickhouse is not None:
|
|
425
|
-
self.model_api_dashboard_clickhouse = model_api_dashboard_clickhouse
|
|
426
|
-
if multicloud_folders is not None:
|
|
427
|
-
self.multicloud_folders = multicloud_folders
|
|
428
420
|
if multiple_studio_versions is not None:
|
|
429
421
|
self.multiple_studio_versions = multiple_studio_versions
|
|
430
422
|
if nerf_fs_nonpaying is not None:
|
|
@@ -447,8 +439,6 @@ class V1UserFeatures(object):
|
|
|
447
439
|
self.plugin_langflow = plugin_langflow
|
|
448
440
|
if plugin_python_profiler is not None:
|
|
449
441
|
self.plugin_python_profiler = plugin_python_profiler
|
|
450
|
-
if plugin_service is not None:
|
|
451
|
-
self.plugin_service = plugin_service
|
|
452
442
|
if plugin_sweeps is not None:
|
|
453
443
|
self.plugin_sweeps = plugin_sweeps
|
|
454
444
|
if pricing_updates is not None:
|
|
@@ -1256,6 +1246,27 @@ class V1UserFeatures(object):
|
|
|
1256
1246
|
|
|
1257
1247
|
self._f244 = f244
|
|
1258
1248
|
|
|
1249
|
+
@property
|
|
1250
|
+
def f245(self) -> 'bool':
|
|
1251
|
+
"""Gets the f245 of this V1UserFeatures. # noqa: E501
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
:return: The f245 of this V1UserFeatures. # noqa: E501
|
|
1255
|
+
:rtype: bool
|
|
1256
|
+
"""
|
|
1257
|
+
return self._f245
|
|
1258
|
+
|
|
1259
|
+
@f245.setter
|
|
1260
|
+
def f245(self, f245: 'bool'):
|
|
1261
|
+
"""Sets the f245 of this V1UserFeatures.
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
:param f245: The f245 of this V1UserFeatures. # noqa: E501
|
|
1265
|
+
:type: bool
|
|
1266
|
+
"""
|
|
1267
|
+
|
|
1268
|
+
self._f245 = f245
|
|
1269
|
+
|
|
1259
1270
|
@property
|
|
1260
1271
|
def fair_share(self) -> 'bool':
|
|
1261
1272
|
"""Gets the fair_share of this V1UserFeatures. # noqa: E501
|
|
@@ -1571,48 +1582,6 @@ class V1UserFeatures(object):
|
|
|
1571
1582
|
|
|
1572
1583
|
self._model_api_dashboard = model_api_dashboard
|
|
1573
1584
|
|
|
1574
|
-
@property
|
|
1575
|
-
def model_api_dashboard_clickhouse(self) -> 'bool':
|
|
1576
|
-
"""Gets the model_api_dashboard_clickhouse of this V1UserFeatures. # noqa: E501
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
:return: The model_api_dashboard_clickhouse of this V1UserFeatures. # noqa: E501
|
|
1580
|
-
:rtype: bool
|
|
1581
|
-
"""
|
|
1582
|
-
return self._model_api_dashboard_clickhouse
|
|
1583
|
-
|
|
1584
|
-
@model_api_dashboard_clickhouse.setter
|
|
1585
|
-
def model_api_dashboard_clickhouse(self, model_api_dashboard_clickhouse: 'bool'):
|
|
1586
|
-
"""Sets the model_api_dashboard_clickhouse of this V1UserFeatures.
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
:param model_api_dashboard_clickhouse: The model_api_dashboard_clickhouse of this V1UserFeatures. # noqa: E501
|
|
1590
|
-
:type: bool
|
|
1591
|
-
"""
|
|
1592
|
-
|
|
1593
|
-
self._model_api_dashboard_clickhouse = model_api_dashboard_clickhouse
|
|
1594
|
-
|
|
1595
|
-
@property
|
|
1596
|
-
def multicloud_folders(self) -> 'bool':
|
|
1597
|
-
"""Gets the multicloud_folders of this V1UserFeatures. # noqa: E501
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
:return: The multicloud_folders of this V1UserFeatures. # noqa: E501
|
|
1601
|
-
:rtype: bool
|
|
1602
|
-
"""
|
|
1603
|
-
return self._multicloud_folders
|
|
1604
|
-
|
|
1605
|
-
@multicloud_folders.setter
|
|
1606
|
-
def multicloud_folders(self, multicloud_folders: 'bool'):
|
|
1607
|
-
"""Sets the multicloud_folders of this V1UserFeatures.
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
:param multicloud_folders: The multicloud_folders of this V1UserFeatures. # noqa: E501
|
|
1611
|
-
:type: bool
|
|
1612
|
-
"""
|
|
1613
|
-
|
|
1614
|
-
self._multicloud_folders = multicloud_folders
|
|
1615
|
-
|
|
1616
1585
|
@property
|
|
1617
1586
|
def multiple_studio_versions(self) -> 'bool':
|
|
1618
1587
|
"""Gets the multiple_studio_versions of this V1UserFeatures. # noqa: E501
|
|
@@ -1844,27 +1813,6 @@ class V1UserFeatures(object):
|
|
|
1844
1813
|
|
|
1845
1814
|
self._plugin_python_profiler = plugin_python_profiler
|
|
1846
1815
|
|
|
1847
|
-
@property
|
|
1848
|
-
def plugin_service(self) -> 'bool':
|
|
1849
|
-
"""Gets the plugin_service of this V1UserFeatures. # noqa: E501
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
:return: The plugin_service of this V1UserFeatures. # noqa: E501
|
|
1853
|
-
:rtype: bool
|
|
1854
|
-
"""
|
|
1855
|
-
return self._plugin_service
|
|
1856
|
-
|
|
1857
|
-
@plugin_service.setter
|
|
1858
|
-
def plugin_service(self, plugin_service: 'bool'):
|
|
1859
|
-
"""Sets the plugin_service of this V1UserFeatures.
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
:param plugin_service: The plugin_service of this V1UserFeatures. # noqa: E501
|
|
1863
|
-
:type: bool
|
|
1864
|
-
"""
|
|
1865
|
-
|
|
1866
|
-
self._plugin_service = plugin_service
|
|
1867
|
-
|
|
1868
1816
|
@property
|
|
1869
1817
|
def plugin_sweeps(self) -> 'bool':
|
|
1870
1818
|
"""Gets the plugin_sweeps of this V1UserFeatures. # noqa: E501
|
lightning_sdk/llm/llm.py
CHANGED
|
@@ -5,6 +5,7 @@ from lightning_sdk.api import TeamspaceApi, UserApi
|
|
|
5
5
|
from lightning_sdk.api.llm_api import LLMApi, authenticate
|
|
6
6
|
from lightning_sdk.lightning_cloud.openapi.models.v1_conversation_response_chunk import V1ConversationResponseChunk
|
|
7
7
|
from lightning_sdk.llm.public_assistants import PUBLIC_MODELS
|
|
8
|
+
from lightning_sdk.utils.resolve import _resolve_org, _resolve_teamspace
|
|
8
9
|
|
|
9
10
|
PUBLIC_MODEL_PROVIDERS: Dict[str, str] = {
|
|
10
11
|
"openai": "OpenAI",
|
|
@@ -31,33 +32,33 @@ class LLM:
|
|
|
31
32
|
) -> None:
|
|
32
33
|
"""Initializes the LLM instance with teamspace information, which is required for billing purposes.
|
|
33
34
|
|
|
34
|
-
Teamspace information is resolved through the following methods:
|
|
35
|
-
1. `.lightning/credentials.json` - Attempts to retrieve the teamspace from the local credentials file.
|
|
36
|
-
2. Environment Variables - Checks for `LIGHTNING_*` environment variables.
|
|
37
|
-
3. User Authentication - Redirects the user to the login page if teamspace information is not found.
|
|
38
|
-
|
|
39
35
|
Args:
|
|
40
36
|
name (str): The name of the model or resource.
|
|
41
|
-
teamspace (Optional[str]): The specified teamspace for billing. If not provided, it will
|
|
42
|
-
|
|
37
|
+
teamspace (Optional[str]): The specified teamspace for billing. If not provided, it will
|
|
38
|
+
use the available default teamspace.
|
|
43
39
|
enable_async (Optional[bool]): Enable async requests
|
|
44
40
|
|
|
45
41
|
Raises:
|
|
46
42
|
ValueError: If teamspace information cannot be resolved.
|
|
47
43
|
"""
|
|
48
44
|
teamspace_name = None
|
|
45
|
+
teamspace_owner = None
|
|
49
46
|
if teamspace:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
if "/" in teamspace:
|
|
48
|
+
try:
|
|
49
|
+
teamspace_owner, teamspace_name = teamspace.split("/", maxsplit=1)
|
|
50
|
+
except ValueError as e:
|
|
51
|
+
raise ValueError(
|
|
52
|
+
f"Invalid teamspace format: '{teamspace}'. "
|
|
53
|
+
"Teamspace should be specified as '{org}/{teamspace_name}' or '{org}'"
|
|
54
|
+
"(e.g., 'my-org/my-teamspace', 'my-org')."
|
|
55
|
+
) from e
|
|
56
|
+
else:
|
|
57
|
+
# org is given
|
|
58
|
+
teamspace_name = teamspace
|
|
58
59
|
|
|
59
60
|
self._model_provider, self._model_name = self._parse_model_name(name)
|
|
60
|
-
self._get_auth_info(teamspace_name)
|
|
61
|
+
self._get_auth_info(teamspace_owner, teamspace_name)
|
|
61
62
|
|
|
62
63
|
self._enable_async = enable_async
|
|
63
64
|
|
|
@@ -88,34 +89,63 @@ class LLM:
|
|
|
88
89
|
|
|
89
90
|
return int(context_info["context_length"])
|
|
90
91
|
|
|
91
|
-
def _get_auth_info(self, teamspace_name: Optional[str] = None) -> None:
|
|
92
|
-
# TODO: Validate user input teamspace name
|
|
92
|
+
def _get_auth_info(self, teamspace_owner: Optional[str] = None, teamspace_name: Optional[str] = None) -> None:
|
|
93
93
|
if not LLM._auth_info_cached:
|
|
94
|
-
if
|
|
95
|
-
#
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
if teamspace_owner and teamspace_name:
|
|
95
|
+
# org with specific teamspace
|
|
96
|
+
try:
|
|
97
|
+
t = _resolve_teamspace(teamspace=teamspace_name, org=None, user=teamspace_owner)
|
|
98
|
+
except Exception:
|
|
99
|
+
try:
|
|
100
|
+
t = _resolve_teamspace(teamspace=teamspace_name, org=teamspace_owner, user=None)
|
|
101
|
+
except Exception as err:
|
|
102
|
+
raise ValueError(
|
|
103
|
+
f"Teamspace {teamspace_owner}/{teamspace_name} not found."
|
|
104
|
+
"Please verify owner name (username or organization) and the teamspace name are correct."
|
|
105
|
+
) from err
|
|
106
|
+
|
|
107
|
+
os.environ["LIGHTNING_TEAMSPACE"] = t.name
|
|
108
|
+
os.environ["LIGHTNING_CLOUD_PROJECT_ID"] = t.id
|
|
109
|
+
|
|
110
|
+
elif teamspace_name and teamspace_owner is None:
|
|
111
|
+
# if only org name is given, use the default teamspace
|
|
100
112
|
try:
|
|
101
|
-
|
|
113
|
+
org = _resolve_org(teamspace_name)
|
|
102
114
|
teamspace_api = TeamspaceApi()
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
default_teamspace = teamspace_api.list_teamspaces(owner_id=authed_user.id)[0]
|
|
106
|
-
teamspace_name = default_teamspace.name
|
|
107
|
-
teamspace_id = default_teamspace.id
|
|
108
|
-
os.environ["LIGHTNING_CLOUD_PROJECT_ID"] = teamspace_id
|
|
109
|
-
os.environ["LIGHTNING_TEAMSPACE"] = teamspace_name
|
|
115
|
+
teamspace = teamspace_api.list_teamspaces(org.id)[0]
|
|
116
|
+
|
|
110
117
|
except Exception as err:
|
|
111
|
-
# throw an appropriate error that guides users to login through the platform
|
|
112
118
|
raise ValueError(
|
|
113
|
-
"
|
|
114
|
-
"If this is your first time using LitAI, please log in at https://lightning.ai/sign-up "
|
|
115
|
-
"and re-run your script, or set the environment variable LIGHTNING_TEAMSPACE=<your-teamspace>."
|
|
119
|
+
f"Organization {teamspace_name} not found. Please verify the organization name."
|
|
116
120
|
) from err
|
|
121
|
+
os.environ["LIGHTNING_CLOUD_PROJECT_ID"] = teamspace.id
|
|
122
|
+
os.environ["LIGHTNING_TEAMSPACE"] = teamspace.name
|
|
123
|
+
|
|
124
|
+
else:
|
|
125
|
+
if teamspace_name is None:
|
|
126
|
+
# studio users
|
|
127
|
+
teamspace_name = os.environ.get("LIGHTNING_TEAMSPACE", None)
|
|
128
|
+
|
|
129
|
+
if teamspace_name is None:
|
|
130
|
+
# local users with no given teamspace
|
|
131
|
+
try:
|
|
132
|
+
authenticate(model=f"{self.provider}/{self.name}")
|
|
133
|
+
teamspace_api = TeamspaceApi()
|
|
134
|
+
user_api = UserApi()
|
|
135
|
+
authed_user = user_api._client.auth_service_get_user()
|
|
136
|
+
default_teamspace = teamspace_api.list_teamspaces(owner_id=authed_user.id)[0]
|
|
137
|
+
teamspace_name = default_teamspace.name
|
|
138
|
+
teamspace_id = default_teamspace.id
|
|
139
|
+
os.environ["LIGHTNING_CLOUD_PROJECT_ID"] = teamspace_id
|
|
140
|
+
os.environ["LIGHTNING_TEAMSPACE"] = teamspace_name
|
|
141
|
+
except Exception as err:
|
|
142
|
+
# throw an appropriate error that guides users to login through the platform
|
|
143
|
+
raise ValueError(
|
|
144
|
+
"Teamspace information is missing. "
|
|
145
|
+
"If this is your first time using LitAI, please log in at https://lightning.ai/sign-up "
|
|
146
|
+
"and re-run your script, or set environment variable LIGHTNING_TEAMSPACE=<your-teamspace>."
|
|
147
|
+
) from err
|
|
117
148
|
|
|
118
|
-
# TODO: when teamspace_name is given, we don't know the teamspace_id yet
|
|
119
149
|
# TODO: if LIGHTNING_CLOUD_PROJECT_ID does not exist, we have to get the id from the teamspace name
|
|
120
150
|
|
|
121
151
|
LLM._cached_auth_info = {
|
|
@@ -35,15 +35,15 @@ PUBLIC_MODELS = {
|
|
|
35
35
|
"id": "ast_01k1z7ajxbz7wq62xj5bc0mrcs",
|
|
36
36
|
"context_length": 128000,
|
|
37
37
|
},
|
|
38
|
-
"openai/gpt-5
|
|
38
|
+
"openai/gpt-5": {
|
|
39
39
|
"id": "ast_01jdjds71fs8gt47jexzed4cza",
|
|
40
40
|
"context_length": 400000
|
|
41
41
|
},
|
|
42
|
-
"openai/gpt-5-mini
|
|
42
|
+
"openai/gpt-5-mini": {
|
|
43
43
|
"id": "ast_01jdjds71fs8gt47jexzed4czb",
|
|
44
44
|
"context_length": 400000
|
|
45
45
|
},
|
|
46
|
-
"openai/gpt-5-nano
|
|
46
|
+
"openai/gpt-5-nano": {
|
|
47
47
|
"id": "ast_01jdjds71fs8gt47jexzed4czc",
|
|
48
48
|
"context_length": 400000
|
|
49
49
|
},
|
lightning_sdk/studio.py
CHANGED
|
@@ -57,6 +57,7 @@ class Studio:
|
|
|
57
57
|
|
|
58
58
|
# skips init of studio, only set when using this as a shell for names, ids etc.
|
|
59
59
|
_skip_init = False
|
|
60
|
+
_skip_setup = False
|
|
60
61
|
|
|
61
62
|
def __init__(
|
|
62
63
|
self,
|
|
@@ -82,7 +83,7 @@ class Studio:
|
|
|
82
83
|
self._teamspace = _teamspace
|
|
83
84
|
self._cloud_account = _resolve_deprecated_cluster(cloud_account, cluster)
|
|
84
85
|
|
|
85
|
-
self._setup_done =
|
|
86
|
+
self._setup_done = self._skip_setup
|
|
86
87
|
self._disable_secrets = disable_secrets
|
|
87
88
|
|
|
88
89
|
self._plugins = {}
|
|
@@ -258,13 +259,17 @@ class Studio:
|
|
|
258
259
|
"""Deletes the current Studio."""
|
|
259
260
|
self._studio_api.delete_studio(self._studio.id, self._teamspace.id)
|
|
260
261
|
|
|
261
|
-
def duplicate(
|
|
262
|
+
def duplicate(
|
|
263
|
+
self, target_teamspace: Optional[Union["Teamspace", str]] = None, machine: Machine = Machine.CPU
|
|
264
|
+
) -> "Studio":
|
|
262
265
|
"""Duplicates the existing Studio.
|
|
263
266
|
|
|
264
267
|
Args:
|
|
265
268
|
target_teamspace: the teamspace to duplicate the studio to.
|
|
266
269
|
Must have the same owner as the source teamspace.
|
|
267
270
|
If not provided, defaults to current teamspace.
|
|
271
|
+
machine: the machine to start the duplicated studio on.
|
|
272
|
+
Defaults to CPU
|
|
268
273
|
"""
|
|
269
274
|
if target_teamspace is None:
|
|
270
275
|
target_teamspace_id = self._teamspace.id
|
|
@@ -284,7 +289,10 @@ class Studio:
|
|
|
284
289
|
target_teamspace_id = target_teamspace.id
|
|
285
290
|
|
|
286
291
|
kwargs = self._studio_api.duplicate_studio(
|
|
287
|
-
studio_id=self._studio.id,
|
|
292
|
+
studio_id=self._studio.id,
|
|
293
|
+
teamspace_id=self._teamspace.id,
|
|
294
|
+
target_teamspace_id=target_teamspace_id,
|
|
295
|
+
machine=machine,
|
|
288
296
|
)
|
|
289
297
|
return Studio(**kwargs)
|
|
290
298
|
|
lightning_sdk/utils/resolve.py
CHANGED
|
@@ -206,6 +206,19 @@ def skip_studio_init() -> Generator[None, None, None]:
|
|
|
206
206
|
Studio._skip_init = prev_studio_init_state
|
|
207
207
|
|
|
208
208
|
|
|
209
|
+
@contextmanager
|
|
210
|
+
def skip_studio_setup() -> Generator[None, None, None]:
|
|
211
|
+
"""Skip studio setup based on current runtime."""
|
|
212
|
+
from lightning_sdk.studio import Studio
|
|
213
|
+
|
|
214
|
+
prev_studio_init_state = Studio._skip_setup
|
|
215
|
+
Studio._skip_setup = True
|
|
216
|
+
|
|
217
|
+
yield
|
|
218
|
+
|
|
219
|
+
Studio._skip_setup = prev_studio_init_state
|
|
220
|
+
|
|
221
|
+
|
|
209
222
|
def _parse_model_and_version(name: str) -> Tuple[str, Optional[str]]:
|
|
210
223
|
"""Parse the model name and version from the given string.
|
|
211
224
|
|