lightning-sdk 0.2.15__py3-none-any.whl → 0.2.17__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.
Files changed (80) hide show
  1. lightning_sdk/__init__.py +1 -1
  2. lightning_sdk/api/base_studio_api.py +7 -1
  3. lightning_sdk/api/cluster_api.py +83 -1
  4. lightning_sdk/api/llm_api.py +27 -5
  5. lightning_sdk/api/studio_api.py +64 -0
  6. lightning_sdk/api/teamspace_api.py +127 -1
  7. lightning_sdk/api/utils.py +4 -0
  8. lightning_sdk/base_studio.py +14 -1
  9. lightning_sdk/cli/create.py +21 -1
  10. lightning_sdk/cli/deploy/__init__.py +0 -0
  11. lightning_sdk/cli/deploy/_auth.py +189 -0
  12. lightning_sdk/cli/deploy/devbox.py +157 -0
  13. lightning_sdk/cli/{serve.py → deploy/serve.py} +11 -322
  14. lightning_sdk/cli/download.py +44 -16
  15. lightning_sdk/cli/entrypoint.py +1 -1
  16. lightning_sdk/cli/open.py +21 -2
  17. lightning_sdk/cli/start.py +12 -3
  18. lightning_sdk/cli/upload.py +2 -4
  19. lightning_sdk/lightning_cloud/openapi/__init__.py +19 -0
  20. lightning_sdk/lightning_cloud/openapi/api/assistants_service_api.py +126 -1
  21. lightning_sdk/lightning_cloud/openapi/api/cloud_space_environment_template_service_api.py +97 -0
  22. lightning_sdk/lightning_cloud/openapi/api/cloud_space_service_api.py +105 -0
  23. lightning_sdk/lightning_cloud/openapi/api/cluster_service_api.py +105 -0
  24. lightning_sdk/lightning_cloud/openapi/api/jobs_service_api.py +752 -106
  25. lightning_sdk/lightning_cloud/openapi/api/storage_service_api.py +93 -0
  26. lightning_sdk/lightning_cloud/openapi/models/__init__.py +19 -0
  27. lightning_sdk/lightning_cloud/openapi/models/assistant_id_conversations_body.py +53 -1
  28. lightning_sdk/lightning_cloud/openapi/models/cloudspaces_id_body.py +53 -1
  29. lightning_sdk/lightning_cloud/openapi/models/create_deployment_request_defines_a_spec_for_the_job_that_allows_for_autoscaling_jobs.py +27 -1
  30. lightning_sdk/lightning_cloud/openapi/models/deployment_id_alertingpolicies_body.py +357 -0
  31. lightning_sdk/lightning_cloud/openapi/models/deployment_id_alertingpolicies_body1.py +331 -0
  32. lightning_sdk/lightning_cloud/openapi/models/deployments_id_body.py +79 -1
  33. lightning_sdk/lightning_cloud/openapi/models/models_id_body.py +123 -0
  34. lightning_sdk/lightning_cloud/openapi/models/orgs_id_body.py +105 -1
  35. lightning_sdk/lightning_cloud/openapi/models/project_id_cloudspaces_body.py +27 -1
  36. lightning_sdk/lightning_cloud/openapi/models/projects_id_body.py +29 -3
  37. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space.py +79 -1
  38. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_environment_template.py +27 -1
  39. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_source_type.py +103 -0
  40. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_tagging_options.py +27 -1
  41. lightning_sdk/lightning_cloud/openapi/models/v1_create_deployment_request.py +27 -1
  42. lightning_sdk/lightning_cloud/openapi/models/v1_data_connection.py +27 -1
  43. lightning_sdk/lightning_cloud/openapi/models/v1_delete_deployment_alerting_policy_response.py +175 -0
  44. lightning_sdk/lightning_cloud/openapi/models/v1_deployment.py +79 -1
  45. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_event.py +487 -0
  46. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_policy.py +409 -0
  47. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_policy_frequency.py +105 -0
  48. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_policy_operation.py +105 -0
  49. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_policy_severity.py +106 -0
  50. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_policy_type.py +111 -0
  51. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_recipients.py +175 -0
  52. lightning_sdk/lightning_cloud/openapi/models/v1_ge_list_deployment_routing_telemetry_response.py +27 -1
  53. lightning_sdk/lightning_cloud/openapi/models/v1_get_cloud_space_instance_open_ports_response.py +123 -0
  54. lightning_sdk/lightning_cloud/openapi/models/v1_get_deployment_routing_telemetry_content_response.py +123 -0
  55. lightning_sdk/lightning_cloud/openapi/models/v1_get_organization_storage_metadata_response.py +331 -0
  56. lightning_sdk/lightning_cloud/openapi/models/v1_get_user_response.py +1 -27
  57. lightning_sdk/lightning_cloud/openapi/models/v1_google_cloud_direct_v1.py +27 -1
  58. lightning_sdk/lightning_cloud/openapi/models/v1_list_deployment_alerting_events_response.py +123 -0
  59. lightning_sdk/lightning_cloud/openapi/models/v1_list_deployment_alerting_policies_response.py +175 -0
  60. lightning_sdk/lightning_cloud/openapi/models/v1_membership.py +27 -1
  61. lightning_sdk/lightning_cloud/openapi/models/v1_organization.py +105 -1
  62. lightning_sdk/lightning_cloud/openapi/models/v1_project.py +27 -1
  63. lightning_sdk/lightning_cloud/openapi/models/v1_project_membership.py +27 -1
  64. lightning_sdk/lightning_cloud/openapi/models/v1_project_settings.py +29 -3
  65. lightning_sdk/lightning_cloud/openapi/models/v1_project_storage.py +53 -1
  66. lightning_sdk/lightning_cloud/openapi/models/v1_routing_telemetry.py +253 -0
  67. lightning_sdk/lightning_cloud/openapi/models/v1_server_alert_type.py +1 -0
  68. lightning_sdk/lightning_cloud/openapi/models/v1_sleep_server_response.py +97 -0
  69. lightning_sdk/lightning_cloud/openapi/models/v1_update_user_request.py +1 -27
  70. lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +105 -53
  71. lightning_sdk/lightning_cloud/openapi/models/v1_user_requested_compute_config.py +27 -1
  72. lightning_sdk/llm/llm.py +54 -8
  73. lightning_sdk/studio.py +40 -1
  74. lightning_sdk/teamspace.py +68 -0
  75. {lightning_sdk-0.2.15.dist-info → lightning_sdk-0.2.17.dist-info}/METADATA +1 -1
  76. {lightning_sdk-0.2.15.dist-info → lightning_sdk-0.2.17.dist-info}/RECORD +80 -58
  77. {lightning_sdk-0.2.15.dist-info → lightning_sdk-0.2.17.dist-info}/LICENSE +0 -0
  78. {lightning_sdk-0.2.15.dist-info → lightning_sdk-0.2.17.dist-info}/WHEEL +0 -0
  79. {lightning_sdk-0.2.15.dist-info → lightning_sdk-0.2.17.dist-info}/entry_points.txt +0 -0
  80. {lightning_sdk-0.2.15.dist-info → lightning_sdk-0.2.17.dist-info}/top_level.txt +0 -0
