lightning-sdk 0.2.15__py3-none-any.whl → 0.2.16__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 (74) 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 +24 -5
  5. lightning_sdk/api/studio_api.py +3 -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 +18 -0
  20. lightning_sdk/lightning_cloud/openapi/api/assistants_service_api.py +121 -0
  21. lightning_sdk/lightning_cloud/openapi/api/cloud_space_service_api.py +105 -0
  22. lightning_sdk/lightning_cloud/openapi/api/cluster_service_api.py +105 -0
  23. lightning_sdk/lightning_cloud/openapi/api/jobs_service_api.py +747 -105
  24. lightning_sdk/lightning_cloud/openapi/api/storage_service_api.py +93 -0
  25. lightning_sdk/lightning_cloud/openapi/models/__init__.py +18 -0
  26. lightning_sdk/lightning_cloud/openapi/models/assistant_id_conversations_body.py +27 -1
  27. lightning_sdk/lightning_cloud/openapi/models/cloudspaces_id_body.py +53 -1
  28. lightning_sdk/lightning_cloud/openapi/models/deployment_id_alertingpolicies_body.py +331 -0
  29. lightning_sdk/lightning_cloud/openapi/models/deployment_id_alertingpolicies_body1.py +305 -0
  30. lightning_sdk/lightning_cloud/openapi/models/deployments_id_body.py +53 -1
  31. lightning_sdk/lightning_cloud/openapi/models/models_id_body.py +123 -0
  32. lightning_sdk/lightning_cloud/openapi/models/orgs_id_body.py +105 -1
  33. lightning_sdk/lightning_cloud/openapi/models/project_id_cloudspaces_body.py +27 -1
  34. lightning_sdk/lightning_cloud/openapi/models/projects_id_body.py +29 -3
  35. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space.py +53 -1
  36. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_source_type.py +103 -0
  37. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_tagging_options.py +27 -1
  38. lightning_sdk/lightning_cloud/openapi/models/v1_delete_deployment_alerting_policy_response.py +175 -0
  39. lightning_sdk/lightning_cloud/openapi/models/v1_deployment.py +53 -1
  40. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_event.py +487 -0
  41. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_policy.py +383 -0
  42. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_policy_frequency.py +105 -0
  43. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_policy_operation.py +105 -0
  44. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_policy_severity.py +106 -0
  45. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_policy_type.py +111 -0
  46. lightning_sdk/lightning_cloud/openapi/models/v1_ge_list_deployment_routing_telemetry_response.py +27 -1
  47. lightning_sdk/lightning_cloud/openapi/models/v1_get_cloud_space_instance_open_ports_response.py +123 -0
  48. lightning_sdk/lightning_cloud/openapi/models/v1_get_deployment_routing_telemetry_content_response.py +123 -0
  49. lightning_sdk/lightning_cloud/openapi/models/v1_get_organization_storage_metadata_response.py +331 -0
  50. lightning_sdk/lightning_cloud/openapi/models/v1_get_user_response.py +1 -27
  51. lightning_sdk/lightning_cloud/openapi/models/v1_google_cloud_direct_v1.py +27 -1
  52. lightning_sdk/lightning_cloud/openapi/models/v1_list_deployment_alerting_events_response.py +123 -0
  53. lightning_sdk/lightning_cloud/openapi/models/v1_list_deployment_alerting_policies_response.py +175 -0
  54. lightning_sdk/lightning_cloud/openapi/models/v1_membership.py +27 -1
  55. lightning_sdk/lightning_cloud/openapi/models/v1_organization.py +105 -1
  56. lightning_sdk/lightning_cloud/openapi/models/v1_project.py +27 -1
  57. lightning_sdk/lightning_cloud/openapi/models/v1_project_membership.py +27 -1
  58. lightning_sdk/lightning_cloud/openapi/models/v1_project_settings.py +29 -3
  59. lightning_sdk/lightning_cloud/openapi/models/v1_project_storage.py +53 -1
  60. lightning_sdk/lightning_cloud/openapi/models/v1_routing_telemetry.py +253 -0
  61. lightning_sdk/lightning_cloud/openapi/models/v1_server_alert_type.py +1 -0
  62. lightning_sdk/lightning_cloud/openapi/models/v1_sleep_server_response.py +97 -0
  63. lightning_sdk/lightning_cloud/openapi/models/v1_update_user_request.py +1 -27
  64. lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +79 -27
  65. lightning_sdk/lightning_cloud/openapi/models/v1_user_requested_compute_config.py +27 -1
  66. lightning_sdk/llm/llm.py +52 -8
  67. lightning_sdk/studio.py +32 -1
  68. lightning_sdk/teamspace.py +68 -0
  69. {lightning_sdk-0.2.15.dist-info → lightning_sdk-0.2.16.dist-info}/METADATA +1 -1
  70. {lightning_sdk-0.2.15.dist-info → lightning_sdk-0.2.16.dist-info}/RECORD +74 -53
  71. {lightning_sdk-0.2.15.dist-info → lightning_sdk-0.2.16.dist-info}/LICENSE +0 -0
  72. {lightning_sdk-0.2.15.dist-info → lightning_sdk-0.2.16.dist-info}/WHEEL +0 -0
  73. {lightning_sdk-0.2.15.dist-info → lightning_sdk-0.2.16.dist-info}/entry_points.txt +0 -0
  74. {lightning_sdk-0.2.15.dist-info → lightning_sdk-0.2.16.dist-info}/top_level.txt +0 -0
