beamlit 0.0.24rc19__py3-none-any.whl → 0.0.24rc21__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- beamlit/agents/chat.py +37 -11
- beamlit/agents/decorator.py +97 -65
- beamlit/api/agents/create_agent.py +9 -14
- beamlit/api/agents/delete_agent.py +22 -1
- beamlit/api/agents/delete_agent_history.py +2 -6
- beamlit/api/agents/get_agent.py +22 -1
- beamlit/api/agents/get_agent_environment_logs.py +11 -11
- beamlit/api/agents/get_agent_history.py +2 -6
- beamlit/api/agents/get_agent_metrics.py +22 -1
- beamlit/api/agents/list_agent_history.py +11 -11
- beamlit/api/agents/list_agents.py +36 -4
- beamlit/api/agents/put_agent_history.py +2 -6
- beamlit/api/agents/update_agent.py +9 -14
- beamlit/api/functions/create_function.py +9 -14
- beamlit/api/functions/delete_function.py +22 -1
- beamlit/api/functions/get_function.py +22 -1
- beamlit/api/functions/get_function_environment_logs.py +11 -11
- beamlit/api/functions/get_function_metrics.py +22 -1
- beamlit/api/functions/list_functions.py +36 -4
- beamlit/api/functions/update_function.py +9 -14
- beamlit/api/history/get_agents_history.py +12 -12
- beamlit/api/history/list_agents_history.py +12 -12
- beamlit/api/integrations/get_integration_connection.py +16 -12
- beamlit/api/integrations/get_integration_connection_model.py +8 -1
- beamlit/api/integrations/get_integration_model.py +8 -1
- beamlit/api/locations/list_locations.py +12 -12
- beamlit/api/models/create_model.py +13 -14
- beamlit/api/models/delete_model.py +22 -1
- beamlit/api/models/get_model.py +22 -1
- beamlit/api/models/get_model_environment_logs.py +11 -11
- beamlit/api/models/get_model_metrics.py +38 -13
- beamlit/api/models/list_models.py +36 -4
- beamlit/api/models/update_model.py +13 -14
- beamlit/api/privateclusters/__init__.py +0 -0
- beamlit/api/{agents/get_agent_deployment_metrics.py → privateclusters/create_private_cluster.py} +28 -55
- beamlit/api/{functions/list_function_deployments.py → privateclusters/delete_private_cluster.py} +38 -37
- beamlit/api/{agents/get_agent_deployment.py → privateclusters/get_private_cluster.py} +40 -44
- beamlit/api/privateclusters/get_private_cluster_health.py +97 -0
- beamlit/api/{agents/list_agent_deployments.py → privateclusters/list_private_clusters.py} +30 -45
- beamlit/api/{models/list_model_deployments.py → privateclusters/update_private_cluster.py} +38 -45
- beamlit/api/privateclusters/update_private_cluster_health.py +97 -0
- beamlit/authentication/device_mode.py +3 -9
- beamlit/common/generate.py +47 -34
- beamlit/common/settings.py +29 -27
- beamlit/deploy/deploy.py +101 -342
- beamlit/deploy/format.py +70 -0
- beamlit/deploy/parser.py +175 -0
- beamlit/functions/decorator.py +17 -14
- beamlit/models/__init__.py +64 -78
- beamlit/models/acl.py +4 -22
- beamlit/models/agent.py +34 -95
- beamlit/models/agent_history.py +7 -5
- beamlit/models/agent_history_event.py +11 -9
- beamlit/models/agent_metadata.py +5 -3
- beamlit/models/agent_spec.py +54 -45
- beamlit/models/api_key.py +14 -14
- beamlit/models/configuration.py +11 -0
- beamlit/models/core_spec.py +45 -32
- beamlit/models/{model_deployment_metrics_query_per_second_per_region_per_code.py → core_spec_configurations.py} +22 -22
- beamlit/models/environment.py +33 -105
- beamlit/models/environment_metadata.py +146 -0
- beamlit/models/environment_spec.py +8 -6
- beamlit/models/function.py +34 -95
- beamlit/models/function_metadata.py +5 -3
- beamlit/models/function_spec.py +53 -40
- beamlit/models/integration_connection.py +31 -137
- beamlit/models/integration_connection_spec.py +6 -4
- beamlit/models/metadata.py +5 -3
- beamlit/models/metadata_labels.py +4 -2
- beamlit/models/model.py +33 -94
- beamlit/models/model_metadata.py +5 -3
- beamlit/models/{function_provider_ref.py → model_private_cluster.py} +23 -14
- beamlit/models/model_provider.py +27 -43
- beamlit/models/model_spec.py +45 -32
- beamlit/models/owner_fields.py +4 -2
- beamlit/models/pending_invitation.py +14 -14
- beamlit/models/pod_template_spec.py +4 -2
- beamlit/models/policy.py +33 -159
- beamlit/models/policy_spec.py +24 -28
- beamlit/models/private_cluster.py +183 -0
- beamlit/models/{model_provider_ref.py → private_location.py} +7 -16
- beamlit/models/resource_deployment_metrics.py +0 -108
- beamlit/models/resource_environment_metrics.py +143 -71
- beamlit/models/{resource_deployment_metrics_inference_per_region.py → resource_environment_metrics_inference_per_region.py} +5 -5
- beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +9 -11
- beamlit/models/{resource_deployment_metrics_query_per_region_per_code.py → resource_environment_metrics_query_per_region_per_code.py} +5 -5
- beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +5 -3
- beamlit/models/resource_log.py +4 -2
- beamlit/models/runtime.py +20 -2
- beamlit/models/serverless_config.py +28 -21
- beamlit/models/spec_configuration.py +7 -5
- beamlit/models/store_agent.py +14 -14
- beamlit/models/store_function.py +14 -14
- beamlit/models/time_fields.py +4 -2
- beamlit/models/websocket_channel.py +4 -2
- beamlit/models/workspace.py +23 -14
- beamlit/run.py +0 -1
- beamlit/serve/app.py +1 -0
- beamlit/serve/middlewares/accesslog.py +3 -1
- {beamlit-0.0.24rc19.dist-info → beamlit-0.0.24rc21.dist-info}/METADATA +1 -1
- beamlit-0.0.24rc21.dist-info/RECORD +243 -0
- beamlit/api/agents/delete_agent_deployment.py +0 -163
- beamlit/api/agents/delete_agent_deployment_history.py +0 -172
- beamlit/api/agents/get_agent_deployment_history.py +0 -172
- beamlit/api/agents/get_agent_deployment_logs.py +0 -164
- beamlit/api/agents/list_agent_deployment_history.py +0 -164
- beamlit/api/agents/put_agent_deployment.py +0 -185
- beamlit/api/agents/put_agent_deployment_history.py +0 -198
- beamlit/api/functions/delete_function_deployment.py +0 -163
- beamlit/api/functions/get_function_deployment.py +0 -163
- beamlit/api/functions/get_function_deployment_logs.py +0 -164
- beamlit/api/functions/get_function_deployment_metrics.py +0 -159
- beamlit/api/functions/put_function_deployment.py +0 -185
- beamlit/api/models/delete_model_deployment.py +0 -171
- beamlit/api/models/get_model_deployment.py +0 -171
- beamlit/api/models/get_model_deployment_logs.py +0 -168
- beamlit/api/models/get_model_deployment_metrics.py +0 -163
- beamlit/api/models/put_model_deployment.py +0 -193
- beamlit/models/agent_configuration.py +0 -70
- beamlit/models/agent_deployment.py +0 -340
- beamlit/models/agent_deployment_configuration.py +0 -45
- beamlit/models/agent_deployment_configuration_type_0.py +0 -43
- beamlit/models/agent_deployment_history.py +0 -185
- beamlit/models/agent_deployment_history_event.py +0 -133
- beamlit/models/agent_deployment_pod_template.py +0 -45
- beamlit/models/agent_deployment_pod_template_type_0.py +0 -43
- beamlit/models/agent_with_deployments.py +0 -176
- beamlit/models/authentication_provider_model.py +0 -144
- beamlit/models/authentication_provider_organization.py +0 -88
- beamlit/models/deployment_configuration.py +0 -70
- beamlit/models/deployment_configurations.py +0 -58
- beamlit/models/deployment_serverless_config.py +0 -131
- beamlit/models/deployment_serverless_config_type_0.py +0 -220
- beamlit/models/function_configuration.py +0 -70
- beamlit/models/function_deployment.py +0 -340
- beamlit/models/function_deployment_configuration.py +0 -45
- beamlit/models/function_deployment_configuration_type_0.py +0 -43
- beamlit/models/function_deployment_pod_template.py +0 -45
- beamlit/models/function_deployment_pod_template_type_0.py +0 -43
- beamlit/models/function_with_deployments.py +0 -176
- beamlit/models/integration.py +0 -198
- beamlit/models/integration_config.py +0 -45
- beamlit/models/integration_secret.py +0 -61
- beamlit/models/labels_type_0.py +0 -45
- beamlit/models/location.py +0 -122
- beamlit/models/model_deployment.py +0 -296
- beamlit/models/model_deployment_log.py +0 -70
- beamlit/models/model_deployment_metrics.py +0 -172
- beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +0 -77
- beamlit/models/model_deployment_pod_template.py +0 -45
- beamlit/models/model_deployment_pod_template_type_0.py +0 -43
- beamlit/models/model_metrics.py +0 -96
- beamlit/models/model_with_deployments.py +0 -176
- beamlit/models/resource_deployment_log.py +0 -70
- beamlit/models/resource_deployment_metrics_inference_per_region_type_0.py +0 -79
- beamlit/models/resource_deployment_metrics_inference_per_second_per_region_type_0.py +0 -79
- beamlit/models/resource_deployment_metrics_query_per_region_per_code_type_0.py +0 -73
- beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code_type_0.py +0 -73
- beamlit/models/runtime_readiness_probe_type_0.py +0 -43
- beamlit/models/runtime_type_0.py +0 -111
- beamlit/models/runtime_type_0_readiness_probe.py +0 -43
- beamlit/models/runtime_type_0_readiness_probe_type_0.py +0 -43
- beamlit/models/runtime_type_0_resources.py +0 -59
- beamlit/models/standard_fields_dynamo_db.py +0 -88
- beamlit/models/store_agent_configuration.py +0 -97
- beamlit/models/store_agent_labels_type_0.py +0 -43
- beamlit/models/store_function_configuration.py +0 -97
- beamlit/models/store_function_labels_type_0.py +0 -43
- beamlit-0.0.24rc19.dist-info/RECORD +0 -303
- {beamlit-0.0.24rc19.dist-info → beamlit-0.0.24rc21.dist-info}/WHEEL +0 -0
@@ -1,168 +0,0 @@
|
|
1
|
-
from http import HTTPStatus
|
2
|
-
from typing import Any, Optional, Union
|
3
|
-
|
4
|
-
import httpx
|
5
|
-
|
6
|
-
from ... import errors
|
7
|
-
from ...client import AuthenticatedClient, Client
|
8
|
-
from ...models.model_deployment_log import ModelDeploymentLog
|
9
|
-
from ...types import Response
|
10
|
-
|
11
|
-
|
12
|
-
def _get_kwargs(
|
13
|
-
model_name: str,
|
14
|
-
environment_name: str,
|
15
|
-
) -> dict[str, Any]:
|
16
|
-
_kwargs: dict[str, Any] = {
|
17
|
-
"method": "get",
|
18
|
-
"url": f"/models/{model_name}/deployments/{environment_name}/logs",
|
19
|
-
}
|
20
|
-
|
21
|
-
return _kwargs
|
22
|
-
|
23
|
-
|
24
|
-
def _parse_response(
|
25
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
26
|
-
) -> Optional[list["ModelDeploymentLog"]]:
|
27
|
-
if response.status_code == 200:
|
28
|
-
response_200 = []
|
29
|
-
_response_200 = response.json()
|
30
|
-
for response_200_item_data in _response_200:
|
31
|
-
response_200_item = ModelDeploymentLog.from_dict(response_200_item_data)
|
32
|
-
|
33
|
-
response_200.append(response_200_item)
|
34
|
-
|
35
|
-
return response_200
|
36
|
-
if client.raise_on_unexpected_status:
|
37
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
38
|
-
else:
|
39
|
-
return None
|
40
|
-
|
41
|
-
|
42
|
-
def _build_response(
|
43
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
44
|
-
) -> Response[list["ModelDeploymentLog"]]:
|
45
|
-
return Response(
|
46
|
-
status_code=HTTPStatus(response.status_code),
|
47
|
-
content=response.content,
|
48
|
-
headers=response.headers,
|
49
|
-
parsed=_parse_response(client=client, response=response),
|
50
|
-
)
|
51
|
-
|
52
|
-
|
53
|
-
def sync_detailed(
|
54
|
-
model_name: str,
|
55
|
-
environment_name: str,
|
56
|
-
*,
|
57
|
-
client: AuthenticatedClient,
|
58
|
-
) -> Response[list["ModelDeploymentLog"]]:
|
59
|
-
"""Returns logs for a model deployment by name.
|
60
|
-
|
61
|
-
Args:
|
62
|
-
model_name (str):
|
63
|
-
environment_name (str):
|
64
|
-
|
65
|
-
Raises:
|
66
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
67
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
68
|
-
|
69
|
-
Returns:
|
70
|
-
Response[list['ModelDeploymentLog']]
|
71
|
-
"""
|
72
|
-
|
73
|
-
kwargs = _get_kwargs(
|
74
|
-
model_name=model_name,
|
75
|
-
environment_name=environment_name,
|
76
|
-
)
|
77
|
-
|
78
|
-
response = client.get_httpx_client().request(
|
79
|
-
**kwargs,
|
80
|
-
)
|
81
|
-
|
82
|
-
return _build_response(client=client, response=response)
|
83
|
-
|
84
|
-
|
85
|
-
def sync(
|
86
|
-
model_name: str,
|
87
|
-
environment_name: str,
|
88
|
-
*,
|
89
|
-
client: AuthenticatedClient,
|
90
|
-
) -> Optional[list["ModelDeploymentLog"]]:
|
91
|
-
"""Returns logs for a model deployment by name.
|
92
|
-
|
93
|
-
Args:
|
94
|
-
model_name (str):
|
95
|
-
environment_name (str):
|
96
|
-
|
97
|
-
Raises:
|
98
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
99
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
100
|
-
|
101
|
-
Returns:
|
102
|
-
list['ModelDeploymentLog']
|
103
|
-
"""
|
104
|
-
|
105
|
-
return sync_detailed(
|
106
|
-
model_name=model_name,
|
107
|
-
environment_name=environment_name,
|
108
|
-
client=client,
|
109
|
-
).parsed
|
110
|
-
|
111
|
-
|
112
|
-
async def asyncio_detailed(
|
113
|
-
model_name: str,
|
114
|
-
environment_name: str,
|
115
|
-
*,
|
116
|
-
client: AuthenticatedClient,
|
117
|
-
) -> Response[list["ModelDeploymentLog"]]:
|
118
|
-
"""Returns logs for a model deployment by name.
|
119
|
-
|
120
|
-
Args:
|
121
|
-
model_name (str):
|
122
|
-
environment_name (str):
|
123
|
-
|
124
|
-
Raises:
|
125
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
126
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
127
|
-
|
128
|
-
Returns:
|
129
|
-
Response[list['ModelDeploymentLog']]
|
130
|
-
"""
|
131
|
-
|
132
|
-
kwargs = _get_kwargs(
|
133
|
-
model_name=model_name,
|
134
|
-
environment_name=environment_name,
|
135
|
-
)
|
136
|
-
|
137
|
-
response = await client.get_async_httpx_client().request(**kwargs)
|
138
|
-
|
139
|
-
return _build_response(client=client, response=response)
|
140
|
-
|
141
|
-
|
142
|
-
async def asyncio(
|
143
|
-
model_name: str,
|
144
|
-
environment_name: str,
|
145
|
-
*,
|
146
|
-
client: AuthenticatedClient,
|
147
|
-
) -> Optional[list["ModelDeploymentLog"]]:
|
148
|
-
"""Returns logs for a model deployment by name.
|
149
|
-
|
150
|
-
Args:
|
151
|
-
model_name (str):
|
152
|
-
environment_name (str):
|
153
|
-
|
154
|
-
Raises:
|
155
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
156
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
157
|
-
|
158
|
-
Returns:
|
159
|
-
list['ModelDeploymentLog']
|
160
|
-
"""
|
161
|
-
|
162
|
-
return (
|
163
|
-
await asyncio_detailed(
|
164
|
-
model_name=model_name,
|
165
|
-
environment_name=environment_name,
|
166
|
-
client=client,
|
167
|
-
)
|
168
|
-
).parsed
|
@@ -1,163 +0,0 @@
|
|
1
|
-
from http import HTTPStatus
|
2
|
-
from typing import Any, Optional, Union
|
3
|
-
|
4
|
-
import httpx
|
5
|
-
|
6
|
-
from ... import errors
|
7
|
-
from ...client import AuthenticatedClient, Client
|
8
|
-
from ...models.model_deployment_metrics import ModelDeploymentMetrics
|
9
|
-
from ...types import Response
|
10
|
-
|
11
|
-
|
12
|
-
def _get_kwargs(
|
13
|
-
model_name: str,
|
14
|
-
environment_name: str,
|
15
|
-
) -> dict[str, Any]:
|
16
|
-
_kwargs: dict[str, Any] = {
|
17
|
-
"method": "get",
|
18
|
-
"url": f"/models/{model_name}/deployments/{environment_name}/metrics",
|
19
|
-
}
|
20
|
-
|
21
|
-
return _kwargs
|
22
|
-
|
23
|
-
|
24
|
-
def _parse_response(
|
25
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
26
|
-
) -> Optional[ModelDeploymentMetrics]:
|
27
|
-
if response.status_code == 200:
|
28
|
-
response_200 = ModelDeploymentMetrics.from_dict(response.json())
|
29
|
-
|
30
|
-
return response_200
|
31
|
-
if client.raise_on_unexpected_status:
|
32
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
33
|
-
else:
|
34
|
-
return None
|
35
|
-
|
36
|
-
|
37
|
-
def _build_response(
|
38
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
39
|
-
) -> Response[ModelDeploymentMetrics]:
|
40
|
-
return Response(
|
41
|
-
status_code=HTTPStatus(response.status_code),
|
42
|
-
content=response.content,
|
43
|
-
headers=response.headers,
|
44
|
-
parsed=_parse_response(client=client, response=response),
|
45
|
-
)
|
46
|
-
|
47
|
-
|
48
|
-
def sync_detailed(
|
49
|
-
model_name: str,
|
50
|
-
environment_name: str,
|
51
|
-
*,
|
52
|
-
client: AuthenticatedClient,
|
53
|
-
) -> Response[ModelDeploymentMetrics]:
|
54
|
-
"""Returns metrics for a model deployment by name.
|
55
|
-
|
56
|
-
Args:
|
57
|
-
model_name (str):
|
58
|
-
environment_name (str):
|
59
|
-
|
60
|
-
Raises:
|
61
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
62
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
63
|
-
|
64
|
-
Returns:
|
65
|
-
Response[ModelDeploymentMetrics]
|
66
|
-
"""
|
67
|
-
|
68
|
-
kwargs = _get_kwargs(
|
69
|
-
model_name=model_name,
|
70
|
-
environment_name=environment_name,
|
71
|
-
)
|
72
|
-
|
73
|
-
response = client.get_httpx_client().request(
|
74
|
-
**kwargs,
|
75
|
-
)
|
76
|
-
|
77
|
-
return _build_response(client=client, response=response)
|
78
|
-
|
79
|
-
|
80
|
-
def sync(
|
81
|
-
model_name: str,
|
82
|
-
environment_name: str,
|
83
|
-
*,
|
84
|
-
client: AuthenticatedClient,
|
85
|
-
) -> Optional[ModelDeploymentMetrics]:
|
86
|
-
"""Returns metrics for a model deployment by name.
|
87
|
-
|
88
|
-
Args:
|
89
|
-
model_name (str):
|
90
|
-
environment_name (str):
|
91
|
-
|
92
|
-
Raises:
|
93
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
94
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
95
|
-
|
96
|
-
Returns:
|
97
|
-
ModelDeploymentMetrics
|
98
|
-
"""
|
99
|
-
|
100
|
-
return sync_detailed(
|
101
|
-
model_name=model_name,
|
102
|
-
environment_name=environment_name,
|
103
|
-
client=client,
|
104
|
-
).parsed
|
105
|
-
|
106
|
-
|
107
|
-
async def asyncio_detailed(
|
108
|
-
model_name: str,
|
109
|
-
environment_name: str,
|
110
|
-
*,
|
111
|
-
client: AuthenticatedClient,
|
112
|
-
) -> Response[ModelDeploymentMetrics]:
|
113
|
-
"""Returns metrics for a model deployment by name.
|
114
|
-
|
115
|
-
Args:
|
116
|
-
model_name (str):
|
117
|
-
environment_name (str):
|
118
|
-
|
119
|
-
Raises:
|
120
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
121
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
122
|
-
|
123
|
-
Returns:
|
124
|
-
Response[ModelDeploymentMetrics]
|
125
|
-
"""
|
126
|
-
|
127
|
-
kwargs = _get_kwargs(
|
128
|
-
model_name=model_name,
|
129
|
-
environment_name=environment_name,
|
130
|
-
)
|
131
|
-
|
132
|
-
response = await client.get_async_httpx_client().request(**kwargs)
|
133
|
-
|
134
|
-
return _build_response(client=client, response=response)
|
135
|
-
|
136
|
-
|
137
|
-
async def asyncio(
|
138
|
-
model_name: str,
|
139
|
-
environment_name: str,
|
140
|
-
*,
|
141
|
-
client: AuthenticatedClient,
|
142
|
-
) -> Optional[ModelDeploymentMetrics]:
|
143
|
-
"""Returns metrics for a model deployment by name.
|
144
|
-
|
145
|
-
Args:
|
146
|
-
model_name (str):
|
147
|
-
environment_name (str):
|
148
|
-
|
149
|
-
Raises:
|
150
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
151
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
152
|
-
|
153
|
-
Returns:
|
154
|
-
ModelDeploymentMetrics
|
155
|
-
"""
|
156
|
-
|
157
|
-
return (
|
158
|
-
await asyncio_detailed(
|
159
|
-
model_name=model_name,
|
160
|
-
environment_name=environment_name,
|
161
|
-
client=client,
|
162
|
-
)
|
163
|
-
).parsed
|
@@ -1,193 +0,0 @@
|
|
1
|
-
from http import HTTPStatus
|
2
|
-
from typing import Any, Optional, Union
|
3
|
-
|
4
|
-
import httpx
|
5
|
-
|
6
|
-
from ... import errors
|
7
|
-
from ...client import AuthenticatedClient, Client
|
8
|
-
from ...models.model_deployment import ModelDeployment
|
9
|
-
from ...types import Response
|
10
|
-
|
11
|
-
|
12
|
-
def _get_kwargs(
|
13
|
-
model_name: str,
|
14
|
-
environment_name: str,
|
15
|
-
*,
|
16
|
-
body: ModelDeployment,
|
17
|
-
) -> dict[str, Any]:
|
18
|
-
headers: dict[str, Any] = {}
|
19
|
-
|
20
|
-
_kwargs: dict[str, Any] = {
|
21
|
-
"method": "put",
|
22
|
-
"url": f"/models/{model_name}/deployments/{environment_name}",
|
23
|
-
}
|
24
|
-
|
25
|
-
_body = body.to_dict()
|
26
|
-
|
27
|
-
_kwargs["json"] = _body
|
28
|
-
headers["Content-Type"] = "application/json"
|
29
|
-
|
30
|
-
_kwargs["headers"] = headers
|
31
|
-
return _kwargs
|
32
|
-
|
33
|
-
|
34
|
-
def _parse_response(
|
35
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
36
|
-
) -> Optional[ModelDeployment]:
|
37
|
-
if response.status_code == 200:
|
38
|
-
response_200 = ModelDeployment.from_dict(response.json())
|
39
|
-
|
40
|
-
return response_200
|
41
|
-
if client.raise_on_unexpected_status:
|
42
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
43
|
-
else:
|
44
|
-
return None
|
45
|
-
|
46
|
-
|
47
|
-
def _build_response(
|
48
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
49
|
-
) -> Response[ModelDeployment]:
|
50
|
-
return Response(
|
51
|
-
status_code=HTTPStatus(response.status_code),
|
52
|
-
content=response.content,
|
53
|
-
headers=response.headers,
|
54
|
-
parsed=_parse_response(client=client, response=response),
|
55
|
-
)
|
56
|
-
|
57
|
-
|
58
|
-
def sync_detailed(
|
59
|
-
model_name: str,
|
60
|
-
environment_name: str,
|
61
|
-
*,
|
62
|
-
client: AuthenticatedClient,
|
63
|
-
body: ModelDeployment,
|
64
|
-
) -> Response[ModelDeployment]:
|
65
|
-
"""Create or update model deployment
|
66
|
-
|
67
|
-
Creates or updates a deployment for a model by name.
|
68
|
-
|
69
|
-
Args:
|
70
|
-
model_name (str):
|
71
|
-
environment_name (str):
|
72
|
-
body (ModelDeployment): An instance of a model, deployed in a specific environment
|
73
|
-
|
74
|
-
Raises:
|
75
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
76
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
77
|
-
|
78
|
-
Returns:
|
79
|
-
Response[ModelDeployment]
|
80
|
-
"""
|
81
|
-
|
82
|
-
kwargs = _get_kwargs(
|
83
|
-
model_name=model_name,
|
84
|
-
environment_name=environment_name,
|
85
|
-
body=body,
|
86
|
-
)
|
87
|
-
|
88
|
-
response = client.get_httpx_client().request(
|
89
|
-
**kwargs,
|
90
|
-
)
|
91
|
-
|
92
|
-
return _build_response(client=client, response=response)
|
93
|
-
|
94
|
-
|
95
|
-
def sync(
|
96
|
-
model_name: str,
|
97
|
-
environment_name: str,
|
98
|
-
*,
|
99
|
-
client: AuthenticatedClient,
|
100
|
-
body: ModelDeployment,
|
101
|
-
) -> Optional[ModelDeployment]:
|
102
|
-
"""Create or update model deployment
|
103
|
-
|
104
|
-
Creates or updates a deployment for a model by name.
|
105
|
-
|
106
|
-
Args:
|
107
|
-
model_name (str):
|
108
|
-
environment_name (str):
|
109
|
-
body (ModelDeployment): An instance of a model, deployed in a specific environment
|
110
|
-
|
111
|
-
Raises:
|
112
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
113
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
114
|
-
|
115
|
-
Returns:
|
116
|
-
ModelDeployment
|
117
|
-
"""
|
118
|
-
|
119
|
-
return sync_detailed(
|
120
|
-
model_name=model_name,
|
121
|
-
environment_name=environment_name,
|
122
|
-
client=client,
|
123
|
-
body=body,
|
124
|
-
).parsed
|
125
|
-
|
126
|
-
|
127
|
-
async def asyncio_detailed(
|
128
|
-
model_name: str,
|
129
|
-
environment_name: str,
|
130
|
-
*,
|
131
|
-
client: AuthenticatedClient,
|
132
|
-
body: ModelDeployment,
|
133
|
-
) -> Response[ModelDeployment]:
|
134
|
-
"""Create or update model deployment
|
135
|
-
|
136
|
-
Creates or updates a deployment for a model by name.
|
137
|
-
|
138
|
-
Args:
|
139
|
-
model_name (str):
|
140
|
-
environment_name (str):
|
141
|
-
body (ModelDeployment): An instance of a model, deployed in a specific environment
|
142
|
-
|
143
|
-
Raises:
|
144
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
145
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
146
|
-
|
147
|
-
Returns:
|
148
|
-
Response[ModelDeployment]
|
149
|
-
"""
|
150
|
-
|
151
|
-
kwargs = _get_kwargs(
|
152
|
-
model_name=model_name,
|
153
|
-
environment_name=environment_name,
|
154
|
-
body=body,
|
155
|
-
)
|
156
|
-
|
157
|
-
response = await client.get_async_httpx_client().request(**kwargs)
|
158
|
-
|
159
|
-
return _build_response(client=client, response=response)
|
160
|
-
|
161
|
-
|
162
|
-
async def asyncio(
|
163
|
-
model_name: str,
|
164
|
-
environment_name: str,
|
165
|
-
*,
|
166
|
-
client: AuthenticatedClient,
|
167
|
-
body: ModelDeployment,
|
168
|
-
) -> Optional[ModelDeployment]:
|
169
|
-
"""Create or update model deployment
|
170
|
-
|
171
|
-
Creates or updates a deployment for a model by name.
|
172
|
-
|
173
|
-
Args:
|
174
|
-
model_name (str):
|
175
|
-
environment_name (str):
|
176
|
-
body (ModelDeployment): An instance of a model, deployed in a specific environment
|
177
|
-
|
178
|
-
Raises:
|
179
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
180
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
181
|
-
|
182
|
-
Returns:
|
183
|
-
ModelDeployment
|
184
|
-
"""
|
185
|
-
|
186
|
-
return (
|
187
|
-
await asyncio_detailed(
|
188
|
-
model_name=model_name,
|
189
|
-
environment_name=environment_name,
|
190
|
-
client=client,
|
191
|
-
body=body,
|
192
|
-
)
|
193
|
-
).parsed
|
@@ -1,70 +0,0 @@
|
|
1
|
-
from typing import Any, TypeVar, Union
|
2
|
-
|
3
|
-
from attrs import define as _attrs_define
|
4
|
-
from attrs import field as _attrs_field
|
5
|
-
|
6
|
-
from ..types import UNSET, Unset
|
7
|
-
|
8
|
-
T = TypeVar("T", bound="AgentConfiguration")
|
9
|
-
|
10
|
-
|
11
|
-
@_attrs_define
|
12
|
-
class AgentConfiguration:
|
13
|
-
"""Agent configuration, this is a key value storage. In your agent you can retrieve the value with config[key]
|
14
|
-
|
15
|
-
Attributes:
|
16
|
-
secret (Union[Unset, bool]): Agent configuration secret
|
17
|
-
value (Union[Unset, str]): Agent configuration value
|
18
|
-
"""
|
19
|
-
|
20
|
-
secret: Union[Unset, bool] = UNSET
|
21
|
-
value: Union[Unset, str] = UNSET
|
22
|
-
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
23
|
-
|
24
|
-
def to_dict(self) -> dict[str, Any]:
|
25
|
-
secret = self.secret
|
26
|
-
|
27
|
-
value = self.value
|
28
|
-
|
29
|
-
field_dict: dict[str, Any] = {}
|
30
|
-
field_dict.update(self.additional_properties)
|
31
|
-
field_dict.update({})
|
32
|
-
if secret is not UNSET:
|
33
|
-
field_dict["secret"] = secret
|
34
|
-
if value is not UNSET:
|
35
|
-
field_dict["value"] = value
|
36
|
-
|
37
|
-
return field_dict
|
38
|
-
|
39
|
-
@classmethod
|
40
|
-
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
41
|
-
if not src_dict:
|
42
|
-
return None
|
43
|
-
d = src_dict.copy()
|
44
|
-
secret = d.pop("secret", UNSET)
|
45
|
-
|
46
|
-
value = d.pop("value", UNSET)
|
47
|
-
|
48
|
-
agent_configuration = cls(
|
49
|
-
secret=secret,
|
50
|
-
value=value,
|
51
|
-
)
|
52
|
-
|
53
|
-
agent_configuration.additional_properties = d
|
54
|
-
return agent_configuration
|
55
|
-
|
56
|
-
@property
|
57
|
-
def additional_keys(self) -> list[str]:
|
58
|
-
return list(self.additional_properties.keys())
|
59
|
-
|
60
|
-
def __getitem__(self, key: str) -> Any:
|
61
|
-
return self.additional_properties[key]
|
62
|
-
|
63
|
-
def __setitem__(self, key: str, value: Any) -> None:
|
64
|
-
self.additional_properties[key] = value
|
65
|
-
|
66
|
-
def __delitem__(self, key: str) -> None:
|
67
|
-
del self.additional_properties[key]
|
68
|
-
|
69
|
-
def __contains__(self, key: str) -> bool:
|
70
|
-
return key in self.additional_properties
|