@@ -47,7 +47,9 @@ class V1UserFeatures(object):
47
47
  'auto_fast_load': 'bool',
48
48
  'auto_join_orgs': 'bool',
49
49
  'auto_top_up': 'bool',
50
+ 'auto_top_up_teamspace': 'bool',
50
51
  'b2c_experience': 'bool',
52
+ 'big_default_cpus': 'bool',
51
53
  'byoc_litcr': 'bool',
52
54
  'cap_add': 'list[str]',
53
55
  'cap_drop': 'list[str]',
@@ -68,6 +70,7 @@ class V1UserFeatures(object):
68
70
  'deployment_requests_tab': 'bool',
69
71
  'dgx_cloud': 'bool',
70
72
  'docs_agent': 'bool',
73
+ 'down_switch_machine': 'bool',
71
74
  'drive_v2': 'bool',
72
75
  'enable_storage_limits': 'bool',
73
76
  'enterprise_compute_admin': 'bool',
@@ -112,14 +115,13 @@ class V1UserFeatures(object):
112
115
  'restartable_jobs': 'bool',
113
116
  'runnable_public_studio_page': 'bool',
114
117
  'security_docs': 'bool',
118
+ 'seoul_aws_region': 'bool',
115
119
  'show_dev_admin': 'bool',
116
120
  'single_wallet': 'bool',
117
121
  'slurm': 'bool',
118
122
  'slurm_machine_selector': 'bool',
119
- 'stable_vscode_server': 'bool',
120
123
  'stop_ide_container_on_shutdown': 'bool',
121
124
  'studio_config': 'bool',
122
- 'studio_on_stop': 'bool',
123
125
  'studio_version_visibility': 'bool',
124
126
  'studios_dashboard': 'bool',
125
127
  'studios_dashboard_system_metrics': 'bool',
@@ -138,7 +140,9 @@ class V1UserFeatures(object):
138
140
  'auto_fast_load': 'autoFastLoad',
139
141
  'auto_join_orgs': 'autoJoinOrgs',
140
142
  'auto_top_up': 'autoTopUp',
143
+ 'auto_top_up_teamspace': 'autoTopUpTeamspace',
141
144
  'b2c_experience': 'b2cExperience',
145
+ 'big_default_cpus': 'bigDefaultCpus',
142
146
  'byoc_litcr': 'byocLitcr',
143
147
  'cap_add': 'capAdd',
144
148
  'cap_drop': 'capDrop',
@@ -159,6 +163,7 @@ class V1UserFeatures(object):
159
163
  'deployment_requests_tab': 'deploymentRequestsTab',
160
164
  'dgx_cloud': 'dgxCloud',
161
165
  'docs_agent': 'docsAgent',
166
+ 'down_switch_machine': 'downSwitchMachine',
162
167
  'drive_v2': 'driveV2',
163
168
  'enable_storage_limits': 'enableStorageLimits',
164
169
  'enterprise_compute_admin': 'enterpriseComputeAdmin',
@@ -203,14 +208,13 @@ class V1UserFeatures(object):
203
208
  'restartable_jobs': 'restartableJobs',
204
209
  'runnable_public_studio_page': 'runnablePublicStudioPage',
205
210
  'security_docs': 'securityDocs',
211
+ 'seoul_aws_region': 'seoulAwsRegion',
206
212
  'show_dev_admin': 'showDevAdmin',