@@ -48,6 +48,7 @@ class V1UserFeatures(object):
48
48
  'auto_join_orgs': 'bool',
49
49
  'auto_top_up': 'bool',
50
50
  'b2c_experience': 'bool',
51
+ 'big_default_cpus': 'bool',
51
52
  'byoc_litcr': 'bool',
52
53
  'cap_add': 'list[str]',
53
54
  'cap_drop': 'list[str]',
@@ -68,6 +69,7 @@ class V1UserFeatures(object):
68
69
  'deployment_requests_tab': 'bool',
69
70
  'dgx_cloud': 'bool',
70
71
  'docs_agent': 'bool',
72
+ 'down_switch_machine': 'bool',
71
73
  'drive_v2': 'bool',
72
74
  'enable_storage_limits': 'bool',
73
75
  'enterprise_compute_admin': 'bool',
@@ -112,11 +114,11 @@ class V1UserFeatures(object):
112
114
  'restartable_jobs': 'bool',
113
115
  'runnable_public_studio_page': 'bool',
114
116
  'security_docs': 'bool',
117
+ 'seoul_aws_region': 'bool',
115
118
  'show_dev_admin': 'bool',
116
119
  'single_wallet': 'bool',
117
120
  'slurm': 'bool',
118
121
  'slurm_machine_selector': 'bool',
119
- 'stable_vscode_server': 'bool',
120
122
  'stop_ide_container_on_shutdown': 'bool',
121
123
  'studio_config': 'bool',
122
124
  'studio_on_stop': 'bool',
@@ -139,6 +141,7 @@ class V1UserFeatures(object):
139
141
  'auto_join_orgs': 'autoJoinOrgs',
140
142
  'auto_top_up': 'autoTopUp',
141
143
  'b2c_experience': 'b2cExperience',
144
+ 'big_default_cpus': 'bigDefaultCpus',
142
145
  'byoc_litcr': 'byocLitcr',
143
146
  'cap_add': 'capAdd',
144
147
  'cap_drop': 'capDrop',
@@ -159,6 +162,7 @@ class V1UserFeatures(object):
159
162
  'deployment_requests_tab': 'deploymentRequestsTab',
160
163
  'dgx_cloud': 'dgxCloud',
161
164
  'docs_agent': 'docsAgent',
165
+ 'down_switch_machine': 'downSwitchMachine',
162
166
  'drive_v2': 'driveV2',
163
167
  'enable_storage_limits': 'enableStorageLimits',
164
168
  'enterprise_compute_admin': 'enterpriseComputeAdmin',
@@ -203,11 +207,11 @@ class V1UserFeatures(object):
203
207
  'restartable_jobs': 'restartableJobs',
204
208
  'runnable_public_studio_page': 'runnablePublicStudioPage',
205
209
  'security_docs': 'securityDocs',
210
+ 'seoul_aws_region': 'seoulAwsRegion',
206
211
  'show_dev_admin': 'showDevAdmin',
207
212
  'single_wallet': 'singleWallet',
208
213
  'slurm': 'slurm',
209
214
  'slurm_machine_selector': 'slurmMachineSelector',
