lightning-sdk 0.2.23__py3-none-any.whl → 0.2.24rc0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lightning_sdk/__init__.py +1 -1
- lightning_sdk/api/base_studio_api.py +9 -2
- lightning_sdk/api/deployment_api.py +9 -9
- lightning_sdk/api/llm_api.py +5 -11
- lightning_sdk/api/pipeline_api.py +31 -11
- lightning_sdk/api/studio_api.py +4 -0
- lightning_sdk/base_studio.py +22 -6
- lightning_sdk/deployment/deployment.py +17 -7
- lightning_sdk/lightning_cloud/openapi/__init__.py +12 -0
- lightning_sdk/lightning_cloud/openapi/api/__init__.py +1 -0
- lightning_sdk/lightning_cloud/openapi/api/assistants_service_api.py +114 -1
- lightning_sdk/lightning_cloud/openapi/api/cloudy_service_api.py +129 -0
- lightning_sdk/lightning_cloud/openapi/api/organizations_service_api.py +105 -0
- lightning_sdk/lightning_cloud/openapi/api/pipelines_service_api.py +4 -4
- lightning_sdk/lightning_cloud/openapi/api/user_service_api.py +105 -0
- lightning_sdk/lightning_cloud/openapi/models/__init__.py +11 -0
- lightning_sdk/lightning_cloud/openapi/models/agents_id_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/assistant_id_conversations_body.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/credits_autoreplenish_body.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/credits_autoreplenish_body1.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/externalv1_user_status.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/orgs_id_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/pipelines_id_body1.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/project_id_agents_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/project_id_cloudspaces_body.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/update.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_assistant.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_provider.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_environment_config.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_environment_template_config.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_environment_type.py +1 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_specialized_view.py +104 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cloudy_expert.py +279 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_accelerator.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_capacity_reservation.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_spec.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_cluster_status.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_conversation_response_chunk.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_create_cloud_space_environment_template_request.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_create_organization_request.py +79 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_deployment_status.py +47 -21
- lightning_sdk/lightning_cloud/openapi/models/v1_external_cluster_spec.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_get_job_stats_response.py +53 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_instance_overprovisioning_spec.py +1 -27
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_direct_v1.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_kubernetes_direct_v1_status.py +149 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_list_cloudy_experts_response.py +123 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_login_request.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_magic_link_login_request.py +29 -3
- lightning_sdk/lightning_cloud/openapi/models/v1_magic_link_login_response.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_organization.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_token_usage.py +175 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_update_organization_credits_auto_replenish_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_update_user_credits_auto_replenish_response.py +97 -0
- lightning_sdk/lightning_cloud/openapi/models/v1_update_user_request.py +27 -1
- lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +185 -29
- lightning_sdk/llm/llm.py +113 -115
- lightning_sdk/llm/public_assistants.json +8 -0
- lightning_sdk/pipeline/pipeline.py +17 -2
- lightning_sdk/pipeline/printer.py +11 -10
- lightning_sdk/pipeline/steps.py +4 -1
- lightning_sdk/pipeline/utils.py +29 -4
- lightning_sdk/studio.py +3 -0
- {lightning_sdk-0.2.23.dist-info → lightning_sdk-0.2.24rc0.dist-info}/METADATA +1 -1
- {lightning_sdk-0.2.23.dist-info → lightning_sdk-0.2.24rc0.dist-info}/RECORD +70 -57
- {lightning_sdk-0.2.23.dist-info → lightning_sdk-0.2.24rc0.dist-info}/LICENSE +0 -0
- {lightning_sdk-0.2.23.dist-info → lightning_sdk-0.2.24rc0.dist-info}/WHEEL +0 -0
- {lightning_sdk-0.2.23.dist-info → lightning_sdk-0.2.24rc0.dist-info}/entry_points.txt +0 -0
- {lightning_sdk-0.2.23.dist-info → lightning_sdk-0.2.24rc0.dist-info}/top_level.txt +0 -0
lightning_sdk/__init__.py
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
from typing import Any, List, Optional
|
|
2
2
|
|
|
3
|
+
from lightning_sdk.lightning_cloud.openapi import (
|
|
4
|
+
V1CloudSpaceEnvironmentType,
|
|
5
|
+
V1ListCloudSpaceEnvironmentTemplatesResponse,
|
|
6
|
+
)
|
|
3
7
|
from lightning_sdk.lightning_cloud.openapi.models.update import Update as BaseStudioUpdateBody
|
|
4
8
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_environment_template import (
|
|
5
9
|
V1CloudSpaceEnvironmentTemplate,
|
|
6
10
|
)
|
|
7
|
-
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_environment_type import V1CloudSpaceEnvironmentType
|
|
8
11
|
from lightning_sdk.lightning_cloud.rest_client import LightningClient
|
|
9
12
|
|
|
10
13
|
|
|
@@ -21,8 +24,12 @@ class BaseStudioApi:
|
|
|
21
24
|
except ValueError as e:
|
|
22
25
|
raise ValueError(f"Base studio {base_studio_id} does not exist") from e
|
|
23
26
|
|
|
24
|
-
def get_all_base_studios(self, org_id: str) ->
|
|
27
|
+
def get_all_base_studios(self, org_id: str, managed: bool = True) -> V1ListCloudSpaceEnvironmentTemplatesResponse:
|
|
25
28
|
"""Retrieve all base studios for a given organization."""
|
|
29
|
+
if managed:
|
|
30
|
+
return self._client.cloud_space_environment_template_service_list_managed_cloud_space_environment_templates(
|
|
31
|
+
org_id=org_id
|
|
32
|
+
)
|
|
26
33
|
return self._client.cloud_space_environment_template_service_list_cloud_space_environment_templates(
|
|
27
34
|
org_id=org_id
|
|
28
35
|
)
|
|
@@ -102,10 +102,10 @@ class ExecHealthCheck(HealthCheck):
|
|
|
102
102
|
def __init__(
|
|
103
103
|
self,
|
|
104
104
|
command: str,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
initial_delay_seconds: int = 0,
|
|
106
|
+
failure_threshold: int = 600,
|
|
107
|
+
interval_seconds: int = 1,
|
|
108
|
+
timeout_seconds: int = 30,
|
|
109
109
|
) -> None:
|
|
110
110
|
self.command = command
|
|
111
111
|
self.timeout_seconds = timeout_seconds
|
|
@@ -131,17 +131,17 @@ class HttpHealthCheck(HealthCheck):
|
|
|
131
131
|
self,
|
|
132
132
|
path: str,
|
|
133
133
|
port: float,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
initial_delay_seconds: int = 0,
|
|
135
|
+
failure_threshold: int = 600,
|
|
136
|
+
interval_seconds: int = 1,
|
|
137
|
+
timeout_seconds: int = 30,
|
|
138
138
|
) -> None:
|
|
139
139
|
self.path = path
|
|
140
140
|
self.port = port
|
|
141
|
-
self.timeout_seconds = timeout_seconds
|
|
142
141
|
self.initial_delay_seconds = initial_delay_seconds
|
|
143
142
|
self.failure_threshold = failure_threshold
|
|
144
143
|
self.interval_seconds = interval_seconds
|
|
144
|
+
self.timeout_seconds = timeout_seconds
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
class AutoScalingMetric:
|
lightning_sdk/api/llm_api.py
CHANGED
|
@@ -18,17 +18,11 @@ class LLMApi:
|
|
|
18
18
|
def __init__(self) -> None:
|
|
19
19
|
self._client = LightningClient(retry=False, max_tries=0)
|
|
20
20
|
|
|
21
|
-
def
|
|
22
|
-
result = self._client.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
result = self._client.assistants_service_list_assistants(org_id=org_id)
|
|
27
|
-
return result.assistants
|
|
28
|
-
|
|
29
|
-
def get_user_models(self, user_id: str) -> List[str]:
|
|
30
|
-
result = self._client.assistants_service_list_assistants(user_id=user_id)
|
|
31
|
-
return result.assistants
|
|
21
|
+
def get_assistant(self, model_provider: str, model_name: str, user_name: str, org_name: str) -> str:
|
|
22
|
+
result = self._client.assistants_service_get_managed_model_assistant(
|
|
23
|
+
model_provider=model_provider, model_name=model_name, user_name=user_name, org_name=org_name
|
|
24
|
+
)
|
|
25
|
+
return result.id
|
|
32
26
|
|
|
33
27
|
def _parse_stream_line(self, decoded_line: str) -> Optional[V1ConversationResponseChunk]:
|
|
34
28
|
try:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
from typing import TYPE_CHECKING, List, Optional
|
|
1
|
+
from typing import TYPE_CHECKING, List, Optional, Union
|
|
2
2
|
|
|
3
|
+
from lightning_sdk.api.cluster_api import ClusterApi
|
|
3
4
|
from lightning_sdk.lightning_cloud.openapi.models import (
|
|
4
5
|
ProjectIdPipelinesBody,
|
|
5
6
|
ProjectIdSchedulesBody,
|
|
@@ -11,6 +12,7 @@ from lightning_sdk.lightning_cloud.openapi.models import (
|
|
|
11
12
|
)
|
|
12
13
|
from lightning_sdk.lightning_cloud.openapi.rest import ApiException
|
|
13
14
|
from lightning_sdk.lightning_cloud.rest_client import LightningClient
|
|
15
|
+
from lightning_sdk.teamspace import Teamspace
|
|
14
16
|
|
|
15
17
|
if TYPE_CHECKING:
|
|
16
18
|
from lightning_sdk.pipeline.schedule import Schedule
|
|
@@ -20,7 +22,8 @@ class PipelineApi:
|
|
|
20
22
|
"""Internal API client for Pipeline requests (mainly http requests)."""
|
|
21
23
|
|
|
22
24
|
def __init__(self) -> None:
|
|
23
|
-
self._client = LightningClient(
|
|
25
|
+
self._client = LightningClient(max_tries=0, retry=False)
|
|
26
|
+
self._cluster_api = ClusterApi()
|
|
24
27
|
|
|
25
28
|
def get_pipeline_by_id(self, project_id: str, pipeline_id_or_name: str) -> Optional[V1Pipeline]:
|
|
26
29
|
if pipeline_id_or_name.startswith("pip_"):
|
|
@@ -43,7 +46,7 @@ class PipelineApi:
|
|
|
43
46
|
def create_pipeline(
|
|
44
47
|
self,
|
|
45
48
|
name: str,
|
|
46
|
-
|
|
49
|
+
teamspace: Teamspace,
|
|
47
50
|
steps: List["V1PipelineStep"],
|
|
48
51
|
shared_filesystem: bool,
|
|
49
52
|
schedules: List["Schedule"],
|
|
@@ -52,20 +55,17 @@ class PipelineApi:
|
|
|
52
55
|
body = ProjectIdPipelinesBody(
|
|
53
56
|
name=name,
|
|
54
57
|
steps=steps,
|
|
55
|
-
shared_filesystem=
|
|
56
|
-
enabled=shared_filesystem,
|
|
57
|
-
s3_folder=True,
|
|
58
|
-
),
|
|
58
|
+
shared_filesystem=self._prepare_shared_filesytem(shared_filesystem, steps, teamspace),
|
|
59
59
|
parent_pipeline_id=parent_pipeline_id or "",
|
|
60
60
|
)
|
|
61
61
|
|
|
62
|
-
pipeline = self._client.pipelines_service_create_pipeline(body,
|
|
62
|
+
pipeline = self._client.pipelines_service_create_pipeline(body, teamspace.id)
|
|
63
63
|
|
|
64
64
|
# Delete the previous schedules
|
|
65
65
|
if parent_pipeline_id is not None:
|
|
66
|
-
current_schedules = self._client.schedules_service_list_schedules(
|
|
66
|
+
current_schedules = self._client.schedules_service_list_schedules(teamspace.id).schedules
|
|
67
67
|
for schedule in current_schedules:
|
|
68
|
-
self._client.schedules_service_delete_schedule(
|
|
68
|
+
self._client.schedules_service_delete_schedule(teamspace.id, schedule.id)
|
|
69
69
|
|
|
70
70
|
if len(schedules):
|
|
71
71
|
for schedule in schedules:
|
|
@@ -77,7 +77,7 @@ class PipelineApi:
|
|
|
77
77
|
resource_type=V1ScheduleResourceType.PIPELINE,
|
|
78
78
|
)
|
|
79
79
|
|
|
80
|
-
self._client.schedules_service_create_schedule(body,
|
|
80
|
+
self._client.schedules_service_create_schedule(body, teamspace.id)
|
|
81
81
|
|
|
82
82
|
return pipeline
|
|
83
83
|
|
|
@@ -88,3 +88,23 @@ class PipelineApi:
|
|
|
88
88
|
|
|
89
89
|
def delete(self, project_id: str, pipeline_id: str) -> V1DeletePipelineResponse:
|
|
90
90
|
return self._client.pipelines_service_delete_pipeline(project_id, pipeline_id)
|
|
91
|
+
|
|
92
|
+
def _prepare_shared_filesytem(
|
|
93
|
+
self, shared_filesystem: Union[bool, V1SharedFilesystem], steps: List["V1PipelineStep"], teamspace: Teamspace
|
|
94
|
+
) -> V1SharedFilesystem:
|
|
95
|
+
if not shared_filesystem:
|
|
96
|
+
return V1SharedFilesystem(enabled=False)
|
|
97
|
+
|
|
98
|
+
from lightning_sdk.pipeline.utils import _get_cloud_account
|
|
99
|
+
|
|
100
|
+
cluster = self._cluster_api.get_cluster(
|
|
101
|
+
cluster_id=_get_cloud_account(steps), project_id=teamspace.id, org_id=teamspace.owner.id
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
if cluster.spec.aws_v1:
|
|
105
|
+
return V1SharedFilesystem(enabled=True, s3_folder=True)
|
|
106
|
+
|
|
107
|
+
if cluster.spec.google_cloud_v1:
|
|
108
|
+
return V1SharedFilesystem(enabled=True, gcs_folder=True)
|
|
109
|
+
|
|
110
|
+
raise NotImplementedError("This cluster isn't support yet")
|
lightning_sdk/api/studio_api.py
CHANGED
|
@@ -124,6 +124,8 @@ class StudioApi:
|
|
|
124
124
|
cloud_account: Optional[str] = None,
|
|
125
125
|
source: Optional[V1CloudSpaceSourceType] = None,
|
|
126
126
|
disable_secrets: bool = False,
|
|
127
|
+
sandbox: bool = False,
|
|
128
|
+
cloud_space_environment_template_id: Optional[str] = None,
|
|
127
129
|
) -> V1CloudSpace:
|
|
128
130
|
"""Create a Studio with a given name in a given Teamspace on a possibly given cloud_account."""
|
|
129
131
|
body = ProjectIdCloudspacesBody(
|
|
@@ -133,6 +135,8 @@ class StudioApi:
|
|
|
133
135
|
seed_files=[V1CloudSpaceSeedFile(path="main.py", contents="print('Hello, Lightning World!')\n")],
|
|
134
136
|
source=source,
|
|
135
137
|
disable_secrets=disable_secrets,
|
|
138
|
+
sandbox=sandbox,
|
|
139
|
+
cloud_space_environment_template_id=cloud_space_environment_template_id,
|
|
136
140
|
)
|
|
137
141
|
studio = self._client.cloud_space_service_create_cloud_space(body, teamspace_id)
|
|
138
142
|
|
lightning_sdk/base_studio.py
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
1
2
|
from typing import List, Optional, Union
|
|
2
3
|
|
|
3
4
|
from lightning_sdk.api.base_studio_api import BaseStudioApi
|
|
4
5
|
from lightning_sdk.api.user_api import UserApi
|
|
5
6
|
from lightning_sdk.lightning_cloud import login
|
|
6
|
-
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_environment_template import (
|
|
7
|
-
V1CloudSpaceEnvironmentTemplate,
|
|
8
|
-
)
|
|
9
7
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_environment_type import V1CloudSpaceEnvironmentType
|
|
10
8
|
from lightning_sdk.organization import Organization
|
|
11
9
|
from lightning_sdk.user import User
|
|
12
10
|
from lightning_sdk.utils.resolve import _resolve_org, _resolve_user
|
|
13
11
|
|
|
14
12
|
|
|
13
|
+
@dataclass
|
|
14
|
+
class BaseStudioInfo:
|
|
15
|
+
id: str
|
|
16
|
+
name: str
|
|
17
|
+
managed_id: str
|
|
18
|
+
description: str
|
|
19
|
+
|
|
20
|
+
|
|
15
21
|
class BaseStudio:
|
|
16
22
|
def __init__(
|
|
17
23
|
self,
|
|
@@ -61,7 +67,7 @@ class BaseStudio:
|
|
|
61
67
|
environment_type: Optional[V1CloudSpaceEnvironmentType] = None,
|
|
62
68
|
machine_image_version: Optional[str] = None,
|
|
63
69
|
setup_script_text: Optional[str] = None,
|
|
64
|
-
) ->
|
|
70
|
+
) -> None:
|
|
65
71
|
self._base_studio = self._base_studio_api.update_base_studio(
|
|
66
72
|
self._base_studio.id,
|
|
67
73
|
self._org.id,
|
|
@@ -74,10 +80,20 @@ class BaseStudio:
|
|
|
74
80
|
disabled=disabled,
|
|
75
81
|
)
|
|
76
82
|
|
|
77
|
-
def list(self) -> List[
|
|
83
|
+
def list(self, managed: bool = True) -> List[BaseStudioInfo]:
|
|
78
84
|
"""List all base studios in the organization.
|
|
79
85
|
|
|
80
86
|
Returns:
|
|
81
87
|
List[V1CloudSpaceEnvironmentTemplate]: A list of base studio templates.
|
|
82
88
|
"""
|
|
83
|
-
|
|
89
|
+
result = []
|
|
90
|
+
for template in self._base_studio_api.get_all_base_studios(self._org.id, managed).templates:
|
|
91
|
+
result.append(
|
|
92
|
+
BaseStudioInfo(
|
|
93
|
+
id=template.id,
|
|
94
|
+
name=template.name,
|
|
95
|
+
managed_id=template.managed_id,
|
|
96
|
+
description=template.description,
|
|
97
|
+
),
|
|
98
|
+
)
|
|
99
|
+
return result
|
|
@@ -197,11 +197,13 @@ class Deployment:
|
|
|
197
197
|
if commands is not None:
|
|
198
198
|
command = compose_commands(commands)
|
|
199
199
|
|
|
200
|
+
autoscaling_metric_name = ("CPU" if machine.is_cpu() else "GPU") if isinstance(machine, Machine) else "CPU"
|
|
201
|
+
|
|
200
202
|
if autoscale is None:
|
|
201
203
|
autoscale = AutoScaleConfig(
|
|
202
204
|
min_replicas=0,
|
|
203
205
|
max_replicas=1,
|
|
204
|
-
metric=
|
|
206
|
+
metric=autoscaling_metric_name,
|
|
205
207
|
threshold=90,
|
|
206
208
|
)
|
|
207
209
|
|
|
@@ -380,27 +382,35 @@ class Deployment:
|
|
|
380
382
|
return None
|
|
381
383
|
|
|
382
384
|
@property
|
|
383
|
-
def pending_replicas(self) -> Optional[
|
|
385
|
+
def pending_replicas(self) -> Optional[int]:
|
|
384
386
|
"""The number of pending replicas."""
|
|
385
387
|
if self._deployment:
|
|
386
388
|
self._deployment = self._deployment_api.get_deployment_by_name(self._name, self._teamspace.id)
|
|
387
|
-
return self._deployment.status.pending_replicas
|
|
389
|
+
return int(self._deployment.status.pending_replicas)
|
|
390
|
+
return None
|
|
391
|
+
|
|
392
|
+
@property
|
|
393
|
+
def running_replicas(self) -> Optional[int]:
|
|
394
|
+
"""The number of failing replicas."""
|
|
395
|
+
if self._deployment:
|
|
396
|
+
self._deployment = self._deployment_api.get_deployment_by_name(self._name, self._teamspace.id)
|
|
397
|
+
return int(self._deployment.status.ready_replicas)
|
|
388
398
|
return None
|
|
389
399
|
|
|
390
400
|
@property
|
|
391
|
-
def failing_replicas(self) -> Optional[
|
|
401
|
+
def failing_replicas(self) -> Optional[int]:
|
|
392
402
|
"""The number of failing replicas."""
|
|
393
403
|
if self._deployment:
|
|
394
404
|
self._deployment = self._deployment_api.get_deployment_by_name(self._name, self._teamspace.id)
|
|
395
|
-
return self._deployment.status.failing_replicas
|
|
405
|
+
return int(self._deployment.status.failing_replicas)
|
|
396
406
|
return None
|
|
397
407
|
|
|
398
408
|
@property
|
|
399
|
-
def deleting_replicas(self) -> Optional[
|
|
409
|
+
def deleting_replicas(self) -> Optional[int]:
|
|
400
410
|
"""The number of deleting replicas."""
|
|
401
411
|
if self._deployment:
|
|
402
412
|
self._deployment = self._deployment_api.get_deployment_by_name(self._name, self._teamspace.id)
|
|
403
|
-
return self._deployment.status.deleting_replicas
|
|
413
|
+
return int(self._deployment.status.deleting_replicas)
|
|
404
414
|
return None
|
|
405
415
|
|
|
406
416
|
@property
|
|
@@ -30,6 +30,7 @@ from lightning_sdk.lightning_cloud.openapi.api.billing_service_api import Billin
|
|
|
30
30
|
from lightning_sdk.lightning_cloud.openapi.api.blog_posts_service_api import BlogPostsServiceApi
|
|
31
31
|
from lightning_sdk.lightning_cloud.openapi.api.cloud_space_environment_template_service_api import CloudSpaceEnvironmentTemplateServiceApi
|
|
32
32
|
from lightning_sdk.lightning_cloud.openapi.api.cloud_space_service_api import CloudSpaceServiceApi
|
|
33
|
+
from lightning_sdk.lightning_cloud.openapi.api.cloudy_service_api import CloudyServiceApi
|
|
33
34
|
from lightning_sdk.lightning_cloud.openapi.api.cluster_service_api import ClusterServiceApi
|
|
34
35
|
from lightning_sdk.lightning_cloud.openapi.api.data_connection_service_api import DataConnectionServiceApi
|
|
35
36
|
from lightning_sdk.lightning_cloud.openapi.api.dataset_service_api import DatasetServiceApi
|
|
@@ -103,6 +104,8 @@ from lightning_sdk.lightning_cloud.openapi.models.conversations_id_body import C
|
|
|
103
104
|
from lightning_sdk.lightning_cloud.openapi.models.create import Create
|
|
104
105
|
from lightning_sdk.lightning_cloud.openapi.models.create_checkout_session_request_wallet_type import CreateCheckoutSessionRequestWalletType
|
|
105
106
|
from lightning_sdk.lightning_cloud.openapi.models.create_deployment_request_defines_a_spec_for_the_job_that_allows_for_autoscaling_jobs import CreateDeploymentRequestDefinesASpecForTheJobThatAllowsForAutoscalingJobs
|
|
107
|
+
from lightning_sdk.lightning_cloud.openapi.models.credits_autoreplenish_body import CreditsAutoreplenishBody
|
|
108
|
+
from lightning_sdk.lightning_cloud.openapi.models.credits_autoreplenish_body1 import CreditsAutoreplenishBody1
|
|
106
109
|
from lightning_sdk.lightning_cloud.openapi.models.data_connection_mount_data_connection_mount_copy_status import DataConnectionMountDataConnectionMountCopyStatus
|
|
107
110
|
from lightning_sdk.lightning_cloud.openapi.models.dataset_id_versions_body import DatasetIdVersionsBody
|
|
108
111
|
from lightning_sdk.lightning_cloud.openapi.models.dataset_id_visibility_body import DatasetIdVisibilityBody
|
|
@@ -175,6 +178,7 @@ from lightning_sdk.lightning_cloud.openapi.models.org_id_memberships_body import
|
|
|
175
178
|
from lightning_sdk.lightning_cloud.openapi.models.org_id_roles_body import OrgIdRolesBody
|
|
176
179
|
from lightning_sdk.lightning_cloud.openapi.models.orgs_id_body import OrgsIdBody
|
|
177
180
|
from lightning_sdk.lightning_cloud.openapi.models.pipelines_id_body import PipelinesIdBody
|
|
181
|
+
from lightning_sdk.lightning_cloud.openapi.models.pipelines_id_body1 import PipelinesIdBody1
|
|
178
182
|
from lightning_sdk.lightning_cloud.openapi.models.pipelinetemplates_id_body import PipelinetemplatesIdBody
|
|
179
183
|
from lightning_sdk.lightning_cloud.openapi.models.profiler_captures_body import ProfilerCapturesBody
|
|
180
184
|
from lightning_sdk.lightning_cloud.openapi.models.profiler_enabled_body import ProfilerEnabledBody
|
|
@@ -308,10 +312,12 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_publication_typ
|
|
|
308
312
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_seed_file import V1CloudSpaceSeedFile
|
|
309
313
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_session import V1CloudSpaceSession
|
|
310
314
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_source_type import V1CloudSpaceSourceType
|
|
315
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_specialized_view import V1CloudSpaceSpecializedView
|
|
311
316
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_state import V1CloudSpaceState
|
|
312
317
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_version import V1CloudSpaceVersion
|
|
313
318
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloud_space_version_publication import V1CloudSpaceVersionPublication
|
|
314
319
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cloudflare_v1 import V1CloudflareV1
|
|
320
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_cloudy_expert import V1CloudyExpert
|
|
315
321
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cluster_accelerator import V1ClusterAccelerator
|
|
316
322
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cluster_availability import V1ClusterAvailability
|
|
317
323
|
from lightning_sdk.lightning_cloud.openapi.models.v1_cluster_capacity_reservation import V1ClusterCapacityReservation
|
|
@@ -599,6 +605,8 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_job_type import V1JobType
|
|
|
599
605
|
from lightning_sdk.lightning_cloud.openapi.models.v1_joinable_organization import V1JoinableOrganization
|
|
600
606
|
from lightning_sdk.lightning_cloud.openapi.models.v1_keep_alive_cloud_space_instance_response import V1KeepAliveCloudSpaceInstanceResponse
|
|
601
607
|
from lightning_sdk.lightning_cloud.openapi.models.v1_knowledge_configuration import V1KnowledgeConfiguration
|
|
608
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_kubernetes_direct_v1 import V1KubernetesDirectV1
|
|
609
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_kubernetes_direct_v1_status import V1KubernetesDirectV1Status
|
|
602
610
|
from lightning_sdk.lightning_cloud.openapi.models.v1_lambda_labs_direct_v1 import V1LambdaLabsDirectV1
|
|
603
611
|
from lightning_sdk.lightning_cloud.openapi.models.v1_lightning_app_user import V1LightningAppUser
|
|
604
612
|
from lightning_sdk.lightning_cloud.openapi.models.v1_lightning_auth import V1LightningAuth
|
|
@@ -634,6 +642,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_list_cloud_space_tags_respo
|
|
|
634
642
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_cloud_space_version_publications_response import V1ListCloudSpaceVersionPublicationsResponse
|
|
635
643
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_cloud_space_versions_response import V1ListCloudSpaceVersionsResponse
|
|
636
644
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_cloud_spaces_response import V1ListCloudSpacesResponse
|
|
645
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_list_cloudy_experts_response import V1ListCloudyExpertsResponse
|
|
637
646
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_cluster_accelerators_response import V1ListClusterAcceleratorsResponse
|
|
638
647
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_cluster_availabilities_response import V1ListClusterAvailabilitiesResponse
|
|
639
648
|
from lightning_sdk.lightning_cloud.openapi.models.v1_list_cluster_capacity_reservations_response import V1ListClusterCapacityReservationsResponse
|
|
@@ -904,6 +913,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_system_metrics_aggregated i
|
|
|
904
913
|
from lightning_sdk.lightning_cloud.openapi.models.v1_system_metrics_list import V1SystemMetricsList
|
|
905
914
|
from lightning_sdk.lightning_cloud.openapi.models.v1_telemetry import V1Telemetry
|
|
906
915
|
from lightning_sdk.lightning_cloud.openapi.models.v1_timestamp_code_telemetry import V1TimestampCodeTelemetry
|
|
916
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_token_usage import V1TokenUsage
|
|
907
917
|
from lightning_sdk.lightning_cloud.openapi.models.v1_transaction import V1Transaction
|
|
908
918
|
from lightning_sdk.lightning_cloud.openapi.models.v1_transfer_cloud_space_response import V1TransferCloudSpaceResponse
|
|
909
919
|
from lightning_sdk.lightning_cloud.openapi.models.v1_transfer_org_balance_response import V1TransferOrgBalanceResponse
|
|
@@ -929,9 +939,11 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_update_lit_page_response im
|
|
|
929
939
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_lit_repository_response import V1UpdateLitRepositoryResponse
|
|
930
940
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_metrics_stream_visibility_response import V1UpdateMetricsStreamVisibilityResponse
|
|
931
941
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_model_visibility_response import V1UpdateModelVisibilityResponse
|
|
942
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_update_organization_credits_auto_replenish_response import V1UpdateOrganizationCreditsAutoReplenishResponse
|
|
932
943
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_project_cluster_accelerators_response import V1UpdateProjectClusterAcceleratorsResponse
|
|
933
944
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_shared_metrics_stream_response import V1UpdateSharedMetricsStreamResponse
|
|
934
945
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_snowflake_query_response import V1UpdateSnowflakeQueryResponse
|
|
946
|
+
from lightning_sdk.lightning_cloud.openapi.models.v1_update_user_credits_auto_replenish_response import V1UpdateUserCreditsAutoReplenishResponse
|
|
935
947
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_user_request import V1UpdateUserRequest
|
|
936
948
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_user_viewed_new_features_request import V1UpdateUserViewedNewFeaturesRequest
|
|
937
949
|
from lightning_sdk.lightning_cloud.openapi.models.v1_update_user_viewed_new_features_response import V1UpdateUserViewedNewFeaturesResponse
|
|
@@ -11,6 +11,7 @@ from lightning_sdk.lightning_cloud.openapi.api.billing_service_api import Billin
|
|
|
11
11
|
from lightning_sdk.lightning_cloud.openapi.api.blog_posts_service_api import BlogPostsServiceApi
|
|
12
12
|
from lightning_sdk.lightning_cloud.openapi.api.cloud_space_environment_template_service_api import CloudSpaceEnvironmentTemplateServiceApi
|
|
13
13
|
from lightning_sdk.lightning_cloud.openapi.api.cloud_space_service_api import CloudSpaceServiceApi
|
|
14
|
+
from lightning_sdk.lightning_cloud.openapi.api.cloudy_service_api import CloudyServiceApi
|
|
14
15
|
from lightning_sdk.lightning_cloud.openapi.api.cluster_service_api import ClusterServiceApi
|
|
15
16
|
from lightning_sdk.lightning_cloud.openapi.api.data_connection_service_api import DataConnectionServiceApi
|
|
16
17
|
from lightning_sdk.lightning_cloud.openapi.api.dataset_service_api import DatasetServiceApi
|
|
@@ -952,6 +952,111 @@ class AssistantsServiceApi(object):
|
|
|
952
952
|
_request_timeout=params.get('_request_timeout'),
|
|
953
953
|
collection_formats=collection_formats)
|
|
954
954
|
|
|
955
|
+
def assistants_service_get_managed_model_assistant(self, model_name: 'str', **kwargs) -> 'V1Assistant': # noqa: E501
|
|
956
|
+
"""Each managed model has a dedicated assistant for direct interaction. By using user_name, org_name, or model_provider as query parameters, this endpoint retrieves that specific assistant only—excluding any other assistants that may use the same model. # noqa: E501
|
|
957
|
+
|
|
958
|
+
This method makes a synchronous HTTP request by default. To make an
|
|
959
|
+
asynchronous HTTP request, please pass async_req=True
|
|
960
|
+
>>> thread = api.assistants_service_get_managed_model_assistant(model_name, async_req=True)
|
|
961
|
+
>>> result = thread.get()
|
|
962
|
+
|
|
963
|
+
:param async_req bool
|
|
964
|
+
:param str model_name: (required)
|
|
965
|
+
:param str user_name:
|
|
966
|
+
:param str org_name:
|
|
967
|
+
:param str model_provider:
|
|
968
|
+
:return: V1Assistant
|
|
969
|
+
If the method is called asynchronously,
|
|
970
|
+
returns the request thread.
|
|
971
|
+
"""
|
|
972
|
+
kwargs['_return_http_data_only'] = True
|
|
973
|
+
if kwargs.get('async_req'):
|
|
974
|
+
return self.assistants_service_get_managed_model_assistant_with_http_info(model_name, **kwargs) # noqa: E501
|
|
975
|
+
else:
|
|
976
|
+
(data) = self.assistants_service_get_managed_model_assistant_with_http_info(model_name, **kwargs) # noqa: E501
|
|
977
|
+
return data
|
|
978
|
+
|
|
979
|
+
def assistants_service_get_managed_model_assistant_with_http_info(self, model_name: 'str', **kwargs) -> 'V1Assistant': # noqa: E501
|
|
980
|
+
"""Each managed model has a dedicated assistant for direct interaction. By using user_name, org_name, or model_provider as query parameters, this endpoint retrieves that specific assistant only—excluding any other assistants that may use the same model. # noqa: E501
|
|
981
|
+
|
|
982
|
+
This method makes a synchronous HTTP request by default. To make an
|
|
983
|
+
asynchronous HTTP request, please pass async_req=True
|
|
984
|
+
>>> thread = api.assistants_service_get_managed_model_assistant_with_http_info(model_name, async_req=True)
|
|
985
|
+
>>> result = thread.get()
|
|
986
|
+
|
|
987
|
+
:param async_req bool
|
|
988
|
+
:param str model_name: (required)
|
|
989
|
+
:param str user_name:
|
|
990
|
+
:param str org_name:
|
|
991
|
+
:param str model_provider:
|
|
992
|
+
:return: V1Assistant
|
|
993
|
+
If the method is called asynchronously,
|
|
994
|
+
returns the request thread.
|
|
995
|
+
"""
|
|
996
|
+
|
|
997
|
+
all_params = ['model_name', 'user_name', 'org_name', 'model_provider'] # noqa: E501
|
|
998
|
+
all_params.append('async_req')
|
|
999
|
+
all_params.append('_return_http_data_only')
|
|
1000
|
+
all_params.append('_preload_content')
|
|
1001
|
+
all_params.append('_request_timeout')
|
|
1002
|
+
|
|
1003
|
+
params = locals()
|
|
1004
|
+
for key, val in six.iteritems(params['kwargs']):
|
|
1005
|
+
if key not in all_params:
|
|
1006
|
+
raise TypeError(
|
|
1007
|
+
"Got an unexpected keyword argument '%s'"
|
|
1008
|
+
" to method assistants_service_get_managed_model_assistant" % key
|
|
1009
|
+
)
|
|
1010
|
+
params[key] = val
|
|
1011
|
+
del params['kwargs']
|
|
1012
|
+
# verify the required parameter 'model_name' is set
|
|
1013
|
+
if ('model_name' not in params or
|
|
1014
|
+
params['model_name'] is None):
|
|
1015
|
+
raise ValueError("Missing the required parameter `model_name` when calling `assistants_service_get_managed_model_assistant`") # noqa: E501
|
|
1016
|
+
|
|
1017
|
+
collection_formats = {}
|
|
1018
|
+
|
|
1019
|
+
path_params = {}
|
|
1020
|
+
if 'model_name' in params:
|
|
1021
|
+
path_params['modelName'] = params['model_name'] # noqa: E501
|
|
1022
|
+
|
|
1023
|
+
query_params = []
|
|
1024
|
+
if 'user_name' in params:
|
|
1025
|
+
query_params.append(('userName', params['user_name'])) # noqa: E501
|
|
1026
|
+
if 'org_name' in params:
|
|
1027
|
+
query_params.append(('orgName', params['org_name'])) # noqa: E501
|
|
1028
|
+
if 'model_provider' in params:
|
|
1029
|
+
query_params.append(('modelProvider', params['model_provider'])) # noqa: E501
|
|
1030
|
+
|
|
1031
|
+
header_params = {}
|
|
1032
|
+
|
|
1033
|
+
form_params = []
|
|
1034
|
+
local_var_files = {}
|
|
1035
|
+
|
|
1036
|
+
body_params = None
|
|
1037
|
+
# HTTP header `Accept`
|
|
1038
|
+
header_params['Accept'] = self.api_client.select_header_accept(
|
|
1039
|
+
['application/json']) # noqa: E501
|
|
1040
|
+
|
|
1041
|
+
# Authentication setting
|
|
1042
|
+
auth_settings = [] # noqa: E501
|
|
1043
|
+
|
|
1044
|
+
return self.api_client.call_api(
|
|
1045
|
+
'/v1/agents/managed-model/{modelName}', 'GET',
|
|
1046
|
+
path_params,
|
|
1047
|
+
query_params,
|
|
1048
|
+
header_params,
|
|
1049
|
+
body=body_params,
|
|
1050
|
+
post_params=form_params,
|
|
1051
|
+
files=local_var_files,
|
|
1052
|
+
response_type='V1Assistant', # noqa: E501
|
|
1053
|
+
auth_settings=auth_settings,
|
|
1054
|
+
async_req=params.get('async_req'),
|
|
1055
|
+
_return_http_data_only=params.get('_return_http_data_only'),
|
|
1056
|
+
_preload_content=params.get('_preload_content', True),
|
|
1057
|
+
_request_timeout=params.get('_request_timeout'),
|
|
1058
|
+
collection_formats=collection_formats)
|
|
1059
|
+
|
|
955
1060
|
def assistants_service_get_managed_model_by_name(self, project_id: 'str', managed_endpoint_id: 'str', name: 'str', **kwargs) -> 'V1ManagedModel': # noqa: E501
|
|
956
1061
|
"""assistants_service_get_managed_model_by_name # noqa: E501
|
|
957
1062
|
|
|
@@ -1169,6 +1274,8 @@ class AssistantsServiceApi(object):
|
|
|
1169
1274
|
:param bool published:
|
|
1170
1275
|
:param str internal_name:
|
|
1171
1276
|
:param str user_id:
|
|
1277
|
+
:param bool cloudy_compatible:
|
|
1278
|
+
:param bool model_assistants_only:
|
|
1172
1279
|
:return: V1ListAssistantsResponse
|
|
1173
1280
|
If the method is called asynchronously,
|
|
1174
1281
|
returns the request thread.
|
|
@@ -1195,12 +1302,14 @@ class AssistantsServiceApi(object):
|
|
|
1195
1302
|
:param bool published:
|
|
1196
1303
|
:param str internal_name:
|
|
1197
1304
|
:param str user_id:
|
|
1305
|
+
:param bool cloudy_compatible:
|
|
1306
|
+
:param bool model_assistants_only:
|
|
1198
1307
|
:return: V1ListAssistantsResponse
|
|
1199
1308
|
If the method is called asynchronously,
|
|
1200
1309
|
returns the request thread.
|
|
1201
1310
|
"""
|
|
1202
1311
|
|
|
1203
|
-
all_params = ['org_id', 'project_id', 'cloudspace_id', 'published', 'internal_name', 'user_id'] # noqa: E501
|
|
1312
|
+
all_params = ['org_id', 'project_id', 'cloudspace_id', 'published', 'internal_name', 'user_id', 'cloudy_compatible', 'model_assistants_only'] # noqa: E501
|
|
1204
1313
|
all_params.append('async_req')
|
|
1205
1314
|
all_params.append('_return_http_data_only')
|
|
1206
1315
|
all_params.append('_preload_content')
|
|
@@ -1233,6 +1342,10 @@ class AssistantsServiceApi(object):
|
|
|
1233
1342
|
query_params.append(('internalName', params['internal_name'])) # noqa: E501
|
|
1234
1343
|
if 'user_id' in params:
|
|
1235
1344
|
query_params.append(('userId', params['user_id'])) # noqa: E501
|
|
1345
|
+
if 'cloudy_compatible' in params:
|
|
1346
|
+
query_params.append(('cloudyCompatible', params['cloudy_compatible'])) # noqa: E501
|
|
1347
|
+
if 'model_assistants_only' in params:
|
|
1348
|
+
query_params.append(('modelAssistantsOnly', params['model_assistants_only'])) # noqa: E501
|
|
1236
1349
|
|
|
1237
1350
|
header_params = {}
|
|
1238
1351
|
|