207
213
  'single_wallet': 'singleWallet',
208
214
  'slurm': 'slurm',
209
215
  'slurm_machine_selector': 'slurmMachineSelector',
210
- 'stable_vscode_server': 'stableVscodeServer',
211
216
  'stop_ide_container_on_shutdown': 'stopIdeContainerOnShutdown',
212
217
  'studio_config': 'studioConfig',
213
- 'studio_on_stop': 'studioOnStop',
214
218
  'studio_version_visibility': 'studioVersionVisibility',
215
219
  'studios_dashboard': 'studiosDashboard',
216
220
  'studios_dashboard_system_metrics': 'studiosDashboardSystemMetrics',
@@ -222,7 +226,7 @@ class V1UserFeatures(object):
222
226
  'weka': 'weka'
223
227
  }
224
228
 
225
- def __init__(self, affiliate_links: 'bool' =None, agents_v2: 'bool' =None, ai_hub_monetization: 'bool' =None, auto_fast_load: 'bool' =None, auto_join_orgs: 'bool' =None, auto_top_up: 'bool' =None, b2c_experience: 'bool' =None, byoc_litcr: '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, cloud_space_environment_templates: 'bool' =None, cloudy_vibe_code: 'bool' =None, code_tab: 'bool' =None, collab_screen_sharing: 'bool' =None, concurrent_gpu_limit: 'bool' =None, cost_attribution_settings: 'bool' =None, custom_app_domain: 'bool' =None, datasets: 'bool' =None, default_one_cluster: 'bool' =None, deployment_alerts: 'bool' =None, deployment_persistent_disk: 'bool' =None, deployment_requests_tab: 'bool' =None, dgx_cloud: 'bool' =None, docs_agent: 'bool' =None, drive_v2: 'bool' =None, enable_storage_limits: 'bool' =None, enterprise_compute_admin: 'bool' =None, fair_share: 'bool' =None, featured_studios_admin: 'bool' =None, filestore: 'bool' =None, gcs_folders: 'bool' =None, inactive_notify_delete: 'bool' =None, instant_capacity_reservation: 'bool' =None, job_artifacts_v2: 'bool' =None, lambda_labs: 'bool' =None, landing_studios: 'bool' =None, lightning_cloud: 'bool' =None, lit_logger: 'bool' =None, manage_storage_costs: 'bool' =None, marketplace: 'bool' =None, mmt_fault_tolerance: 'bool' =None, mmt_strategy_selector: 'bool' =None, multicloud_folders: 'bool' =None, multicloud_saas: 'bool' =None, multiple_studio_versions: 'bool' =None, nebius: 'bool' =None, neocloud_studios: 'bool' =None, nerf_fs_nonpaying: 'bool' =None, org_level_member_permissions: 'bool' =None, org_usage_limits: 'bool' =None, paygo_free_storage_limit_check: 'bool' =None, pipelines: '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_service: '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, 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, slurm_machine_selector: 'bool' =None, stable_vscode_server: 'bool' =None, stop_ide_container_on_shutdown: 'bool' =None, studio_config: 'bool' =None, studio_on_stop: 'bool' =None, studio_version_visibility: 'bool' =None, studios_dashboard: 'bool' =None, studios_dashboard_system_metrics: 'bool' =None, teamspace_storage_tab: 'bool' =None, trainium2: 'bool' =None, use_rclone_mounts_only: 'bool' =None, voltage_park: 'bool' =None, vultr: 'bool' =None, weka: 'bool' =None): # noqa: E501
229
+ def __init__(self, affiliate_links: 'bool' =None, agents_v2: 'bool' =None, ai_hub_monetization: 'bool' =None, auto_fast_load: 'bool' =None, auto_join_orgs: 'bool' =None, auto_top_up: 'bool' =None, auto_top_up_teamspace: 'bool' =None, b2c_experience: 'bool' =None, big_default_cpus: 'bool' =None, byoc_litcr: '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, cloud_space_environment_templates: 'bool' =None, cloudy_vibe_code: 'bool' =None, code_tab: 'bool' =None, collab_screen_sharing: 'bool' =None, concurrent_gpu_limit: 'bool' =None, cost_attribution_settings: 'bool' =None, custom_app_domain: 'bool' =None, datasets: 'bool' =None, default_one_cluster: 'bool' =None, deployment_alerts: 'bool' =None, deployment_persistent_disk: 'bool' =None, deployment_requests_tab: 'bool' =None, dgx_cloud: 'bool' =None, docs_agent: 'bool' =None, down_switch_machine: 'bool' =None, drive_v2: 'bool' =None, enable_storage_limits: 'bool' =None, enterprise_compute_admin: 'bool' =None, fair_share: 'bool' =None, featured_studios_admin: 'bool' =None, filestore: 'bool' =None, gcs_folders: 'bool' =None, inactive_notify_delete: 'bool' =None, instant_capacity_reservation: 'bool' =None, job_artifacts_v2: 'bool' =None, lambda_labs: 'bool' =None, landing_studios: 'bool' =None, lightning_cloud: 'bool' =None, lit_logger: 'bool' =None, manage_storage_costs: 'bool' =None, marketplace: 'bool' =None, mmt_fault_tolerance: 'bool' =None, mmt_strategy_selector: 'bool' =None, multicloud_folders: 'bool' =None, multicloud_saas: 'bool' =None, multiple_studio_versions: 'bool' =None, nebius: 'bool' =None, neocloud_studios: 'bool' =None, nerf_fs_nonpaying: 'bool' =None, org_level_member_permissions: 'bool' =None, org_usage_limits: 'bool' =None, paygo_free_storage_limit_check: 'bool' =None, pipelines: '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_service: '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, restartable_jobs: 'bool' =None, runnable_public_studio_page: 'bool' =None, security_docs: 'bool' =None, seoul_aws_region: 'bool' =None, show_dev_admin: 'bool' =None, single_wallet: 'bool' =None, slurm: 'bool' =None, slurm_machine_selector: 'bool' =None, stop_ide_container_on_shutdown: 'bool' =None, studio_config: 'bool' =None, studio_version_visibility: 'bool' =None, studios_dashboard: 'bool' =None, studios_dashboard_system_metrics: 'bool' =None, teamspace_storage_tab: 'bool' =None, trainium2: 'bool' =None, use_rclone_mounts_only: 'bool' =None, voltage_park: 'bool' =None, vultr: 'bool' =None, weka: 'bool' =None): # noqa: E501
226
230
  """V1UserFeatures - a model defined in Swagger""" # noqa: E501
227
231
  self._affiliate_links = None
228
232
  self._agents_v2 = None
@@ -230,7 +234,9 @@ class V1UserFeatures(object):
230
234
  self._auto_fast_load = None
231
235
  self._auto_join_orgs = None
232
236
  self._auto_top_up = None
237
+ self._auto_top_up_teamspace = None
233
238
  self._b2c_experience = None
239
+ self._big_default_cpus = None
234
240
  self._byoc_litcr = None
235
241
  self._cap_add = None
236
242
  self._cap_drop = None
@@ -251,6 +257,7 @@ class V1UserFeatures(object):
251
257
  self._deployment_requests_tab = None
252
258
  self._dgx_cloud = None
253
259
  self._docs_agent = None
260
+ self._down_switch_machine = None
254
261
  self._drive_v2 = None
255
262
  self._enable_storage_limits = None
256
263
  self._enterprise_compute_admin = None
@@ -295,14 +302,13 @@ class V1UserFeatures(object):
295
302
  self._restartable_jobs = None
296
303
  self._runnable_public_studio_page = None
297
304
  self._security_docs = None
305
+ self._seoul_aws_region = None
298
306
  self._show_dev_admin = None
299
307
  self._single_wallet = None
300
308
  self._slurm = None
301
309
  self._slurm_machine_selector = None
302
- self._stable_vscode_server = None
303
310
  self._stop_ide_container_on_shutdown = None
304
311
  self._studio_config = None
305
- self._studio_on_stop = None
306
312
  self._studio_version_visibility = None
307
313
  self._studios_dashboard = None
308
314
  self._studios_dashboard_system_metrics = None
@@ -325,8 +331,12 @@ class V1UserFeatures(object):
325
331
  self.auto_join_orgs = auto_join_orgs
326
332
  if auto_top_up is not None:
327
333
  self.auto_top_up = auto_top_up
334
+ if auto_top_up_teamspace is not None:
335
+ self.auto_top_up_teamspace = auto_top_up_teamspace
328
336
  if b2c_experience is not None:
329
337
  self.b2c_experience = b2c_experience
338
+ if big_default_cpus is not None:
339
+ self.big_default_cpus = big_default_cpus
330
340
  if byoc_litcr is not None:
331
341
  self.byoc_litcr = byoc_litcr
332
342
  if cap_add is not None:
@@ -367,6 +377,8 @@ class V1UserFeatures(object):
367
377
  self.dgx_cloud = dgx_cloud
368
378
  if docs_agent is not None:
369
379
  self.docs_agent = docs_agent
380
+ if down_switch_machine is not None:
381
+ self.down_switch_machine = down_switch_machine
370
382
  if drive_v2 is not None:
371
383
  self.drive_v2 = drive_v2
372
384
  if enable_storage_limits is not None:
@@ -455,6 +467,8 @@ class V1UserFeatures(object):
455
467
  self.runnable_public_studio_page = runnable_public_studio_page
456
468
  if security_docs is not None:
457
469
  self.security_docs = security_docs
470
+ if seoul_aws_region is not None:
471
+ self.seoul_aws_region = seoul_aws_region
458
472
  if show_dev_admin is not None:
459
473
  self.show_dev_admin = show_dev_admin
460
474
  if single_wallet is not None:
@@ -463,14 +477,10 @@ class V1UserFeatures(object):
463
477
  self.slurm = slurm
464
478
  if slurm_machine_selector is not None:
465
479
  self.slurm_machine_selector = slurm_machine_selector
466
- if stable_vscode_server is not None:
467
- self.stable_vscode_server = stable_vscode_server
468
480
  if stop_ide_container_on_shutdown is not None:
469
481
  self.stop_ide_container_on_shutdown = stop_ide_container_on_shutdown
470
482
  if studio_config is not None:
471
483
  self.studio_config = studio_config
472
- if studio_on_stop is not None:
473
- self.studio_on_stop = studio_on_stop
474
484
  if studio_version_visibility is not None:
475
485
  self.studio_version_visibility = studio_version_visibility
476
486
  if studios_dashboard is not None:
@@ -616,6 +626,27 @@ class V1UserFeatures(object):
616
626
 
617
627
  self._auto_top_up = auto_top_up
618
628
 
629
+ @property
630
+ def auto_top_up_teamspace(self) -> 'bool':
631
+ """Gets the auto_top_up_teamspace of this V1UserFeatures. # noqa: E501
632
+
633
+
634
+ :return: The auto_top_up_teamspace of this V1UserFeatures. # noqa: E501
635
+ :rtype: bool
636
+ """
637
+ return self._auto_top_up_teamspace
638
+
639
+ @auto_top_up_teamspace.setter
640
+ def auto_top_up_teamspace(self, auto_top_up_teamspace: 'bool'):
641
+ """Sets the auto_top_up_teamspace of this V1UserFeatures.
642
+
643
+
644
+ :param auto_top_up_teamspace: The auto_top_up_teamspace of this V1UserFeatures. # noqa: E501
645
+ :type: bool
646
+ """
647
+
648
+ self._auto_top_up_teamspace = auto_top_up_teamspace
649
+
619
650
  @property
620
651
  def b2c_experience(self) -> 'bool':
621
652
  """Gets the b2c_experience of this V1UserFeatures. # noqa: E501
@@ -637,6 +668,27 @@ class V1UserFeatures(object):
637
668
 
638
669
  self._b2c_experience = b2c_experience
639
670
 
671
+ @property
672
+ def big_default_cpus(self) -> 'bool':
673
+ """Gets the big_default_cpus of this V1UserFeatures. # noqa: E501
674
+
675
+
676
+ :return: The big_default_cpus of this V1UserFeatures. # noqa: E501
677
+ :rtype: bool
678
+ """
679
+ return self._big_default_cpus
680
+
681
+ @big_default_cpus.setter
682
+ def big_default_cpus(self, big_default_cpus: 'bool'):
683
+ """Sets the big_default_cpus of this V1UserFeatures.
684
+
685
+
686
+ :param big_default_cpus: The big_default_cpus of this V1UserFeatures. # noqa: E501
687
+ :type: bool
688
+ """
689
+
690
+ self._big_default_cpus = big_default_cpus
691
+
640
692
  @property
641
693
  def byoc_litcr(self) -> 'bool':
642
694
  """Gets the byoc_litcr of this V1UserFeatures. # noqa: E501
@@ -1057,6 +1109,27 @@ class V1UserFeatures(object):
1057
1109
 
1058
1110
  self._docs_agent = docs_agent
1059
1111
 
1112
+ @property
1113
+ def down_switch_machine(self) -> 'bool':
1114
+ """Gets the down_switch_machine of this V1UserFeatures. # noqa: E501
1115
+
1116
+
1117
+ :return: The down_switch_machine of this V1UserFeatures. # noqa: E501
1118
+ :rtype: bool
1119
+ """
1120
+ return self._down_switch_machine
1121
+
1122
+ @down_switch_machine.setter
1123
+ def down_switch_machine(self, down_switch_machine: 'bool'):
1124
+ """Sets the down_switch_machine of this V1UserFeatures.
1125
+
1126
+
1127
+ :param down_switch_machine: The down_switch_machine of this V1UserFeatures. # noqa: E501
1128
+ :type: bool
1129
+ """
1130
+
1131
+ self._down_switch_machine = down_switch_machine
1132
+
1060
1133
  @property
1061
1134
  def drive_v2(self) -> 'bool':
1062
1135
  """Gets the drive_v2 of this V1UserFeatures. # noqa: E501
@@ -1981,6 +2054,27 @@ class V1UserFeatures(object):
1981
2054
 
1982
2055
  self._security_docs = security_docs
1983
2056
 
2057
+ @property
2058
+ def seoul_aws_region(self) -> 'bool':
2059
+ """Gets the seoul_aws_region of this V1UserFeatures. # noqa: E501
2060
+
2061
+
2062
+ :return: The seoul_aws_region of this V1UserFeatures. # noqa: E501
2063
+ :rtype: bool
2064
+ """
2065
+ return self._seoul_aws_region
2066
+
2067
+ @seoul_aws_region.setter
2068
+ def seoul_aws_region(self, seoul_aws_region: 'bool'):
2069
+ """Sets the seoul_aws_region of this V1UserFeatures.
2070
+
2071
+
2072
+ :param seoul_aws_region: The seoul_aws_region of this V1UserFeatures. # noqa: E501
2073
+ :type: bool
2074
+ """
2075
+
2076
+ self._seoul_aws_region = seoul_aws_region
2077
+
1984
2078
  @property
1985
2079
  def show_dev_admin(self) -> 'bool':
1986
2080
  """Gets the show_dev_admin of this V1UserFeatures. # noqa: E501
@@ -2065,27 +2159,6 @@ class V1UserFeatures(object):
2065
2159
 
2066
2160
  self._slurm_machine_selector = slurm_machine_selector
2067
2161
 
2068
- @property
2069
- def stable_vscode_server(self) -> 'bool':
2070
- """Gets the stable_vscode_server of this V1UserFeatures. # noqa: E501
2071
-
2072
-
2073
- :return: The stable_vscode_server of this V1UserFeatures. # noqa: E501
2074
- :rtype: bool
2075
- """
2076
- return self._stable_vscode_server
2077
-
2078
- @stable_vscode_server.setter
2079
- def stable_vscode_server(self, stable_vscode_server: 'bool'):
2080
- """Sets the stable_vscode_server of this V1UserFeatures.
2081
-
2082
-
2083
- :param stable_vscode_server: The stable_vscode_server of this V1UserFeatures. # noqa: E501
2084
- :type: bool
2085
- """
2086
-
2087
- self._stable_vscode_server = stable_vscode_server
2088
-
2089
2162
  @property
2090
2163
  def stop_ide_container_on_shutdown(self) -> 'bool':
2091
2164
  """Gets the stop_ide_container_on_shutdown of this V1UserFeatures. # noqa: E501
@@ -2128,27 +2201,6 @@ class V1UserFeatures(object):
2128
2201
 
2129
2202
  self._studio_config = studio_config
2130
2203
 
2131
- @property
2132
- def studio_on_stop(self) -> 'bool':
2133
- """Gets the studio_on_stop of this V1UserFeatures. # noqa: E501
2134
-
2135
-
2136
- :return: The studio_on_stop of this V1UserFeatures. # noqa: E501
2137
- :rtype: bool
2138
- """
2139
- return self._studio_on_stop
2140
-
2141
- @studio_on_stop.setter
2142
- def studio_on_stop(self, studio_on_stop: 'bool'):
2143
- """Sets the studio_on_stop of this V1UserFeatures.
2144
-
2145
-
2146
- :param studio_on_stop: The studio_on_stop of this V1UserFeatures. # noqa: E501
2147
- :type: bool
2148
- """
2149
-
2150
- self._studio_on_stop = studio_on_stop
2151
-
2152
2204
  @property
2153
2205
  def studio_version_visibility(self) -> 'bool':
2154
2206
  """Gets the studio_version_visibility of this V1UserFeatures. # noqa: E501
@@ -42,6 +42,7 @@ class V1UserRequestedComputeConfig(object):
42
42
  """
43
43
  swagger_types = {
44
44
  'affinity_identifier': 'str',
45
+ 'cluster_override': 'str',
45
46
  'count': 'int',
46
47
  'cpu_image_override': 'str',
47
48
  'disk_size': 'int',
@@ -56,6 +57,7 @@ class V1UserRequestedComputeConfig(object):
56
57
 
57
58
  attribute_map = {
58
59
  'affinity_identifier': 'affinityIdentifier',
60
+ 'cluster_override': 'clusterOverride',
59
61
  'count': 'count',
60
62
  'cpu_image_override': 'cpuImageOverride',
61
63
  'disk_size': 'diskSize',
@@ -68,9 +70,10 @@ class V1UserRequestedComputeConfig(object):
68
70
  'spot': 'spot'
69
71
  }
70
72
 
71
- def __init__(self, affinity_identifier: 'str' =None, count: 'int' =None, cpu_image_override: 'str' =None, disk_size: 'int' =None, gpu_image_override: 'str' =None, id: 'str' =None, name: 'str' =None, requested_run_duration_seconds: 'str' =None, same_compute_on_resume: 'bool' =None, shm_size: 'int' =None, spot: 'bool' =None): # noqa: E501
73
+ def __init__(self, affinity_identifier: 'str' =None, cluster_override: 'str' =None, count: 'int' =None, cpu_image_override: 'str' =None, disk_size: 'int' =None, gpu_image_override: 'str' =None, id: 'str' =None, name: 'str' =None, requested_run_duration_seconds: 'str' =None, same_compute_on_resume: 'bool' =None, shm_size: 'int' =None, spot: 'bool' =None): # noqa: E501
72
74
  """V1UserRequestedComputeConfig - a model defined in Swagger""" # noqa: E501
73
75
  self._affinity_identifier = None
76
+ self._cluster_override = None
74
77
  self._count = None
75
78
  self._cpu_image_override = None
76
79
  self._disk_size = None
@@ -84,6 +87,8 @@ class V1UserRequestedComputeConfig(object):
84
87
  self.discriminator = None
85
88
  if affinity_identifier is not None:
86
89
  self.affinity_identifier = affinity_identifier
90
+ if cluster_override is not None:
91
+ self.cluster_override = cluster_override
87
92
  if count is not None:
88
93
  self.count = count
89
94
  if cpu_image_override is not None:
@@ -128,6 +133,27 @@ class V1UserRequestedComputeConfig(object):
128
133
 
129
134
  self._affinity_identifier = affinity_identifier
130
135
 
136
+ @property
137
+ def cluster_override(self) -> 'str':
138
+ """Gets the cluster_override of this V1UserRequestedComputeConfig. # noqa: E501
139
+
140
+
141
+ :return: The cluster_override of this V1UserRequestedComputeConfig. # noqa: E501
142
+ :rtype: str
143
+ """
144
+ return self._cluster_override
145
+
146
+ @cluster_override.setter
147
+ def cluster_override(self, cluster_override: 'str'):
148
+ """Sets the cluster_override of this V1UserRequestedComputeConfig.
149
+
150
+
151
+ :param cluster_override: The cluster_override of this V1UserRequestedComputeConfig. # noqa: E501
152
+ :type: str
153
+ """
154
+
155
+ self._cluster_override = cluster_override
156
+
131
157
  @property
132
158
  def count(self) -> 'int':
133
159
  """Gets the count of this V1UserRequestedComputeConfig. # noqa: E501
lightning_sdk/llm/llm.py CHANGED
@@ -1,3 +1,5 @@
1
+ import os
2
+ import warnings
1
3
  from typing import Dict, Generator, List, Optional, Set, Tuple, Union
2
4
 
3
5
  from lightning_sdk.api.llm_api import LLMApi
@@ -8,7 +10,7 @@ from lightning_sdk.lightning_cloud.openapi.rest import ApiException
8
10
  from lightning_sdk.organization import Organization
9
11
  from lightning_sdk.owner import Owner
10
12
  from lightning_sdk.teamspace import Teamspace
11
- from lightning_sdk.utils.resolve import _get_authed_user, _resolve_org
13
+ from lightning_sdk.utils.resolve import _get_authed_user, _resolve_org, _resolve_teamspace
12
14
 
13
15
 
14
16
  class LLM:
@@ -36,32 +38,60 @@ class LLM:
36
38
  user = _get_authed_user()
37
39
  possible_teamspaces = menu._get_possible_teamspaces(user)
38
40
  if teamspace is None:
39
- if len(possible_teamspaces) == 1:
40
- teamspace_name = next(iter(possible_teamspaces.values()))["name"]
41
- self._teamspace = Teamspace(name=teamspace_name, org=None, user=user)
42
- else:
43
- self._teamspace = menu._resolve_teamspace(teamspace)
41
+ # get current teamspace
42
+ self._teamspace = _resolve_teamspace(teamspace=None, org=None, user=None)
44
43
  else:
45
44
  self._teamspace = Teamspace(**menu._get_teamspace_from_name(teamspace, possible_teamspaces))
46
45
 
46
+ if self._teamspace is None:
47
+ # select the first available teamspace
48
+ first_teamspace = next(iter(possible_teamspaces.values()), None)
49
+
50
+ if first_teamspace:
51
+ self._teamspace = Teamspace(
52
+ name=first_teamspace["name"],
53
+ org=first_teamspace["org"],
54
+ user=first_teamspace["user"],
55
+ )
56
+ warnings.warn(
57
+ f"No teamspace given. Using teamspace: {self._teamspace.name}.",
58
+ UserWarning,
59
+ stacklevel=2,
60
+ )
61
+
47
62
  if self._teamspace is None:
48
63
  raise ValueError("Teamspace is required for billing but could not be resolved. ")
49
64
 
50
65
  self._user = user
51
66
 
52
67
  self._model_provider, self._model_name = self._parse_model_name(name)
68
+
69
+ self._llm_api = LLMApi()
70
+
53
71
  try:
54
72
  # check if it is a org model
55
73
  self._org = _resolve_org(self._model_provider)
74
+
75
+ try:
76
+ # check if user has access to the org
77
+ self._org_models = self._build_model_lookup(self._get_org_models())
78
+ except ApiException:
79
+ warnings.warn(
80
+ f"User is not authenticated to access the model in organization: '{self._model_provider}'.\n"
81
+ " Proceeding with appropriate org models, user models, or public models.",
82
+ UserWarning,
83
+ stacklevel=2,
84
+ )
85
+ self._model_provider = None
86
+ raise
56
87
  except ApiException:
57
88
  if isinstance(self._teamspace.owner, Organization):
58
89
  self._org = self._teamspace.owner
59
90
  else:
60
91
  self._org = None
92
+ self._org_models = self._build_model_lookup(self._get_org_models())
61
93
 
62
- self._llm_api = LLMApi()
63
94
  self._public_models = self._build_model_lookup(self._get_public_models())
64
- self._org_models = self._build_model_lookup(self._get_org_models())
65
95
  self._user_models = self._build_model_lookup(self._get_user_models())
66
96
  self._model = self._get_model()
67
97
  self._conversations = {}
@@ -149,22 +179,38 @@ class LLM:
149
179
  prompt: str,
150
180
  system_prompt: Optional[str] = None,
151
181
  max_completion_tokens: Optional[int] = 500,
182
+ images: Optional[Union[List[str], str]] = None,
152
183
  conversation: Optional[str] = None,
184
+ metadata: Optional[Dict[str, str]] = None,
153
185
  stream: bool = False,
186
+ upload_local_images: bool = False,
187
+ internal_conversation: bool = False,
154
188
  ) -> Union[str, Generator[str, None, None]]:
155
189
  if conversation and conversation not in self._conversations:
156
190
  self._get_conversations()
157
191
 
192
+ if images:
193
+ if isinstance(images, str):
194
+ images = [images]
195
+ for image in images:
196
+ if not isinstance(image, str):
197
+ raise NotImplementedError(f"Image type {type(image)} are not supported yet.")
198
+ if not image.startswith("http") and upload_local_images:
199
+ self._teamspace.upload_file(file_path=image, remote_path=f"images/{os.path.basename(image)}")
200
+
158
201
  conversation_id = self._conversations.get(conversation) if conversation else None
159
202
  output = self._llm_api.start_conversation(
160
203
  prompt=prompt,
161
204
  system_prompt=system_prompt,
162
205
  max_completion_tokens=max_completion_tokens,
206
+ images=images,
163
207
  assistant_id=self._model.id,
164
208
  conversation_id=conversation_id,
165
209
  billing_project_id=self._teamspace.id,
210
+ metadata=metadata,
166
211
  name=conversation,
167
212
  stream=stream,
213
+ internal_conversation=internal_conversation,
168
214
  )
169
215
  if not stream:
170
216
  if conversation and not conversation_id:
lightning_sdk/studio.py CHANGED
@@ -1,13 +1,16 @@
1
1
  import glob
2
2
  import os
3
3
  import warnings
4
+ from enum import Enum
4
5
  from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Tuple, Union
5
6
 
6
7
  from tqdm.auto import tqdm
7
8
 
9
+ from lightning_sdk.api.cluster_api import ClusterApi
8
10
  from lightning_sdk.api.studio_api import StudioApi
9
11
  from lightning_sdk.api.utils import _machine_to_compute_name
10
12
  from lightning_sdk.constants import _LIGHTNING_DEBUG
13
+ from lightning_sdk.lightning_cloud.openapi import V1CloudSpaceSourceType
11
14
  from lightning_sdk.machine import Machine
12
15
  from lightning_sdk.organization import Organization
13
16
  from lightning_sdk.owner import Owner
@@ -24,6 +27,19 @@ if TYPE_CHECKING:
24
27
  _logger = _setup_logger(__name__)
25
28
 
26
29
 
30
+ class Provider(Enum):
31
+ # Machine providers based on v1CloudProvider
32
+ AWS = "AWS"
33
+ GCP = "GCP"
34
+ VULTR = "VULTR"
35
+ LAMBDA_LABS = "LAMBDA_LABS"
36
+ DGX = "DGX"
37
+ VOLTAGE_PARK = "VOLTAGE_PARK"
38
+ NEBIUS = "NEBIUS"
39
+ CLOUDFLARE = "CLOUDFLARE"
40
+ LIGHTNING = "LIGHTNING"
41
+
42
+
27
43
  class Studio:
28
44
  """A single Lightning AI Studio.
29
45
 
@@ -38,6 +54,8 @@ class Studio:
38
54
  cloud_account: the name of the cloud account, the studio should be created on.
39
55
  Doesn't matter when the studio already exists.
40
56
  create_ok: whether the studio will be created if it does not yet exist. Defaults to True
57
+ provider: the provider of the machine, the studio should be created on.
58
+
41
59
  Note:
42
60
  Since a teamspace can either be owned by an org or by a user directly,
43
61
  only one of the arguments can be provided.
@@ -56,8 +74,11 @@ class Studio:
56
74
  cloud_account: Optional[str] = None,
57
75
  create_ok: bool = True,
58
76
  cluster: Optional[str] = None, # deprecated in favor of cloud_account
77
+ provider: Optional[str] = None,
78
+ source: Optional[V1CloudSpaceSourceType] = None,
59
79
  ) -> None:
60
80
  self._studio_api = StudioApi()
81
+ self._cluster_api = ClusterApi()
61
82
 
62
83
  self._teamspace = _resolve_teamspace(teamspace=teamspace, org=org, user=user)
63
84
  self._cloud_account = _resolve_deprecated_cluster(cloud_account, cluster)
@@ -65,6 +86,16 @@ class Studio:
65
86
 
66
87
  self._plugins = {}
67
88
 
89
+ if provider is not None:
90
+ if isinstance(provider, str) and provider in Provider.__members__:
91
+ provider = Provider(provider)
92
+ else:
93
+ raise ValueError(f"Invalid provider: {provider}. Must be one of {Provider.__members__.keys()}.")
94
+ self._cloud_account = self._cluster_api.get_cluster_provider_mapping(
95
+ self._teamspace.id,
96
+ self._teamspace.owner.id,
97
+ )[provider.value]
98
+
68
99
  if name is None:
69
100
  studio_id = os.environ.get("LIGHTNING_CLOUD_SPACE_ID", None)
70
101
  if studio_id is None:
@@ -76,7 +107,7 @@ class Studio:
76
107
  except ValueError as e:
77
108
  if create_ok:
78
109
  self._studio = self._studio_api.create_studio(
79
- name, self._teamspace.id, cloud_account=self._cloud_account
110
+ name, self._teamspace.id, cloud_account=self._cloud_account, source=source
80
111
  )
81
112
  else:
82
113
  raise ValueError(f"Studio {name} does not exist.") from e
@@ -417,6 +448,14 @@ class Studio:
417
448
  interruptible=interruptible,
418
449
  )
419
450
 
451
+ def create_assistant(self, name: str, port: int) -> None:
452
+ assistant = self._studio_api.create_assistant(
453
+ studio_id=self._studio.id, teamspace_id=self._teamspace.id, port=port, assistant_name=name
454
+ )
455
+ assistant_info = f"Created assisant with name: {assistant.name}, ID: {assistant.id}"
456
+ self._assistant_id = assistant.id
457
+ _logger.info(assistant_info)
458
+
420
459
  @property
421
460
  def auto_sleep(self) -> bool:
422
461
  """Returns if a Studio has auto-sleep enabled."""