210
- 'stable_vscode_server': 'stableVscodeServer',
211
215
  'stop_ide_container_on_shutdown': 'stopIdeContainerOnShutdown',
212
216
  'studio_config': 'studioConfig',
213
217
  'studio_on_stop': 'studioOnStop',
@@ -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, 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_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
226
230
  """V1UserFeatures - a model defined in Swagger""" # noqa: E501
227
231
  self._affiliate_links = None
228
232
  self._agents_v2 = None
@@ -231,6 +235,7 @@ class V1UserFeatures(object):
231
235
  self._auto_join_orgs = None
232
236
  self._auto_top_up = None
233
237
  self._b2c_experience = None
238
+ self._big_default_cpus = None
234
239
  self._byoc_litcr = None
235
240
  self._cap_add = None
236
241
  self._cap_drop = None
@@ -251,6 +256,7 @@ class V1UserFeatures(object):
251
256
  self._deployment_requests_tab = None
252
257
  self._dgx_cloud = None
253
258
  self._docs_agent = None
259
+ self._down_switch_machine = None
254
260
  self._drive_v2 = None
255
261
  self._enable_storage_limits = None
256
262
  self._enterprise_compute_admin = None
@@ -295,11 +301,11 @@ class V1UserFeatures(object):
295
301
  self._restartable_jobs = None
296
302
  self._runnable_public_studio_page = None
297
303
  self._security_docs = None
304
+ self._seoul_aws_region = None
298
305
  self._show_dev_admin = None
299
306
  self._single_wallet = None
300
307
  self._slurm = None
301
308
  self._slurm_machine_selector = None
302
- self._stable_vscode_server = None
303
309
  self._stop_ide_container_on_shutdown = None
304
310
  self._studio_config = None
305
311
  self._studio_on_stop = None
@@ -327,6 +333,8 @@ class V1UserFeatures(object):
327
333
  self.auto_top_up = auto_top_up
328
334
  if b2c_experience is not None:
329
335
  self.b2c_experience = b2c_experience
336
+ if big_default_cpus is not None:
337
+ self.big_default_cpus = big_default_cpus
330
338
  if byoc_litcr is not None:
331
339
  self.byoc_litcr = byoc_litcr
332
340
  if cap_add is not None:
@@ -367,6 +375,8 @@ class V1UserFeatures(object):
367
375
  self.dgx_cloud = dgx_cloud
368
376
  if docs_agent is not None:
369
377
  self.docs_agent = docs_agent
378
+ if down_switch_machine is not None:
379
+ self.down_switch_machine = down_switch_machine
370
380
  if drive_v2 is not None:
371
381
  self.drive_v2 = drive_v2
372
382
  if enable_storage_limits is not None:
@@ -455,6 +465,8 @@ class V1UserFeatures(object):
455
465
  self.runnable_public_studio_page = runnable_public_studio_page
456
466
  if security_docs is not None:
457
467
  self.security_docs = security_docs
468
+ if seoul_aws_region is not None:
469
+ self.seoul_aws_region = seoul_aws_region
458
470
  if show_dev_admin is not None:
459
471
  self.show_dev_admin = show_dev_admin
460
472
  if single_wallet is not None:
@@ -463,8 +475,6 @@ class V1UserFeatures(object):
463
475
  self.slurm = slurm
464
476
  if slurm_machine_selector is not None:
465
477
  self.slurm_machine_selector = slurm_machine_selector
466
- if stable_vscode_server is not None:
467
- self.stable_vscode_server = stable_vscode_server
468
478
  if stop_ide_container_on_shutdown is not None:
469
479
  self.stop_ide_container_on_shutdown = stop_ide_container_on_shutdown
470
480
  if studio_config is not None:
@@ -637,6 +647,27 @@ class V1UserFeatures(object):
637
647
 
638
648
  self._b2c_experience = b2c_experience
639
649
 
650
+ @property
651
+ def big_default_cpus(self) -> 'bool':
652
+ """Gets the big_default_cpus of this V1UserFeatures. # noqa: E501
653
+
654
+
655
+ :return: The big_default_cpus of this V1UserFeatures. # noqa: E501
656
+ :rtype: bool
657
+ """
658
+ return self._big_default_cpus
659
+
660
+ @big_default_cpus.setter
661
+ def big_default_cpus(self, big_default_cpus: 'bool'):
662
+ """Sets the big_default_cpus of this V1UserFeatures.
663
+
664
+
665
+ :param big_default_cpus: The big_default_cpus of this V1UserFeatures. # noqa: E501
666
+ :type: bool
667
+ """
668
+
669
+ self._big_default_cpus = big_default_cpus
670
+
640
671
  @property
