lightning-sdk 2025.8.6rc2__py3-none-any.whl → 2025.11.5__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 +13 -7
- lightning_sdk/__version__.py +3 -0
- lightning_sdk/agents.py +2 -1
- lightning_sdk/ai_hub.py +2 -1
- lightning_sdk/api/__init__.py +2 -0
- lightning_sdk/api/base_studio_api.py +13 -9
- lightning_sdk/api/cloud_account_api.py +31 -10
- lightning_sdk/api/deployment_api.py +27 -1
- lightning_sdk/api/job_api.py +16 -12
- lightning_sdk/api/license_api.py +26 -59
- lightning_sdk/api/llm_api.py +25 -2
- lightning_sdk/api/mmt_api.py +5 -2
- lightning_sdk/api/studio_api.py +252 -55
- lightning_sdk/api/teamspace_api.py +106 -30
- lightning_sdk/api/user_api.py +56 -2
- lightning_sdk/api/utils.py +108 -18
- lightning_sdk/base_studio.py +51 -27
- lightning_sdk/cli/__init__.py +1 -0
- lightning_sdk/cli/base_studio/__init__.py +10 -0
- lightning_sdk/cli/base_studio/list.py +43 -0
- lightning_sdk/cli/config/__init__.py +14 -0
- lightning_sdk/cli/config/get.py +57 -0
- lightning_sdk/cli/config/set.py +92 -0
- lightning_sdk/cli/config/show.py +9 -0
- lightning_sdk/cli/entrypoint.py +71 -71
- lightning_sdk/cli/groups.py +56 -0
- lightning_sdk/cli/job/__init__.py +7 -0
- lightning_sdk/cli/{clusters_menu.py → legacy/clusters_menu.py} +9 -6
- lightning_sdk/cli/{configure.py → legacy/configure.py} +2 -2
- lightning_sdk/cli/{connect.py → legacy/connect.py} +2 -2
- lightning_sdk/cli/{create.py → legacy/create.py} +12 -14
- lightning_sdk/cli/{delete.py → legacy/delete.py} +5 -5
- lightning_sdk/cli/legacy/deploy/__init__.py +0 -0
- lightning_sdk/cli/{deploy → legacy/deploy}/_auth.py +5 -6
- lightning_sdk/cli/{deploy → legacy/deploy}/devbox.py +8 -2
- lightning_sdk/cli/{deploy → legacy/deploy}/serve.py +19 -8
- lightning_sdk/cli/{download.py → legacy/download.py} +14 -15
- lightning_sdk/cli/legacy/entrypoint.py +110 -0
- lightning_sdk/cli/{generate.py → legacy/generate.py} +1 -1
- lightning_sdk/cli/{inspection.py → legacy/inspection.py} +1 -1
- lightning_sdk/cli/{job_and_mmt_action.py → legacy/job_and_mmt_action.py} +6 -6
- lightning_sdk/cli/{jobs_menu.py → legacy/jobs_menu.py} +1 -1
- lightning_sdk/cli/{list.py → legacy/list.py} +12 -13
- lightning_sdk/cli/{mmts_menu.py → legacy/mmts_menu.py} +1 -1
- lightning_sdk/cli/{open.py → legacy/open.py} +4 -4
- lightning_sdk/cli/{start.py → legacy/start.py} +1 -0
- lightning_sdk/cli/{stop.py → legacy/stop.py} +1 -1
- lightning_sdk/cli/{switch.py → legacy/switch.py} +1 -0
- lightning_sdk/cli/{teamspace_menu.py → legacy/teamspace_menu.py} +1 -1
- lightning_sdk/cli/{upload.py → legacy/upload.py} +7 -8
- lightning_sdk/cli/license/__init__.py +14 -0
- lightning_sdk/cli/license/get.py +15 -0
- lightning_sdk/cli/license/list.py +45 -0
- lightning_sdk/cli/license/set.py +13 -0
- lightning_sdk/cli/mmt/__init__.py +7 -0
- lightning_sdk/cli/studio/__init__.py +24 -0
- lightning_sdk/cli/studio/connect.py +139 -0
- lightning_sdk/cli/studio/create.py +96 -0
- lightning_sdk/cli/studio/delete.py +49 -0
- lightning_sdk/cli/studio/list.py +85 -0
- lightning_sdk/cli/studio/ssh.py +64 -0
- lightning_sdk/cli/studio/start.py +115 -0
- lightning_sdk/cli/studio/stop.py +45 -0
- lightning_sdk/cli/studio/switch.py +66 -0
- lightning_sdk/cli/utils/__init__.py +7 -0
- lightning_sdk/cli/utils/cloud_account_map.py +10 -0
- lightning_sdk/cli/utils/get_base_studio.py +24 -0
- lightning_sdk/cli/utils/handle_machine_and_gpus_args.py +69 -0
- lightning_sdk/cli/utils/logging.py +122 -0
- lightning_sdk/cli/utils/owner_selection.py +110 -0
- lightning_sdk/cli/utils/resolve.py +28 -0
- lightning_sdk/cli/utils/richt_print.py +35 -0
- lightning_sdk/cli/utils/save_to_config.py +27 -0
- lightning_sdk/cli/utils/ssh_connection.py +59 -0
- lightning_sdk/cli/utils/studio_selection.py +113 -0
- lightning_sdk/cli/utils/teamspace_selection.py +125 -0
- lightning_sdk/cli/vm/__init__.py +20 -0
- lightning_sdk/cli/vm/create.py +33 -0
- lightning_sdk/cli/vm/delete.py +25 -0
- lightning_sdk/cli/vm/list.py +30 -0
- lightning_sdk/cli/vm/ssh.py +31 -0
- lightning_sdk/cli/vm/start.py +60 -0
- lightning_sdk/cli/vm/stop.py +25 -0
- lightning_sdk/cli/vm/switch.py +38 -0
- lightning_sdk/constants.py +1 -0
- lightning_sdk/deployment/__init__.py +2 -0
- lightning_sdk/deployment/deployment.py +17 -2
- lightning_sdk/helpers.py +56 -37
- lightning_sdk/job/base.py +21 -6
- lightning_sdk/job/job.py +13 -0
- lightning_sdk/job/v1.py +11 -0
- lightning_sdk/job/v2.py +12 -0
- lightning_sdk/lightning_cloud/login.py +320 -10
- lightning_sdk/lightning_cloud/openapi/__init__.py +113 -3
- lightning_sdk/lightning_cloud/openapi/api/__init__.py +3 -0
- lightning_sdk/lightning_cloud/openapi/api/assistants_service_api.py +713 -75
- lightning_sdk/lightning_cloud/openapi/api/auth_service_api.py +376 -0
- lightning_sdk/lightning_cloud/openapi/api/billing_service_api.py +191 -1
- 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 +420 -0
- lightning_sdk/lightning_cloud/openapi/api/cloudy_service_api.py +0 -97
- lightning_sdk/lightning_cloud/openapi/api/cluster_service_api.py +420 -0
- lightning_sdk/lightning_cloud/openapi/api/data_connection_service_api.py +101 -0
- lightning_sdk/lightning_cloud/openapi/api/incidents_service_api.py +1058 -0
- lightning_sdk/lightning_cloud/openapi/api/jobs_service_api.py +121 -0
- lightning_sdk/lightning_cloud/openapi/api/k8_s_cluster_service_api.py +1742 -94
- lightning_sdk/lightning_cloud/openapi/api/markets_service_api.py +145 -0
- lightning_sdk/lightning_cloud/openapi/api/models_store_api.py +4 -4
- lightning_sdk/lightning_cloud/openapi/api/product_license_service_api.py +108 -108
- lightning_sdk/lightning_cloud/openapi/api/projects_service_api.py +105 -0
- lightning_sdk/lightning_cloud/openapi/api/schedules_service_api.py +347 -0
- lightning_sdk/lightning_cloud/openapi/api/sdk_command_history_service_api.py +141 -0
- lightning_sdk/lightning_cloud/openapi/api/storage_service_api.py +761 -1
- lightning_sdk/lightning_cloud/openapi/configuration.py +3 -19
- lightning_sdk/lightning_cloud/openapi/models/__init__.py +110 -3
- lightning_sdk/lightning_cloud/openapi/models/assistant_id_conversations_body.py +15 -15
- lightning_sdk/lightning_cloud/openapi/models/cloudspace_id_visibility_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/cluster_id_kubernetestemplates_body.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/cluster_id_metrics_body.py +131 -1
- lightning_sdk/lightning_cloud/openapi/models/create.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/create_machine_request_represents_the_request_to_create_a_machine.py +461 -0
- lightning_sdk/lightning_cloud/openapi/models/deployments_id_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/externalv1_cloud_space_instance_status.py +105 -1
- lightning_sdk/lightning_cloud/openapi/models/externalv1_user_status.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/id_codeconfig_body.py +3 -81
- lightning_sdk/lightning_cloud/openapi/models/id_fork_body1.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/id_render_body.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/id_sleepconfig_body.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/id_transfer_body.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/incident_id_messages_body.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/incidents_id_body.py +279 -0
- lightning_sdk/lightning_cloud/openapi/models/job_id_reportroutingtelemetry_body.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/kubernetestemplates_id_body.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/license_key_validate_body.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/message_id_actions_body.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/messages_message_id_body.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/metricsstream_create_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/models_model_id_body.py +109 -31
- lightning_sdk/lightning_cloud/openapi/models/models_model_id_body1.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/orgs_id_body.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/project_id_storage_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/project_id_storagetransfers_body.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/project_tab_management_messages.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/projects_id_body.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/storage_complete_body.py +41 -15
- lightning_sdk/lightning_cloud/openapi/models/storagetransfers_validate_body.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/update1.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/uploads_upload_id_body1.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/user_id_affiliatelinks_body.py +107 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_abort_storage_transfer_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_aggregated_pod_metrics.py +799 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_ai_pod_v1.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_assistant_session_daily_aggregated.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_billing_tier.py +0 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cancel_running_cloud_space_instance_transfer_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_provider.py +2 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_environment_template_config.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_specialized_view.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_transfer_metadata.py +147 -17
- lightning_sdk/lightning_cloud/openapi/models/v1_cloudflare_v1.py +3 -29
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_accelerator.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_capacity_reservation.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_metrics.py +1527 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_security_options.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_spec.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_type.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_container_metrics.py +21 -21
- lightning_sdk/lightning_cloud/openapi/models/v1_create_incident_request.py +305 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_license_request.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_machine_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_model_metrics_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_project_request.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_create_sdk_command_history_request.py +253 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_create_sdk_command_history_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_daily_model_metrics.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_data_connection.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_incident_message_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_incident_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_kubernetes_template_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_license_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_delete_machine_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_deployment.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_external_cluster_spec.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_external_search_user.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_filestore_data_connection.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_filesystem_metric.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_firewall_rule.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_cloud_space_required_balance_status_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_cloud_space_transfer_estimate_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_latest_model_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_machine_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_market_pricing_response.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_model_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_temp_bucket_credentials_response.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_get_user_response.py +41 -15
- lightning_sdk/lightning_cloud/openapi/models/v1_google_cloud_direct_v1.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_group_node_metrics.py +1215 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_group_pod_metrics.py +1241 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_guest_login_request.py +177 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_guest_login_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_guest_user.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident.py +565 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_detail.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_event.py +591 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_message.py +253 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_severity.py +105 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_incident_type.py +108 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_job.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_job_spec.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_k8s_incident_indexes.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_kai_scheduler_queue_metrics.py +627 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_aws_config.py +279 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_direct_settings_v1.py +253 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_direct_v1.py +107 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_template.py +357 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_template_property.py +227 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_lambda_labs_direct_v1.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_license.py +227 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_lightning_elastic_cluster_v1.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_aggregated_pod_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_cluster_metric_timestamps_response.py +123 -0
- 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_list_conversation_message_actions_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_filesystem_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_group_pod_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_incident_events_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_incident_messages_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_incidents_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_kai_scheduler_queues_metrics_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_kubernetes_templates_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/{v1_list_product_licenses_response.py → v1_list_license_response.py} +16 -16
- lightning_sdk/lightning_cloud/openapi/models/v1_list_machines_response.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_platform_notifications_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_schedule_runs_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_storage_transfers_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_lustre_data_connection.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_machine.py +617 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_machine_direct_v1.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_magic_link_login_request.py +1 -27
- lightning_sdk/lightning_cloud/openapi/models/v1_magic_link_login_response.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_managed_model.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_market_price.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_membership.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_message_action.py +279 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_metrics_stream.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_model_metrics.py +175 -0
- 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_nebius_direct_v1.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_node_metrics.py +361 -23
- lightning_sdk/lightning_cloud/openapi/models/v1_notification_type.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_organization.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_pause_storage_transfer_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_platform_notification.py +279 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_pod_metrics.py +335 -23
- lightning_sdk/lightning_cloud/openapi/models/v1_project.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_project_cluster_binding.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_project_membership.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_project_settings.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_project_tab.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/{v1_product_license_check_response.py → v1_purchase_annual_upsell_request.py} +23 -23
- lightning_sdk/lightning_cloud/openapi/models/v1_purchase_annual_upsell_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_quote_annual_upsell_response.py +227 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_render_kubernetes_template_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_report_deployment_routing_telemetry_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_required_balance_reason.py +107 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_reset_api_key_request.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_reset_api_key_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_resource_visibility.py +1 -27
- lightning_sdk/lightning_cloud/openapi/models/v1_resume_storage_transfer_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_routing_telemetry.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_rule_resource.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_schedule_run.py +357 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_sdk_command_history_severity.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_sdk_command_history_type.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_secret_type.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_server_alert_type.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_slack_notifier.py +201 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_slack_notifier_type.py +105 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_storage_asset.py +133 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_storage_transfer.py +435 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_storage_transfer_status.py +108 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_token_login_request.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_token_login_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_token_owner_type.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_update_cloud_space_instance_config_request.py +3 -81
- lightning_sdk/lightning_cloud/openapi/models/v1_update_project_tab_order_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_update_user_request.py +41 -15
- lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +444 -600
- lightning_sdk/lightning_cloud/openapi/models/v1_validate_license_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_validate_storage_transfer_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_voltage_park_direct_v1.py +29 -3
- lightning_sdk/lightning_cloud/rest_client.py +48 -45
- lightning_sdk/lightning_cloud/utils/data_connection.py +51 -1
- lightning_sdk/llm/llm.py +175 -56
- lightning_sdk/llm/public_assistants.py +44 -7
- lightning_sdk/machine.py +21 -2
- lightning_sdk/mmt/base.py +7 -0
- lightning_sdk/mmt/mmt.py +11 -3
- lightning_sdk/mmt/v1.py +3 -1
- lightning_sdk/mmt/v2.py +4 -0
- lightning_sdk/owner.py +2 -1
- lightning_sdk/pipeline/steps.py +6 -0
- lightning_sdk/plugin.py +6 -1
- lightning_sdk/studio.py +294 -53
- lightning_sdk/teamspace.py +167 -7
- lightning_sdk/user.py +19 -1
- lightning_sdk/utils/config.py +179 -0
- lightning_sdk/utils/license.py +13 -0
- lightning_sdk/utils/logging.py +79 -0
- lightning_sdk/utils/names.py +1179 -0
- lightning_sdk/utils/progress.py +283 -0
- lightning_sdk/utils/resolve.py +82 -7
- {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/METADATA +2 -1
- {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/RECORD +328 -169
- {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/entry_points.txt +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_product_license.py +0 -435
- lightning_sdk/services/license.py +0 -363
- /lightning_sdk/cli/{deploy → legacy}/__init__.py +0 -0
- /lightning_sdk/cli/{ai_hub.py → legacy/ai_hub.py} +0 -0
- /lightning_sdk/cli/{docker_cli.py → legacy/docker_cli.py} +0 -0
- /lightning_sdk/cli/{exceptions.py → legacy/exceptions.py} +0 -0
- /lightning_sdk/cli/{run.py → legacy/run.py} +0 -0
- /lightning_sdk/cli/{studios_menu.py → legacy/studios_menu.py} +0 -0
- /lightning_sdk/cli/{coloring.py → utils/coloring.py} +0 -0
- {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/LICENSE +0 -0
- {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/WHEEL +0 -0
- {lightning_sdk-2025.8.6rc2.dist-info → lightning_sdk-2025.11.5.dist-info}/top_level.txt +0 -0
lightning_sdk/llm/llm.py
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import os
|
|
2
|
-
from
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any, AsyncGenerator, ClassVar, Dict, Generator, List, Literal, Optional, Tuple, Union
|
|
3
4
|
|
|
4
5
|
from lightning_sdk.api import TeamspaceApi, UserApi
|
|
5
6
|
from lightning_sdk.api.llm_api import LLMApi, authenticate
|
|
6
7
|
from lightning_sdk.lightning_cloud.openapi.models.v1_conversation_response_chunk import V1ConversationResponseChunk
|
|
7
8
|
from lightning_sdk.llm.public_assistants import PUBLIC_MODELS
|
|
9
|
+
from lightning_sdk.utils.resolve import _resolve_org, _resolve_teamspace
|
|
8
10
|
|
|
9
11
|
PUBLIC_MODEL_PROVIDERS: Dict[str, str] = {
|
|
10
12
|
"openai": "OpenAI",
|
|
@@ -14,6 +16,38 @@ PUBLIC_MODEL_PROVIDERS: Dict[str, str] = {
|
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
|
|
19
|
+
@dataclass
|
|
20
|
+
class ModelMetadata:
|
|
21
|
+
name: str
|
|
22
|
+
provider: str
|
|
23
|
+
status: str
|
|
24
|
+
context_length: int
|
|
25
|
+
max_completion_tokens: Optional[int]
|
|
26
|
+
prompt_price: float
|
|
27
|
+
completion_price: float
|
|
28
|
+
capabilities: Dict[str, bool]
|
|
29
|
+
throughput: float
|
|
30
|
+
time_to_first_token: float
|
|
31
|
+
|
|
32
|
+
def __str__(self) -> str:
|
|
33
|
+
"""Return a user-friendly string representation of the model metadata.
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
str: A formatted multi-line string containing model information including
|
|
37
|
+
name, provider, status, context length, pricing, performance metrics,
|
|
38
|
+
and key capabilities (images and files support).
|
|
39
|
+
"""
|
|
40
|
+
return f"""
|
|
41
|
+
Model: {self.name}
|
|
42
|
+
Provider: {self.provider}
|
|
43
|
+
Status: {self.status}
|
|
44
|
+
Context Length: {self.context_length:,} tokens
|
|
45
|
+
Pricing: ${self.prompt_price:.2e}/prompt token, ${self.completion_price:.2e}/completion token
|
|
46
|
+
Performance: {self.throughput:.1f} tokens/sec, {self.time_to_first_token:.1f}ms TTFT
|
|
47
|
+
Capabilities: Images={self.capabilities.get('images', False)}, Files={self.capabilities.get('files', False)}
|
|
48
|
+
""".strip()
|
|
49
|
+
|
|
50
|
+
|
|
17
51
|
class LLM:
|
|
18
52
|
_auth_info_cached: ClassVar[bool] = False
|
|
19
53
|
_cached_auth_info: ClassVar[Dict[str, Optional[str]]] = {}
|
|
@@ -31,33 +65,33 @@ class LLM:
|
|
|
31
65
|
) -> None:
|
|
32
66
|
"""Initializes the LLM instance with teamspace information, which is required for billing purposes.
|
|
33
67
|
|
|
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
68
|
Args:
|
|
40
69
|
name (str): The name of the model or resource.
|
|
41
|
-
teamspace (Optional[str]): The specified teamspace for billing. If not provided, it will
|
|
42
|
-
|
|
70
|
+
teamspace (Optional[str]): The specified teamspace for billing. If not provided, it will
|
|
71
|
+
use the available default teamspace.
|
|
43
72
|
enable_async (Optional[bool]): Enable async requests
|
|
44
73
|
|
|
45
74
|
Raises:
|
|
46
75
|
ValueError: If teamspace information cannot be resolved.
|
|
47
76
|
"""
|
|
48
77
|
teamspace_name = None
|
|
78
|
+
teamspace_owner = None
|
|
49
79
|
if teamspace:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
80
|
+
if "/" in teamspace:
|
|
81
|
+
try:
|
|
82
|
+
teamspace_owner, teamspace_name = teamspace.split("/", maxsplit=1)
|
|
83
|
+
except ValueError as e:
|
|
84
|
+
raise ValueError(
|
|
85
|
+
f"Invalid teamspace format: '{teamspace}'. "
|
|
86
|
+
"Teamspace should be specified as '{org}/{teamspace_name}' or '{org}'"
|
|
87
|
+
"(e.g., 'my-org/my-teamspace', 'my-org')."
|
|
88
|
+
) from e
|
|
89
|
+
else:
|
|
90
|
+
# org is given
|
|
91
|
+
teamspace_name = teamspace
|
|
58
92
|
|
|
59
93
|
self._model_provider, self._model_name = self._parse_model_name(name)
|
|
60
|
-
self._get_auth_info(teamspace_name)
|
|
94
|
+
self._get_auth_info(teamspace_owner, teamspace_name)
|
|
61
95
|
|
|
62
96
|
self._enable_async = enable_async
|
|
63
97
|
|
|
@@ -69,6 +103,7 @@ class LLM:
|
|
|
69
103
|
self._context_length = None
|
|
70
104
|
self._model_id = self._get_model_id()
|
|
71
105
|
self._conversations = {}
|
|
106
|
+
self._metadata = None
|
|
72
107
|
|
|
73
108
|
@property
|
|
74
109
|
def name(self) -> str:
|
|
@@ -78,44 +113,116 @@ class LLM:
|
|
|
78
113
|
def provider(self) -> str:
|
|
79
114
|
return self._model_provider
|
|
80
115
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
116
|
+
@property
|
|
117
|
+
def metadata(self) -> ModelMetadata:
|
|
118
|
+
if self._metadata is None:
|
|
119
|
+
model = self._llm_api.get_model_metadata(self._teamspace_id, self._model_name)
|
|
120
|
+
abilities = (
|
|
121
|
+
model.abilities
|
|
122
|
+
or type(
|
|
123
|
+
"obj",
|
|
124
|
+
(object,),
|
|
125
|
+
{"can_receive_images": False, "can_receive_files": False, "can_call_hub_deployment": False},
|
|
126
|
+
)()
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
self._metadata = ModelMetadata(
|
|
130
|
+
name=self._model_name,
|
|
131
|
+
provider=self._model_provider,
|
|
132
|
+
status=model.status,
|
|
133
|
+
context_length=int(model.context_length),
|
|
134
|
+
max_completion_tokens=int(model.max_completion_tokens) if model.max_completion_tokens != "0" else None,
|
|
135
|
+
prompt_price=model.prompt_token_price,
|
|
136
|
+
completion_price=model.completion_token_price,
|
|
137
|
+
capabilities={
|
|
138
|
+
"images": abilities.can_receive_images,
|
|
139
|
+
"files": abilities.can_receive_files,
|
|
140
|
+
"hub_deployment": abilities.can_call_hub_deployment,
|
|
141
|
+
},
|
|
142
|
+
throughput=model.throughput,
|
|
143
|
+
time_to_first_token=model.time_to_first_token,
|
|
144
|
+
)
|
|
145
|
+
return self._metadata
|
|
146
|
+
|
|
147
|
+
@property
|
|
148
|
+
def context_length(self) -> Optional[int]:
|
|
149
|
+
"""Context length for the current model."""
|
|
150
|
+
if self._context_length is None:
|
|
151
|
+
try:
|
|
152
|
+
self._context_length = self.metadata.context_length
|
|
153
|
+
except Exception as e:
|
|
154
|
+
raise ValueError(f"Cannot access context length: {e}") from e
|
|
155
|
+
return self._context_length
|
|
84
156
|
|
|
157
|
+
def get_context_length(self, model: Optional[str] = None) -> Optional[int]:
|
|
158
|
+
"""Get context length for the given model."""
|
|
85
159
|
context_info = self._public_assistants.get(model)
|
|
86
|
-
if context_info
|
|
87
|
-
|
|
160
|
+
if context_info and "context_length" in context_info:
|
|
161
|
+
return int(context_info["context_length"])
|
|
88
162
|
|
|
89
|
-
|
|
163
|
+
try:
|
|
164
|
+
temp_metadata = self._llm_api.get_model_metadata(self._teamspace_id, model)
|
|
165
|
+
return int(temp_metadata.context_length)
|
|
166
|
+
except Exception as e:
|
|
167
|
+
raise ValueError(f"Cannot access context length of model '{model}': {e}") from e
|
|
90
168
|
|
|
91
|
-
def _get_auth_info(self, teamspace_name: Optional[str] = None) -> None:
|
|
92
|
-
# TODO: Validate user input teamspace name
|
|
169
|
+
def _get_auth_info(self, teamspace_owner: Optional[str] = None, teamspace_name: Optional[str] = None) -> None:
|
|
93
170
|
if not LLM._auth_info_cached:
|
|
94
|
-
if
|
|
95
|
-
#
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
171
|
+
if teamspace_owner and teamspace_name:
|
|
172
|
+
# org with specific teamspace
|
|
173
|
+
try:
|
|
174
|
+
t = _resolve_teamspace(teamspace=teamspace_name, org=None, user=teamspace_owner)
|
|
175
|
+
except Exception:
|
|
176
|
+
try:
|
|
177
|
+
t = _resolve_teamspace(teamspace=teamspace_name, org=teamspace_owner, user=None)
|
|
178
|
+
except Exception as err:
|
|
179
|
+
raise ValueError(
|
|
180
|
+
f"Teamspace {teamspace_owner}/{teamspace_name} not found."
|
|
181
|
+
"Please verify owner name (username or organization) and the teamspace name are correct."
|
|
182
|
+
) from err
|
|
183
|
+
|
|
184
|
+
os.environ["LIGHTNING_TEAMSPACE"] = t.name
|
|
185
|
+
os.environ["LIGHTNING_CLOUD_PROJECT_ID"] = t.id
|
|
186
|
+
|
|
187
|
+
elif teamspace_name and teamspace_owner is None:
|
|
188
|
+
# if only org name is given, use the default teamspace
|
|
100
189
|
try:
|
|
101
|
-
|
|
190
|
+
org = _resolve_org(teamspace_name)
|
|
102
191
|
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
|
|
192
|
+
teamspace = teamspace_api.list_teamspaces(org.id)[0]
|
|
193
|
+
|
|
110
194
|
except Exception as err:
|
|
111
|
-
# throw an appropriate error that guides users to login through the platform
|
|
112
195
|
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>."
|
|
196
|
+
f"Organization {teamspace_name} not found. Please verify the organization name."
|
|
116
197
|
) from err
|
|
198
|
+
os.environ["LIGHTNING_CLOUD_PROJECT_ID"] = teamspace.id
|
|
199
|
+
os.environ["LIGHTNING_TEAMSPACE"] = teamspace.name
|
|
200
|
+
|
|
201
|
+
else:
|
|
202
|
+
if teamspace_name is None:
|
|
203
|
+
# studio users
|
|
204
|
+
teamspace_name = os.environ.get("LIGHTNING_TEAMSPACE", None)
|
|
205
|
+
|
|
206
|
+
if teamspace_name is None:
|
|
207
|
+
# local users with no given teamspace
|
|
208
|
+
try:
|
|
209
|
+
authenticate(model=f"{self.provider}/{self.name}")
|
|
210
|
+
teamspace_api = TeamspaceApi()
|
|
211
|
+
user_api = UserApi()
|
|
212
|
+
authed_user = user_api._client.auth_service_get_user()
|
|
213
|
+
default_teamspace = teamspace_api.list_teamspaces(owner_id=authed_user.id)[0]
|
|
214
|
+
teamspace_name = default_teamspace.name
|
|
215
|
+
teamspace_id = default_teamspace.id
|
|
216
|
+
os.environ["LIGHTNING_CLOUD_PROJECT_ID"] = teamspace_id
|
|
217
|
+
os.environ["LIGHTNING_TEAMSPACE"] = teamspace_name
|
|
218
|
+
except Exception as err:
|
|
219
|
+
# throw an appropriate error that guides users to login through the platform
|
|
220
|
+
raise ValueError(
|
|
221
|
+
"Teamspace information is missing. "
|
|
222
|
+
"If this is your first time using LitAI, please log in at https://lightning.ai/sign-up "
|
|
223
|
+
"and re-run your script, or set environment variable LIGHTNING_TEAMSPACE=<your-teamspace>."
|
|
224
|
+
) from err
|
|
117
225
|
|
|
118
|
-
# TODO: when teamspace_name is given, we don't know the teamspace_id yet
|
|
119
226
|
# TODO: if LIGHTNING_CLOUD_PROJECT_ID does not exist, we have to get the id from the teamspace name
|
|
120
227
|
|
|
121
228
|
LLM._cached_auth_info = {
|
|
@@ -138,16 +245,21 @@ class LLM:
|
|
|
138
245
|
self._cloud_url = LLM._cached_auth_info["cloud_url"]
|
|
139
246
|
self._org = None
|
|
140
247
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
248
|
+
@staticmethod
|
|
249
|
+
def _parse_model_name(name: str) -> Tuple[str, str]:
|
|
250
|
+
"""Parses the model name into provider and model name.
|
|
251
|
+
|
|
252
|
+
>>> LLM._parse_model_name("openai/v1/gpt-3.5-turbo")
|
|
253
|
+
('openai', 'v1/gpt-3.5-turbo')
|
|
254
|
+
"""
|
|
255
|
+
if "/" not in name:
|
|
256
|
+
raise ValueError(
|
|
257
|
+
f"Invalid model name format: '{name}'. "
|
|
258
|
+
"Model name must be in the format `provider/model_name`."
|
|
259
|
+
"(e.g., 'lightning-ai/gpt-oss-20b')"
|
|
260
|
+
)
|
|
261
|
+
provider, model_name = name.split("/", maxsplit=1)
|
|
262
|
+
return provider.lower(), model_name
|
|
151
263
|
|
|
152
264
|
# returns the assistant ID
|
|
153
265
|
def _get_model_id(self) -> str:
|
|
@@ -250,12 +362,13 @@ class LLM:
|
|
|
250
362
|
self,
|
|
251
363
|
prompt: str,
|
|
252
364
|
system_prompt: Optional[str] = None,
|
|
253
|
-
max_completion_tokens: Optional[int] =
|
|
365
|
+
max_completion_tokens: Optional[int] = None,
|
|
254
366
|
images: Optional[Union[List[str], str]] = None,
|
|
255
367
|
conversation: Optional[str] = None,
|
|
256
368
|
metadata: Optional[Dict[str, str]] = None,
|
|
257
369
|
stream: bool = False,
|
|
258
370
|
full_response: bool = False,
|
|
371
|
+
reasoning_effort: Optional[Literal["none", "low", "medium", "high"]] = None,
|
|
259
372
|
**kwargs: Any,
|
|
260
373
|
) -> Union[str, AsyncGenerator[str, None]]:
|
|
261
374
|
conversation_id = self._conversations.get(conversation) if conversation else None
|
|
@@ -284,17 +397,21 @@ class LLM:
|
|
|
284
397
|
self,
|
|
285
398
|
prompt: str,
|
|
286
399
|
system_prompt: Optional[str] = None,
|
|
287
|
-
max_completion_tokens: Optional[int] =
|
|
400
|
+
max_completion_tokens: Optional[int] = None,
|
|
288
401
|
images: Optional[Union[List[str], str]] = None,
|
|
289
402
|
conversation: Optional[str] = None,
|
|
290
403
|
metadata: Optional[Dict[str, str]] = None,
|
|
291
404
|
stream: bool = False,
|
|
292
405
|
full_response: bool = False,
|
|
293
406
|
tools: Optional[List[Dict[str, Any]]] = None,
|
|
407
|
+
reasoning_effort: Optional[Literal["none", "low", "medium", "high"]] = None,
|
|
294
408
|
**kwargs: Any,
|
|
295
409
|
) -> Union[
|
|
296
410
|
V1ConversationResponseChunk, Generator[V1ConversationResponseChunk, None, None], str, Generator[str, None, None]
|
|
297
411
|
]:
|
|
412
|
+
if reasoning_effort is not None and reasoning_effort not in ["none", "low", "medium", "high"]:
|
|
413
|
+
raise ValueError("reasoning_effort must be 'none', 'low', 'medium', 'high', or None")
|
|
414
|
+
|
|
298
415
|
if conversation and conversation not in self._conversations:
|
|
299
416
|
self._get_conversations()
|
|
300
417
|
|
|
@@ -317,6 +434,7 @@ class LLM:
|
|
|
317
434
|
metadata,
|
|
318
435
|
stream,
|
|
319
436
|
full_response,
|
|
437
|
+
reasoning_effort,
|
|
320
438
|
**kwargs,
|
|
321
439
|
)
|
|
322
440
|
|
|
@@ -332,6 +450,7 @@ class LLM:
|
|
|
332
450
|
name=conversation,
|
|
333
451
|
stream=stream,
|
|
334
452
|
tools=tools,
|
|
453
|
+
reasoning_effort=reasoning_effort,
|
|
335
454
|
**kwargs,
|
|
336
455
|
)
|
|
337
456
|
if not stream:
|
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
PUBLIC_MODELS = {
|
|
2
|
-
"openai/gpt-4o": {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"openai/gpt-4o": {
|
|
3
|
+
"id": "ast_01jdjds71fs8gt47jexzed4czs",
|
|
4
|
+
"context_length": 128000
|
|
5
|
+
},
|
|
6
|
+
"openai/gpt-4": {
|
|
7
|
+
"id": "ast_01jd38ze6tjbrcd4942nhz41zn",
|
|
8
|
+
"context_length": 8192
|
|
9
|
+
},
|
|
10
|
+
"openai/o3-mini": {
|
|
11
|
+
"id": "ast_01jz3t13fhnjhh11t1k8b5gyp1",
|
|
12
|
+
"context_length": 128000
|
|
13
|
+
},
|
|
14
|
+
"anthropic/claude-3-5-sonnet-20240620": {
|
|
15
|
+
"id": "ast_01jd3923a6p98rqwh3dpj686pq",
|
|
16
|
+
"context_length": 200000
|
|
17
|
+
},
|
|
18
|
+
"google/gemini-2.5-pro": {
|
|
19
|
+
"id": "ast_01jz3tdb1fhey798k95pv61v57",
|
|
20
|
+
"context_length": 1048576
|
|
21
|
+
},
|
|
22
|
+
"google/gemini-2.5-flash": {
|
|
23
|
+
"id": "ast_01jz3thxskg4fcdk4xhkjkym5a",
|
|
24
|
+
"context_length": 1048576
|
|
25
|
+
},
|
|
26
|
+
"google/gemini-2.5-flash-lite-preview-06-17": {
|
|
27
|
+
"id": "ast_01jz3thxskg4fcdk4xhkjkym5b",
|
|
28
|
+
"context_length": 1048576
|
|
29
|
+
},
|
|
30
|
+
"lightning-ai/DeepSeek-V3.1": {
|
|
31
|
+
"id": "ast_01k378z15k0msktaxjpfrfwqqh",
|
|
32
|
+
"context_length": 163840
|
|
33
|
+
},
|
|
9
34
|
"lightning-ai/gpt-oss-20b": {
|
|
10
35
|
"id": "ast_01k1y2ywfh9zzexjzrva6y96ms",
|
|
11
36
|
"context_length": 128000,
|
|
@@ -14,4 +39,16 @@ PUBLIC_MODELS = {
|
|
|
14
39
|
"id": "ast_01k1z7ajxbz7wq62xj5bc0mrcs",
|
|
15
40
|
"context_length": 128000,
|
|
16
41
|
},
|
|
42
|
+
"openai/gpt-5": {
|
|
43
|
+
"id": "ast_01jdjds71fs8gt47jexzed4cza",
|
|
44
|
+
"context_length": 400000
|
|
45
|
+
},
|
|
46
|
+
"openai/gpt-5-mini": {
|
|
47
|
+
"id": "ast_01jdjds71fs8gt47jexzed4czb",
|
|
48
|
+
"context_length": 400000
|
|
49
|
+
},
|
|
50
|
+
"openai/gpt-5-nano": {
|
|
51
|
+
"id": "ast_01jdjds71fs8gt47jexzed4czc",
|
|
52
|
+
"context_length": 400000
|
|
53
|
+
},
|
|
17
54
|
}
|
lightning_sdk/machine.py
CHANGED
|
@@ -6,7 +6,6 @@ from typing import Any, ClassVar, Optional, Tuple
|
|
|
6
6
|
class CloudProvider(Enum):
|
|
7
7
|
AWS = "AWS"
|
|
8
8
|
GCP = "GCP"
|
|
9
|
-
VULTR = "VULTR"
|
|
10
9
|
LAMBDA_LABS = "LAMBDA_LABS"
|
|
11
10
|
DGX = "DGX"
|
|
12
11
|
VOLTAGE_PARK = "VOLTAGE_PARK"
|
|
@@ -35,6 +34,7 @@ class Machine:
|
|
|
35
34
|
|
|
36
35
|
# supported GPU types
|
|
37
36
|
# supported T4 variations
|
|
37
|
+
T4_SMALL: ClassVar["Machine"]
|
|
38
38
|
T4: ClassVar["Machine"]
|
|
39
39
|
T4_X_2: ClassVar["Machine"]
|
|
40
40
|
T4_X_4: ClassVar["Machine"]
|
|
@@ -116,7 +116,7 @@ class Machine:
|
|
|
116
116
|
)
|
|
117
117
|
for m in possible_values:
|
|
118
118
|
for machine_id in [machine, *additional_machine_ids]:
|
|
119
|
-
if machine_id in (
|
|
119
|
+
if machine_id and machine_id in (
|
|
120
120
|
getattr(m, "name", None),
|
|
121
121
|
getattr(m, "instance_type", None),
|
|
122
122
|
getattr(m, "slug", None),
|
|
@@ -127,6 +127,21 @@ class Machine:
|
|
|
127
127
|
return cls(machine, *additional_machine_ids)
|
|
128
128
|
return cls(machine, machine, machine)
|
|
129
129
|
|
|
130
|
+
@classmethod
|
|
131
|
+
def _from_accelerator(cls, accelerator: Any) -> "Machine":
|
|
132
|
+
if accelerator.accelerator_type == "GPU":
|
|
133
|
+
accelerator_resources_count = accelerator.resources.gpu
|
|
134
|
+
else:
|
|
135
|
+
accelerator_resources_count = accelerator.resources.cpu
|
|
136
|
+
|
|
137
|
+
return Machine.from_str(
|
|
138
|
+
accelerator.slug_multi_cloud,
|
|
139
|
+
accelerator.slug,
|
|
140
|
+
accelerator.instance_id,
|
|
141
|
+
accelerator.secondary_instance_id,
|
|
142
|
+
f"lit-{accelerator.family.lower()}-{accelerator_resources_count}",
|
|
143
|
+
)
|
|
144
|
+
|
|
130
145
|
|
|
131
146
|
# CPU machines
|
|
132
147
|
# default CPU machines
|
|
@@ -148,6 +163,7 @@ Machine.DATA_PREP_ULTRA = Machine(
|
|
|
148
163
|
|
|
149
164
|
# GPU machines
|
|
150
165
|
# available T4 machines
|
|
166
|
+
Machine.T4_SMALL = Machine(name="T4_SMALL", slug="lit-t4-1-small", family="T4", accelerator_count=1)
|
|
151
167
|
Machine.T4 = Machine(name="T4", slug="lit-t4-1", family="T4", accelerator_count=1)
|
|
152
168
|
Machine.T4_X_2 = Machine(name="T4_X_2", slug="lit-t4-2", family="T4", accelerator_count=2)
|
|
153
169
|
Machine.T4_X_4 = Machine(name="T4_X_4", slug="lit-t4-4", family="T4", accelerator_count=4)
|
|
@@ -202,3 +218,6 @@ Machine.H200 = Machine(name="H200", slug="lit-h200x-1", family="H200", accelerat
|
|
|
202
218
|
Machine.H200_X_8 = Machine(name="H200_X_8", slug="lit-h200x-8", family="H200", accelerator_count=8)
|
|
203
219
|
# available B200 machines
|
|
204
220
|
Machine.B200_X_8 = Machine(name="B200_X_8", slug="lit-b200x-8", family="B200", accelerator_count=8)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
DEFAULT_MACHINE = Machine.CPU.name
|
lightning_sdk/mmt/base.py
CHANGED
|
@@ -75,6 +75,7 @@ class _BaseMMT(_BaseJob):
|
|
|
75
75
|
artifacts_local: Optional[str] = None, # deprecated in favor of path_mappings
|
|
76
76
|
artifacts_remote: Optional[str] = None, # deprecated in favor of path_mappings
|
|
77
77
|
cluster: Optional[str] = None, # deprecated in favor of cloud_account
|
|
78
|
+
reuse_snapshot: bool = True,
|
|
78
79
|
) -> "_BaseMMT":
|
|
79
80
|
"""Run async workloads using a docker image across multiple machines.
|
|
80
81
|
|
|
@@ -119,6 +120,8 @@ class _BaseMMT(_BaseJob):
|
|
|
119
120
|
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
120
121
|
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
121
122
|
Defaults to 3h
|
|
123
|
+
reuse_snapshot: Whether the job should reuse a Studio snapshot when multiple jobs for the same Studio are
|
|
124
|
+
submitted. Turning this off may result in longer job startup times. Defaults to True.
|
|
122
125
|
"""
|
|
123
126
|
from lightning_sdk.lightning_cloud.openapi.rest import ApiException
|
|
124
127
|
from lightning_sdk.studio import Studio
|
|
@@ -214,6 +217,7 @@ class _BaseMMT(_BaseJob):
|
|
|
214
217
|
artifacts_local=artifacts_local,
|
|
215
218
|
artifacts_remote=artifacts_remote,
|
|
216
219
|
max_runtime=max_runtime,
|
|
220
|
+
reuse_snapshot=reuse_snapshot,
|
|
217
221
|
)
|
|
218
222
|
return inst
|
|
219
223
|
|
|
@@ -236,6 +240,7 @@ class _BaseMMT(_BaseJob):
|
|
|
236
240
|
artifacts_local: Optional[str] = None, # deprecated in favor of path_mappings
|
|
237
241
|
artifacts_remote: Optional[str] = None, # deprecated in favor of path_mappings
|
|
238
242
|
max_runtime: Optional[int] = None,
|
|
243
|
+
reuse_snapshot: bool = True,
|
|
239
244
|
) -> None:
|
|
240
245
|
"""Submit a new multi-machine job to the Lightning AI platform.
|
|
241
246
|
|
|
@@ -271,6 +276,8 @@ class _BaseMMT(_BaseJob):
|
|
|
271
276
|
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
272
277
|
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
273
278
|
Defaults to 3h
|
|
279
|
+
reuse_snapshot: Whether the job should reuse a Studio snapshot when multiple jobs for the same Studio are
|
|
280
|
+
submitted. Turning this off may result in longer job startup times. Defaults to True.
|
|
274
281
|
"""
|
|
275
282
|
|
|
276
283
|
@property
|
lightning_sdk/mmt/mmt.py
CHANGED
|
@@ -20,9 +20,9 @@ _logger = _setup_logger(__name__)
|
|
|
20
20
|
class MMT(_BaseMMT):
|
|
21
21
|
"""Class to submit and manage multi-machine jobs on the Lightning AI Platform."""
|
|
22
22
|
|
|
23
|
-
_force_v1: (
|
|
24
|
-
|
|
25
|
-
)
|
|
23
|
+
_force_v1: bool = (
|
|
24
|
+
False # required for studio plugin still working correctly as v2 currently does not support the studio env
|
|
25
|
+
)
|
|
26
26
|
|
|
27
27
|
def __init__(
|
|
28
28
|
self,
|
|
@@ -102,6 +102,7 @@ class MMT(_BaseMMT):
|
|
|
102
102
|
artifacts_local: Optional[str] = None,
|
|
103
103
|
artifacts_remote: Optional[str] = None,
|
|
104
104
|
cluster: Optional[str] = None, # deprecated in favor of cloud_account
|
|
105
|
+
reuse_snapshot: bool = True,
|
|
105
106
|
) -> "MMT":
|
|
106
107
|
"""Run async workloads using a docker image across multiple machines.
|
|
107
108
|
|
|
@@ -141,6 +142,8 @@ class MMT(_BaseMMT):
|
|
|
141
142
|
}
|
|
142
143
|
If the path inside the connection is omitted it's assumed to be the root path of that connection.
|
|
143
144
|
Only applicable when submitting docker jobs.
|
|
145
|
+
reuse_snapshot: Whether the job should reuse a Studio snapshot when multiple jobs for the same Studio are
|
|
146
|
+
submitted. Turning this off may result in longer job startup times. Defaults to True.
|
|
144
147
|
"""
|
|
145
148
|
ret_val = super().run(
|
|
146
149
|
name=name,
|
|
@@ -164,6 +167,7 @@ class MMT(_BaseMMT):
|
|
|
164
167
|
artifacts_remote=artifacts_remote,
|
|
165
168
|
cluster=cluster, # deprecated in favor of cloud_account
|
|
166
169
|
max_runtime=max_runtime,
|
|
170
|
+
reuse_snapshot=reuse_snapshot,
|
|
167
171
|
)
|
|
168
172
|
# required for typing with "MMT"
|
|
169
173
|
assert isinstance(ret_val, cls)
|
|
@@ -191,6 +195,7 @@ class MMT(_BaseMMT):
|
|
|
191
195
|
max_runtime: Optional[int] = None,
|
|
192
196
|
artifacts_local: Optional[str] = None, # deprecated in favor of path_mappings
|
|
193
197
|
artifacts_remote: Optional[str] = None, # deprecated in favor of path_mappings
|
|
198
|
+
reuse_snapshot: bool = True,
|
|
194
199
|
) -> "MMT":
|
|
195
200
|
"""Submit a new multi-machine job to the Lightning AI platform.
|
|
196
201
|
|
|
@@ -231,6 +236,8 @@ class MMT(_BaseMMT):
|
|
|
231
236
|
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
232
237
|
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
233
238
|
Defaults to 3h
|
|
239
|
+
reuse_snapshot: Whether the job should reuse a Studio snapshot when multiple jobs for the same Studio are
|
|
240
|
+
submitted. Turning this off may result in longer job startup times. Defaults to True.
|
|
234
241
|
"""
|
|
235
242
|
self._job = self._internal_mmt._submit(
|
|
236
243
|
num_machines=num_machines,
|
|
@@ -249,6 +256,7 @@ class MMT(_BaseMMT):
|
|
|
249
256
|
artifacts_local=artifacts_local,
|
|
250
257
|
artifacts_remote=artifacts_remote,
|
|
251
258
|
max_runtime=max_runtime,
|
|
259
|
+
reuse_snapshot=reuse_snapshot,
|
|
252
260
|
)
|
|
253
261
|
return self
|
|
254
262
|
|
lightning_sdk/mmt/v1.py
CHANGED
|
@@ -58,6 +58,7 @@ class _MMTV1(_BaseMMT):
|
|
|
58
58
|
max_runtime: Optional[int] = None,
|
|
59
59
|
artifacts_local: Optional[str] = None,
|
|
60
60
|
artifacts_remote: Optional[str] = None,
|
|
61
|
+
reuse_snapshot: bool = True,
|
|
61
62
|
) -> "_MMTV1":
|
|
62
63
|
"""Submit a new multi-machine job to the Lightning AI platform.
|
|
63
64
|
|
|
@@ -96,7 +97,8 @@ class _MMTV1(_BaseMMT):
|
|
|
96
97
|
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
97
98
|
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
98
99
|
Defaults to 3h
|
|
99
|
-
|
|
100
|
+
reuse_snapshot: Whether the job should reuse a Studio snapshot when multiple jobs for the same Studio are
|
|
101
|
+
submitted. Turning this off may result in longer job startup times. Defaults to True.
|
|
100
102
|
"""
|
|
101
103
|
raise NotImplementedError("Cannot submit new mmts with MMTV1!")
|
|
102
104
|
|
lightning_sdk/mmt/v2.py
CHANGED
|
@@ -58,6 +58,7 @@ class _MMTV2(_BaseMMT):
|
|
|
58
58
|
max_runtime: Optional[int] = None,
|
|
59
59
|
artifacts_local: Optional[str] = None, # deprecated in favor of path_mappings
|
|
60
60
|
artifacts_remote: Optional[str] = None, # deprecated in favor of path_mappings
|
|
61
|
+
reuse_snapshot: bool = True,
|
|
61
62
|
) -> "_MMTV2":
|
|
62
63
|
"""Submit a new multi-machine job to the Lightning AI platform.
|
|
63
64
|
|
|
@@ -98,6 +99,8 @@ class _MMTV2(_BaseMMT):
|
|
|
98
99
|
Irrelevant for most machines, required for some of the top-end machines on GCP.
|
|
99
100
|
If in doubt, set it. Won't have an effect on machines not requiring it.
|
|
100
101
|
Defaults to 3h
|
|
102
|
+
reuse_snapshot: Whether the job should reuse a Studio snapshot when multiple jobs for the same Studio are
|
|
103
|
+
submitted. Turning this off may result in longer job startup times. Defaults to True.
|
|
101
104
|
"""
|
|
102
105
|
# Command is required if Studio is provided to know what to run
|
|
103
106
|
# Image is mutually exclusive with Studio
|
|
@@ -141,6 +144,7 @@ class _MMTV2(_BaseMMT):
|
|
|
141
144
|
artifacts_local=artifacts_local,
|
|
142
145
|
artifacts_remote=artifacts_remote,
|
|
143
146
|
max_runtime=max_runtime,
|
|
147
|
+
reuse_snapshot=reuse_snapshot,
|
|
144
148
|
)
|
|
145
149
|
self._job = submitted
|
|
146
150
|
self._name = submitted.name
|
lightning_sdk/owner.py
CHANGED
|
@@ -2,12 +2,13 @@ from abc import ABC, abstractmethod
|
|
|
2
2
|
from typing import TYPE_CHECKING, List
|
|
3
3
|
|
|
4
4
|
from lightning_sdk.api import TeamspaceApi
|
|
5
|
+
from lightning_sdk.utils.logging import TrackCallsABCMeta
|
|
5
6
|
|
|
6
7
|
if TYPE_CHECKING:
|
|
7
8
|
from lightning_sdk.teamspace import Teamspace
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
class Owner(ABC):
|
|
11
|
+
class Owner(ABC, metaclass=TrackCallsABCMeta):
|
|
11
12
|
"""Represents an owner of teamspaces and studios."""
|
|
12
13
|
|
|
13
14
|
def __init__(self) -> None:
|
lightning_sdk/pipeline/steps.py
CHANGED
|
@@ -175,6 +175,7 @@ class JobStep:
|
|
|
175
175
|
path_mappings: Optional[Dict[str, str]] = None,
|
|
176
176
|
max_runtime: Optional[int] = None,
|
|
177
177
|
wait_for: Union[str, List[str], None] = DEFAULT,
|
|
178
|
+
reuse_snapshot: bool = True,
|
|
178
179
|
) -> None:
|
|
179
180
|
self.name = name
|
|
180
181
|
self.machine = machine or Machine.CPU
|
|
@@ -201,6 +202,7 @@ class JobStep:
|
|
|
201
202
|
self.path_mappings = path_mappings
|
|
202
203
|
self.max_runtime = max_runtime
|
|
203
204
|
self.wait_for = wait_for
|
|
205
|
+
self.reuse_snapshot = reuse_snapshot
|
|
204
206
|
|
|
205
207
|
def to_proto(
|
|
206
208
|
self, teamspace: "Teamspace", cloud_account: str, shared_filesystem: Union[bool, V1SharedFilesystem]
|
|
@@ -239,6 +241,7 @@ class JobStep:
|
|
|
239
241
|
artifacts_remote=None,
|
|
240
242
|
max_runtime=self.max_runtime,
|
|
241
243
|
machine_image_version=machine_image_version,
|
|
244
|
+
reuse_snapshot=self.reuse_snapshot,
|
|
242
245
|
)
|
|
243
246
|
|
|
244
247
|
return V1PipelineStep(
|
|
@@ -272,6 +275,7 @@ class MMTStep:
|
|
|
272
275
|
path_mappings: Optional[Dict[str, str]] = None,
|
|
273
276
|
max_runtime: Optional[int] = None,
|
|
274
277
|
wait_for: Optional[Union[str, List[str]]] = DEFAULT,
|
|
278
|
+
reuse_snapshot: bool = True,
|
|
275
279
|
) -> None:
|
|
276
280
|
self.machine = machine or Machine.CPU
|
|
277
281
|
self.num_machines = num_machines
|
|
@@ -297,6 +301,7 @@ class MMTStep:
|
|
|
297
301
|
self.path_mappings = path_mappings
|
|
298
302
|
self.max_runtime = max_runtime
|
|
299
303
|
self.wait_for = wait_for
|
|
304
|
+
self.reuse_snapshot = reuse_snapshot
|
|
300
305
|
|
|
301
306
|
def to_proto(
|
|
302
307
|
self, teamspace: "Teamspace", cloud_account: str, shared_filesystem: Union[bool, V1SharedFilesystem]
|
|
@@ -332,6 +337,7 @@ class MMTStep:
|
|
|
332
337
|
artifacts_remote=None, # deprecated in favor of path_mappings
|
|
333
338
|
max_runtime=self.max_runtime,
|
|
334
339
|
machine_image_version=machine_image_version,
|
|
340
|
+
reuse_snapshot=self.reuse_snapshot,
|
|
335
341
|
)
|
|
336
342
|
|
|
337
343
|
return V1PipelineStep(
|