641
672
  def byoc_litcr(self) -> 'bool':
642
673
  """Gets the byoc_litcr of this V1UserFeatures. # noqa: E501
@@ -1057,6 +1088,27 @@ class V1UserFeatures(object):
1057
1088
 
1058
1089
  self._docs_agent = docs_agent
1059
1090
 
1091
+ @property
1092
+ def down_switch_machine(self) -> 'bool':
1093
+ """Gets the down_switch_machine of this V1UserFeatures. # noqa: E501
1094
+
1095
+
1096
+ :return: The down_switch_machine of this V1UserFeatures. # noqa: E501
1097
+ :rtype: bool
1098
+ """
1099
+ return self._down_switch_machine
1100
+
1101
+ @down_switch_machine.setter
1102
+ def down_switch_machine(self, down_switch_machine: 'bool'):
1103
+ """Sets the down_switch_machine of this V1UserFeatures.
1104
+
1105
+
1106
+ :param down_switch_machine: The down_switch_machine of this V1UserFeatures. # noqa: E501
1107
+ :type: bool
1108
+ """
1109
+
1110
+ self._down_switch_machine = down_switch_machine
1111
+
1060
1112
  @property
1061
1113
  def drive_v2(self) -> 'bool':
1062
1114
  """Gets the drive_v2 of this V1UserFeatures. # noqa: E501
@@ -1981,6 +2033,27 @@ class V1UserFeatures(object):
1981
2033
 
1982
2034
  self._security_docs = security_docs
1983
2035
 
2036
+ @property
2037
+ def seoul_aws_region(self) -> 'bool':
2038
+ """Gets the seoul_aws_region of this V1UserFeatures. # noqa: E501
2039
+
2040
+
2041
+ :return: The seoul_aws_region of this V1UserFeatures. # noqa: E501
2042
+ :rtype: bool
2043
+ """
2044
+ return self._seoul_aws_region
2045
+
2046
+ @seoul_aws_region.setter
2047
+ def seoul_aws_region(self, seoul_aws_region: 'bool'):
2048
+ """Sets the seoul_aws_region of this V1UserFeatures.
2049
+
2050
+
2051
+ :param seoul_aws_region: The seoul_aws_region of this V1UserFeatures. # noqa: E501
2052
+ :type: bool
2053
+ """
2054
+
2055
+ self._seoul_aws_region = seoul_aws_region
2056
+
1984
2057
  @property
1985
2058
  def show_dev_admin(self) -> 'bool':
1986
2059
  """Gets the show_dev_admin of this V1UserFeatures. # noqa: E501
@@ -2065,27 +2138,6 @@ class V1UserFeatures(object):
2065
2138
 
2066
2139
  self._slurm_machine_selector = slurm_machine_selector
2067
2140
 
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
2141
  @property
2090
2142
  def stop_ide_container_on_shutdown(self) -> 'bool':
2091
2143
  """Gets the stop_ide_container_on_shutdown 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,20 +179,34 @@ 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,
154
187
  ) -> Union[str, Generator[str, None, None]]:
155
188
  if conversation and conversation not in self._conversations:
156
189
  self._get_conversations()
157
190
 
191
+ if images:
192
+ if isinstance(images, str):
193
+ images = [images]
194
+ for image in images:
195
+ if not isinstance(image, str):
196
+ raise NotImplementedError(f"Image type {type(image)} are not supported yet.")
197
+ if not image.startswith("http") and upload_local_images:
198
+ self._teamspace.upload_file(file_path=image, remote_path=f"images/{os.path.basename(image)}")
199
+
158
200
  conversation_id = self._conversations.get(conversation) if conversation else None
159
201
  output = self._llm_api.start_conversation(
160
202
  prompt=prompt,
161
203
  system_prompt=system_prompt,
162
204
  max_completion_tokens=max_completion_tokens,
205
+ images=images,
163
206
  assistant_id=self._model.id,
164
207
  conversation_id=conversation_id,
165
208
  billing_project_id=self._teamspace.id,
209
+ metadata=metadata,
166
210
  name=conversation,
167
211
  stream=stream,
168
212
  )
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
@@ -1,8 +1,11 @@
1
+ import glob
1
2
  import os
2
3
  import warnings
3
4
  from pathlib import Path
4
5
  from typing import TYPE_CHECKING, List, Optional, Tuple, Union
5
6
 
7
+ from tqdm.auto import tqdm
8
+
6
9
  import lightning_sdk
7
10
  from lightning_sdk.agents import Agent
8
11
  from lightning_sdk.api import TeamspaceApi
@@ -401,6 +404,71 @@ class Teamspace:
401
404
  )
402
405
  return self._teamspace_api.list_model_versions(teamspace_id=self.id, model_name=name)
403
406
 
407
+ def upload_file(self, file_path: str, remote_path: Optional[str] = None, progress_bar: bool = True) -> None:
408
+ """Uploads file to given remote path in the Teamspace drive."""
409
+ if remote_path is None:
410
+ remote_path = os.path.split(file_path)[1]
411
+
412
+ self._teamspace_api.upload_file(
413
+ teamspace_id=self._teamspace.id,
414
+ cloud_account=self.default_cloud_account,
415
+ file_path=file_path,
416
+ remote_path=os.path.normpath(remote_path),
417
+ progress_bar=progress_bar,
418
+ )
419
+
420
+ def upload_folder(self, folder_path: str, remote_path: Optional[str] = None, progress_bar: bool = True) -> None:
421
+ """Uploads a given folder to a remote path in the Teamspace drive."""
422
+ if folder_path is None:
423
+ raise ValueError("Cannot upload a folder that is None.")
424
+ folder_path = os.path.normpath(folder_path)
425
+ if os.path.isfile(folder_path):
426
+ raise NotADirectoryError(f"Cannot upload a file as a folder. '{folder_path}' is a file.")
427
+ if not os.path.exists(folder_path):
428
+ raise NotADirectoryError(f"Cannot upload a folder that does not exist. '{folder_path}' is not a directory.")
429
+ all_files = []
430
+ for fp in glob.glob(os.path.join(folder_path, "**"), recursive=True):
431
+ if not os.path.isfile(fp):
432
+ continue
433
+ rel_path = os.path.relpath(fp, folder_path)
434
+ remote_file = os.path.join(remote_path, rel_path) if remote_path else rel_path
435
+ all_files.append((fp, remote_file))
436
+
437
+ if progress_bar:
438
+ progress_bar = tqdm(total=len(all_files), desc="Uploading files", unit="file")
439
+ for local_file, remote_path in sorted(all_files, key=lambda p: p[1]):
440
+ if progress_bar:
441
+ progress_bar.set_description(f"Uploading {local_file}")
442
+ self.upload_file(local_file, remote_path=remote_path, progress_bar=False)
443
+ if progress_bar:
444
+ progress_bar.update(1)
445
+ if progress_bar:
446
+ progress_bar.close()
447
+
448
+ def download_file(self, remote_path: str, file_path: Optional[str] = None) -> None:
449
+ """Downloads a given file in Teamspace drive to a target location."""
450
+ if file_path is None:
451
+ file_path = remote_path
452
+
453
+ self._teamspace_api.download_file(
454
+ path=remote_path,
455
+ target_path=file_path,
456
+ teamspace_id=self._teamspace.id,
457
+ cloud_account=self.default_cloud_account,
458
+ )
459
+
460
+ def download_folder(self, remote_path: str, target_path: Optional[str] = None) -> None:
461
+ """Downloads a folder in the Teamspace drive to a given target path."""
462
+ if target_path is None:
463
+ target_path = remote_path
464
+
465
+ self._teamspace_api.download_folder(
466
+ path=remote_path,
467
+ target_path=target_path,
468
+ teamspace_id=self._teamspace.id,
469
+ cloud_account=self.default_cloud_account,
470
+ )
471
+
404
472
 
405
473
  def _list_files(path: Union[str, Path]) -> Tuple[List[Path], List[str]]:
406
474
  """List all folders in a directory and return them as a list and relative path."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lightning_sdk
3
- Version: 0.2.15
3
+ Version: 0.2.16
4
4
  Summary: SDK to develop using Lightning AI Studios
5
5
  Author-email: Lightning-AI <justus@lightning.ai>
6
6
  License: MIT License