blaxel 0.64.0__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.
- blaxel/__init__.py +8 -0
- blaxel/agents/__init__.py +5 -0
- blaxel/agents/chain.py +153 -0
- blaxel/agents/chat.py +286 -0
- blaxel/agents/decorator.py +208 -0
- blaxel/agents/thread.py +24 -0
- blaxel/agents/voice/openai.py +255 -0
- blaxel/agents/voice/utils.py +25 -0
- blaxel/api/__init__.py +1 -0
- blaxel/api/agents/__init__.py +0 -0
- blaxel/api/agents/create_agent.py +155 -0
- blaxel/api/agents/delete_agent.py +146 -0
- blaxel/api/agents/get_agent.py +146 -0
- blaxel/api/agents/get_agent_logs.py +151 -0
- blaxel/api/agents/get_agent_metrics.py +150 -0
- blaxel/api/agents/get_agent_trace_ids.py +201 -0
- blaxel/api/agents/list_agent_revisions.py +155 -0
- blaxel/api/agents/list_agents.py +127 -0
- blaxel/api/agents/update_agent.py +168 -0
- blaxel/api/configurations/__init__.py +0 -0
- blaxel/api/configurations/get_configuration.py +122 -0
- blaxel/api/default/__init__.py +0 -0
- blaxel/api/default/get_trace.py +150 -0
- blaxel/api/default/get_trace_ids.py +218 -0
- blaxel/api/default/get_trace_logs.py +186 -0
- blaxel/api/default/list_mcp_hub_definitions.py +127 -0
- blaxel/api/functions/__init__.py +0 -0
- blaxel/api/functions/create_function.py +155 -0
- blaxel/api/functions/delete_function.py +146 -0
- blaxel/api/functions/get_function.py +146 -0
- blaxel/api/functions/get_function_logs.py +151 -0
- blaxel/api/functions/get_function_metrics.py +150 -0
- blaxel/api/functions/get_function_trace_ids.py +201 -0
- blaxel/api/functions/list_function_revisions.py +158 -0
- blaxel/api/functions/list_functions.py +131 -0
- blaxel/api/functions/update_function.py +168 -0
- blaxel/api/integrations/__init__.py +0 -0
- blaxel/api/integrations/create_integration_connection.py +167 -0
- blaxel/api/integrations/delete_integration_connection.py +158 -0
- blaxel/api/integrations/get_integration.py +97 -0
- blaxel/api/integrations/get_integration_connection.py +158 -0
- blaxel/api/integrations/get_integration_connection_model.py +104 -0
- blaxel/api/integrations/get_integration_connection_model_endpoint_configurations.py +97 -0
- blaxel/api/integrations/list_integration_connection_models.py +97 -0
- blaxel/api/integrations/list_integration_connections.py +139 -0
- blaxel/api/integrations/update_integration_connection.py +180 -0
- blaxel/api/invitations/__init__.py +0 -0
- blaxel/api/invitations/list_all_pending_invitations.py +142 -0
- blaxel/api/knowledgebases/__init__.py +0 -0
- blaxel/api/knowledgebases/create_knowledgebase.py +163 -0
- blaxel/api/knowledgebases/delete_knowledgebase.py +154 -0
- blaxel/api/knowledgebases/get_knowledgebase.py +154 -0
- blaxel/api/knowledgebases/list_knowledgebase_revisions.py +158 -0
- blaxel/api/knowledgebases/list_knowledgebases.py +139 -0
- blaxel/api/knowledgebases/update_knowledgebase.py +176 -0
- blaxel/api/locations/__init__.py +0 -0
- blaxel/api/locations/list_locations.py +139 -0
- blaxel/api/metrics/__init__.py +0 -0
- blaxel/api/metrics/get_metrics.py +130 -0
- blaxel/api/models/__init__.py +0 -0
- blaxel/api/models/create_model.py +163 -0
- blaxel/api/models/delete_model.py +154 -0
- blaxel/api/models/get_model.py +154 -0
- blaxel/api/models/get_model_logs.py +155 -0
- blaxel/api/models/get_model_metrics.py +158 -0
- blaxel/api/models/get_model_trace_ids.py +201 -0
- blaxel/api/models/list_model_revisions.py +158 -0
- blaxel/api/models/list_models.py +135 -0
- blaxel/api/models/update_model.py +176 -0
- blaxel/api/policies/__init__.py +0 -0
- blaxel/api/policies/create_policy.py +167 -0
- blaxel/api/policies/delete_policy.py +154 -0
- blaxel/api/policies/get_policy.py +154 -0
- blaxel/api/policies/list_policies.py +139 -0
- blaxel/api/policies/update_policy.py +180 -0
- blaxel/api/privateclusters/__init__.py +0 -0
- blaxel/api/privateclusters/create_private_cluster.py +132 -0
- blaxel/api/privateclusters/delete_private_cluster.py +156 -0
- blaxel/api/privateclusters/get_private_cluster.py +159 -0
- blaxel/api/privateclusters/get_private_cluster_health.py +97 -0
- blaxel/api/privateclusters/list_private_clusters.py +140 -0
- blaxel/api/privateclusters/update_private_cluster.py +156 -0
- blaxel/api/privateclusters/update_private_cluster_health.py +97 -0
- blaxel/api/service_accounts/__init__.py +0 -0
- blaxel/api/service_accounts/create_api_key_for_service_account.py +177 -0
- blaxel/api/service_accounts/create_workspace_service_account.py +170 -0
- blaxel/api/service_accounts/delete_api_key_for_service_account.py +104 -0
- blaxel/api/service_accounts/delete_workspace_service_account.py +160 -0
- blaxel/api/service_accounts/get_workspace_service_accounts.py +141 -0
- blaxel/api/service_accounts/list_api_keys_for_service_account.py +163 -0
- blaxel/api/service_accounts/update_workspace_service_account.py +183 -0
- blaxel/api/store/__init__.py +0 -0
- blaxel/api/store/get_store_agent.py +146 -0
- blaxel/api/store/get_store_function.py +146 -0
- blaxel/api/store/list_store_agents.py +131 -0
- blaxel/api/store/list_store_functions.py +131 -0
- blaxel/api/workspaces/__init__.py +0 -0
- blaxel/api/workspaces/accept_workspace_invitation.py +161 -0
- blaxel/api/workspaces/create_worspace.py +163 -0
- blaxel/api/workspaces/decline_workspace_invitation.py +158 -0
- blaxel/api/workspaces/delete_workspace.py +154 -0
- blaxel/api/workspaces/get_workspace.py +154 -0
- blaxel/api/workspaces/invite_workspace_user.py +174 -0
- blaxel/api/workspaces/leave_workspace.py +161 -0
- blaxel/api/workspaces/list_workspace_users.py +139 -0
- blaxel/api/workspaces/list_workspaces.py +139 -0
- blaxel/api/workspaces/remove_workspace_user.py +101 -0
- blaxel/api/workspaces/update_workspace.py +176 -0
- blaxel/api/workspaces/update_workspace_user_role.py +187 -0
- blaxel/authentication/__init__.py +45 -0
- blaxel/authentication/apikey.py +50 -0
- blaxel/authentication/authentication.py +176 -0
- blaxel/authentication/clientcredentials.py +103 -0
- blaxel/authentication/credentials.py +295 -0
- blaxel/authentication/device_mode.py +197 -0
- blaxel/client.py +281 -0
- blaxel/common/__init__.py +17 -0
- blaxel/common/error.py +27 -0
- blaxel/common/instrumentation.py +317 -0
- blaxel/common/logger.py +60 -0
- blaxel/common/secrets.py +39 -0
- blaxel/common/settings.py +150 -0
- blaxel/common/slugify.py +18 -0
- blaxel/common/utils.py +34 -0
- blaxel/deploy/__init__.py +8 -0
- blaxel/deploy/deploy.py +316 -0
- blaxel/deploy/format.py +46 -0
- blaxel/deploy/parser.py +192 -0
- blaxel/errors.py +16 -0
- blaxel/functions/__init__.py +7 -0
- blaxel/functions/common.py +228 -0
- blaxel/functions/decorator.py +64 -0
- blaxel/functions/local/local.py +48 -0
- blaxel/functions/mcp/client.py +96 -0
- blaxel/functions/mcp/mcp.py +168 -0
- blaxel/functions/mcp/utils.py +56 -0
- blaxel/functions/remote/remote.py +183 -0
- blaxel/models/__init__.py +233 -0
- blaxel/models/acl.py +133 -0
- blaxel/models/agent.py +126 -0
- blaxel/models/agent_chain.py +88 -0
- blaxel/models/agent_spec.py +346 -0
- blaxel/models/api_key.py +142 -0
- blaxel/models/configuration.py +85 -0
- blaxel/models/continent.py +70 -0
- blaxel/models/core_event.py +97 -0
- blaxel/models/core_spec.py +249 -0
- blaxel/models/core_spec_configurations.py +77 -0
- blaxel/models/country.py +70 -0
- blaxel/models/create_api_key_for_service_account_body.py +69 -0
- blaxel/models/create_workspace_service_account_body.py +71 -0
- blaxel/models/create_workspace_service_account_response_200.py +105 -0
- blaxel/models/delete_workspace_service_account_response_200.py +96 -0
- blaxel/models/entrypoint.py +96 -0
- blaxel/models/entrypoint_env.py +45 -0
- blaxel/models/flavor.py +70 -0
- blaxel/models/form.py +120 -0
- blaxel/models/form_config.py +45 -0
- blaxel/models/form_oauthomitempty.py +45 -0
- blaxel/models/form_secrets.py +45 -0
- blaxel/models/function.py +126 -0
- blaxel/models/function_kit.py +97 -0
- blaxel/models/function_spec.py +310 -0
- blaxel/models/get_trace_ids_response_200.py +45 -0
- blaxel/models/get_trace_logs_response_200.py +45 -0
- blaxel/models/get_trace_response_200.py +45 -0
- blaxel/models/get_workspace_service_accounts_response_200_item.py +96 -0
- blaxel/models/histogram_bucket.py +79 -0
- blaxel/models/histogram_stats.py +88 -0
- blaxel/models/integration_connection.py +96 -0
- blaxel/models/integration_connection_spec.py +114 -0
- blaxel/models/integration_connection_spec_config.py +45 -0
- blaxel/models/integration_connection_spec_secret.py +45 -0
- blaxel/models/integration_model.py +162 -0
- blaxel/models/integration_repository.py +88 -0
- blaxel/models/invite_workspace_user_body.py +60 -0
- blaxel/models/knowledgebase.py +126 -0
- blaxel/models/knowledgebase_spec.py +163 -0
- blaxel/models/knowledgebase_spec_options.py +45 -0
- blaxel/models/last_n_requests_metric.py +79 -0
- blaxel/models/latency_metric.py +144 -0
- blaxel/models/location_response.py +113 -0
- blaxel/models/mcp_definition.py +188 -0
- blaxel/models/mcp_definition_entrypoint.py +45 -0
- blaxel/models/mcp_definition_form.py +45 -0
- blaxel/models/metadata.py +139 -0
- blaxel/models/metadata_labels.py +45 -0
- blaxel/models/metric.py +79 -0
- blaxel/models/metrics.py +169 -0
- blaxel/models/metrics_models.py +45 -0
- blaxel/models/metrics_request_total_per_code.py +45 -0
- blaxel/models/metrics_rps_per_code.py +45 -0
- blaxel/models/model.py +126 -0
- blaxel/models/model_private_cluster.py +79 -0
- blaxel/models/model_spec.py +249 -0
- blaxel/models/o_auth.py +72 -0
- blaxel/models/owner_fields.py +70 -0
- blaxel/models/pending_invitation.py +124 -0
- blaxel/models/pending_invitation_accept.py +85 -0
- blaxel/models/pending_invitation_render.py +147 -0
- blaxel/models/pending_invitation_render_invited_by.py +88 -0
- blaxel/models/pending_invitation_render_workspace.py +70 -0
- blaxel/models/pending_invitation_workspace_details.py +72 -0
- blaxel/models/pod_template_spec.py +45 -0
- blaxel/models/policy.py +96 -0
- blaxel/models/policy_location.py +70 -0
- blaxel/models/policy_max_tokens.py +106 -0
- blaxel/models/policy_spec.py +151 -0
- blaxel/models/private_cluster.py +183 -0
- blaxel/models/private_location.py +61 -0
- blaxel/models/repository.py +70 -0
- blaxel/models/request_duration_over_time_metric.py +97 -0
- blaxel/models/request_duration_over_time_metrics.py +80 -0
- blaxel/models/request_total_by_origin_metric.py +115 -0
- blaxel/models/request_total_by_origin_metric_request_total_by_origin.py +45 -0
- blaxel/models/request_total_by_origin_metric_request_total_by_origin_and_code.py +45 -0
- blaxel/models/request_total_metric.py +123 -0
- blaxel/models/request_total_metric_request_total_per_code.py +45 -0
- blaxel/models/request_total_metric_rps_per_code.py +45 -0
- blaxel/models/resource_log.py +79 -0
- blaxel/models/resource_metrics.py +270 -0
- blaxel/models/resource_metrics_request_total_per_code.py +45 -0
- blaxel/models/resource_metrics_rps_per_code.py +45 -0
- blaxel/models/revision_configuration.py +97 -0
- blaxel/models/revision_metadata.py +124 -0
- blaxel/models/runtime.py +196 -0
- blaxel/models/runtime_startup_probe.py +45 -0
- blaxel/models/serverless_config.py +80 -0
- blaxel/models/spec_configuration.py +70 -0
- blaxel/models/store_agent.py +178 -0
- blaxel/models/store_agent_labels.py +45 -0
- blaxel/models/store_configuration.py +151 -0
- blaxel/models/store_configuration_option.py +79 -0
- blaxel/models/store_function.py +211 -0
- blaxel/models/store_function_kit.py +97 -0
- blaxel/models/store_function_labels.py +45 -0
- blaxel/models/store_function_parameter.py +88 -0
- blaxel/models/time_fields.py +70 -0
- blaxel/models/token_rate_metric.py +88 -0
- blaxel/models/token_rate_metrics.py +120 -0
- blaxel/models/token_total_metric.py +106 -0
- blaxel/models/trace_ids_response.py +45 -0
- blaxel/models/update_workspace_service_account_body.py +69 -0
- blaxel/models/update_workspace_service_account_response_200.py +96 -0
- blaxel/models/update_workspace_user_role_body.py +60 -0
- blaxel/models/websocket_channel.py +88 -0
- blaxel/models/workspace.py +148 -0
- blaxel/models/workspace_labels.py +45 -0
- blaxel/models/workspace_user.py +115 -0
- blaxel/py.typed +1 -0
- blaxel/run.py +108 -0
- blaxel/serve/app.py +131 -0
- blaxel/serve/middlewares/__init__.py +10 -0
- blaxel/serve/middlewares/accesslog.py +32 -0
- blaxel/serve/middlewares/processtime.py +28 -0
- blaxel/types.py +46 -0
- blaxel-0.64.0.dist-info/METADATA +96 -0
- blaxel-0.64.0.dist-info/RECORD +261 -0
- blaxel-0.64.0.dist-info/WHEEL +4 -0
- blaxel-0.64.0.dist-info/entry_points.txt +2 -0
- blaxel-0.64.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,158 @@
|
|
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.revision_metadata import RevisionMetadata
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
model_name: str,
|
14
|
+
) -> dict[str, Any]:
|
15
|
+
_kwargs: dict[str, Any] = {
|
16
|
+
"method": "get",
|
17
|
+
"url": f"/models/{model_name}/revisions",
|
18
|
+
}
|
19
|
+
|
20
|
+
return _kwargs
|
21
|
+
|
22
|
+
|
23
|
+
def _parse_response(
|
24
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
25
|
+
) -> Optional[RevisionMetadata]:
|
26
|
+
if response.status_code == 200:
|
27
|
+
response_200 = RevisionMetadata.from_dict(response.json())
|
28
|
+
|
29
|
+
return response_200
|
30
|
+
if client.raise_on_unexpected_status:
|
31
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
32
|
+
else:
|
33
|
+
return None
|
34
|
+
|
35
|
+
|
36
|
+
def _build_response(
|
37
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
38
|
+
) -> Response[RevisionMetadata]:
|
39
|
+
return Response(
|
40
|
+
status_code=HTTPStatus(response.status_code),
|
41
|
+
content=response.content,
|
42
|
+
headers=response.headers,
|
43
|
+
parsed=_parse_response(client=client, response=response),
|
44
|
+
)
|
45
|
+
|
46
|
+
|
47
|
+
def sync_detailed(
|
48
|
+
model_name: str,
|
49
|
+
*,
|
50
|
+
client: AuthenticatedClient,
|
51
|
+
) -> Response[RevisionMetadata]:
|
52
|
+
"""List model revisions
|
53
|
+
|
54
|
+
Returns revisions for a model by name.
|
55
|
+
|
56
|
+
Args:
|
57
|
+
model_name (str):
|
58
|
+
|
59
|
+
Raises:
|
60
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
61
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
62
|
+
|
63
|
+
Returns:
|
64
|
+
Response[RevisionMetadata]
|
65
|
+
"""
|
66
|
+
|
67
|
+
kwargs = _get_kwargs(
|
68
|
+
model_name=model_name,
|
69
|
+
)
|
70
|
+
|
71
|
+
response = client.get_httpx_client().request(
|
72
|
+
**kwargs,
|
73
|
+
)
|
74
|
+
|
75
|
+
return _build_response(client=client, response=response)
|
76
|
+
|
77
|
+
|
78
|
+
def sync(
|
79
|
+
model_name: str,
|
80
|
+
*,
|
81
|
+
client: AuthenticatedClient,
|
82
|
+
) -> Optional[RevisionMetadata]:
|
83
|
+
"""List model revisions
|
84
|
+
|
85
|
+
Returns revisions for a model by name.
|
86
|
+
|
87
|
+
Args:
|
88
|
+
model_name (str):
|
89
|
+
|
90
|
+
Raises:
|
91
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
92
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
93
|
+
|
94
|
+
Returns:
|
95
|
+
RevisionMetadata
|
96
|
+
"""
|
97
|
+
|
98
|
+
return sync_detailed(
|
99
|
+
model_name=model_name,
|
100
|
+
client=client,
|
101
|
+
).parsed
|
102
|
+
|
103
|
+
|
104
|
+
async def asyncio_detailed(
|
105
|
+
model_name: str,
|
106
|
+
*,
|
107
|
+
client: AuthenticatedClient,
|
108
|
+
) -> Response[RevisionMetadata]:
|
109
|
+
"""List model revisions
|
110
|
+
|
111
|
+
Returns revisions for a model by name.
|
112
|
+
|
113
|
+
Args:
|
114
|
+
model_name (str):
|
115
|
+
|
116
|
+
Raises:
|
117
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
118
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
119
|
+
|
120
|
+
Returns:
|
121
|
+
Response[RevisionMetadata]
|
122
|
+
"""
|
123
|
+
|
124
|
+
kwargs = _get_kwargs(
|
125
|
+
model_name=model_name,
|
126
|
+
)
|
127
|
+
|
128
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
129
|
+
|
130
|
+
return _build_response(client=client, response=response)
|
131
|
+
|
132
|
+
|
133
|
+
async def asyncio(
|
134
|
+
model_name: str,
|
135
|
+
*,
|
136
|
+
client: AuthenticatedClient,
|
137
|
+
) -> Optional[RevisionMetadata]:
|
138
|
+
"""List model revisions
|
139
|
+
|
140
|
+
Returns revisions for a model by name.
|
141
|
+
|
142
|
+
Args:
|
143
|
+
model_name (str):
|
144
|
+
|
145
|
+
Raises:
|
146
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
147
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
148
|
+
|
149
|
+
Returns:
|
150
|
+
RevisionMetadata
|
151
|
+
"""
|
152
|
+
|
153
|
+
return (
|
154
|
+
await asyncio_detailed(
|
155
|
+
model_name=model_name,
|
156
|
+
client=client,
|
157
|
+
)
|
158
|
+
).parsed
|
@@ -0,0 +1,135 @@
|
|
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 import Model
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs() -> dict[str, Any]:
|
13
|
+
_kwargs: dict[str, Any] = {
|
14
|
+
"method": "get",
|
15
|
+
"url": "/models",
|
16
|
+
}
|
17
|
+
|
18
|
+
return _kwargs
|
19
|
+
|
20
|
+
|
21
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[list["Model"]]:
|
22
|
+
if response.status_code == 200:
|
23
|
+
response_200 = []
|
24
|
+
_response_200 = response.json()
|
25
|
+
for response_200_item_data in _response_200:
|
26
|
+
response_200_item = Model.from_dict(response_200_item_data)
|
27
|
+
|
28
|
+
response_200.append(response_200_item)
|
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(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[list["Model"]]:
|
38
|
+
return Response(
|
39
|
+
status_code=HTTPStatus(response.status_code),
|
40
|
+
content=response.content,
|
41
|
+
headers=response.headers,
|
42
|
+
parsed=_parse_response(client=client, response=response),
|
43
|
+
)
|
44
|
+
|
45
|
+
|
46
|
+
def sync_detailed(
|
47
|
+
*,
|
48
|
+
client: AuthenticatedClient,
|
49
|
+
) -> Response[list["Model"]]:
|
50
|
+
"""List models
|
51
|
+
|
52
|
+
Returns a list of all models in the workspace.
|
53
|
+
|
54
|
+
Raises:
|
55
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
56
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
57
|
+
|
58
|
+
Returns:
|
59
|
+
Response[list['Model']]
|
60
|
+
"""
|
61
|
+
|
62
|
+
kwargs = _get_kwargs()
|
63
|
+
|
64
|
+
response = client.get_httpx_client().request(
|
65
|
+
**kwargs,
|
66
|
+
)
|
67
|
+
|
68
|
+
return _build_response(client=client, response=response)
|
69
|
+
|
70
|
+
|
71
|
+
def sync(
|
72
|
+
*,
|
73
|
+
client: AuthenticatedClient,
|
74
|
+
) -> Optional[list["Model"]]:
|
75
|
+
"""List models
|
76
|
+
|
77
|
+
Returns a list of all models in the workspace.
|
78
|
+
|
79
|
+
Raises:
|
80
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
81
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
82
|
+
|
83
|
+
Returns:
|
84
|
+
list['Model']
|
85
|
+
"""
|
86
|
+
|
87
|
+
return sync_detailed(
|
88
|
+
client=client,
|
89
|
+
).parsed
|
90
|
+
|
91
|
+
|
92
|
+
async def asyncio_detailed(
|
93
|
+
*,
|
94
|
+
client: AuthenticatedClient,
|
95
|
+
) -> Response[list["Model"]]:
|
96
|
+
"""List models
|
97
|
+
|
98
|
+
Returns a list of all models in the workspace.
|
99
|
+
|
100
|
+
Raises:
|
101
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
102
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
103
|
+
|
104
|
+
Returns:
|
105
|
+
Response[list['Model']]
|
106
|
+
"""
|
107
|
+
|
108
|
+
kwargs = _get_kwargs()
|
109
|
+
|
110
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
111
|
+
|
112
|
+
return _build_response(client=client, response=response)
|
113
|
+
|
114
|
+
|
115
|
+
async def asyncio(
|
116
|
+
*,
|
117
|
+
client: AuthenticatedClient,
|
118
|
+
) -> Optional[list["Model"]]:
|
119
|
+
"""List models
|
120
|
+
|
121
|
+
Returns a list of all models in the workspace.
|
122
|
+
|
123
|
+
Raises:
|
124
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
125
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
126
|
+
|
127
|
+
Returns:
|
128
|
+
list['Model']
|
129
|
+
"""
|
130
|
+
|
131
|
+
return (
|
132
|
+
await asyncio_detailed(
|
133
|
+
client=client,
|
134
|
+
)
|
135
|
+
).parsed
|
@@ -0,0 +1,176 @@
|
|
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 import Model
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
model_name: str,
|
14
|
+
*,
|
15
|
+
body: Model,
|
16
|
+
) -> dict[str, Any]:
|
17
|
+
headers: dict[str, Any] = {}
|
18
|
+
|
19
|
+
_kwargs: dict[str, Any] = {
|
20
|
+
"method": "put",
|
21
|
+
"url": f"/models/{model_name}",
|
22
|
+
}
|
23
|
+
|
24
|
+
_body = body.to_dict()
|
25
|
+
|
26
|
+
_kwargs["json"] = _body
|
27
|
+
headers["Content-Type"] = "application/json"
|
28
|
+
|
29
|
+
_kwargs["headers"] = headers
|
30
|
+
return _kwargs
|
31
|
+
|
32
|
+
|
33
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Model]:
|
34
|
+
if response.status_code == 200:
|
35
|
+
response_200 = Model.from_dict(response.json())
|
36
|
+
|
37
|
+
return response_200
|
38
|
+
if client.raise_on_unexpected_status:
|
39
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
40
|
+
else:
|
41
|
+
return None
|
42
|
+
|
43
|
+
|
44
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Model]:
|
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
|
+
*,
|
56
|
+
client: AuthenticatedClient,
|
57
|
+
body: Model,
|
58
|
+
) -> Response[Model]:
|
59
|
+
"""Create or update model
|
60
|
+
|
61
|
+
Update a model by name.
|
62
|
+
|
63
|
+
Args:
|
64
|
+
model_name (str):
|
65
|
+
body (Model): Logical object representing a model
|
66
|
+
|
67
|
+
Raises:
|
68
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
69
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
70
|
+
|
71
|
+
Returns:
|
72
|
+
Response[Model]
|
73
|
+
"""
|
74
|
+
|
75
|
+
kwargs = _get_kwargs(
|
76
|
+
model_name=model_name,
|
77
|
+
body=body,
|
78
|
+
)
|
79
|
+
|
80
|
+
response = client.get_httpx_client().request(
|
81
|
+
**kwargs,
|
82
|
+
)
|
83
|
+
|
84
|
+
return _build_response(client=client, response=response)
|
85
|
+
|
86
|
+
|
87
|
+
def sync(
|
88
|
+
model_name: str,
|
89
|
+
*,
|
90
|
+
client: AuthenticatedClient,
|
91
|
+
body: Model,
|
92
|
+
) -> Optional[Model]:
|
93
|
+
"""Create or update model
|
94
|
+
|
95
|
+
Update a model by name.
|
96
|
+
|
97
|
+
Args:
|
98
|
+
model_name (str):
|
99
|
+
body (Model): Logical object representing a model
|
100
|
+
|
101
|
+
Raises:
|
102
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
103
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
104
|
+
|
105
|
+
Returns:
|
106
|
+
Model
|
107
|
+
"""
|
108
|
+
|
109
|
+
return sync_detailed(
|
110
|
+
model_name=model_name,
|
111
|
+
client=client,
|
112
|
+
body=body,
|
113
|
+
).parsed
|
114
|
+
|
115
|
+
|
116
|
+
async def asyncio_detailed(
|
117
|
+
model_name: str,
|
118
|
+
*,
|
119
|
+
client: AuthenticatedClient,
|
120
|
+
body: Model,
|
121
|
+
) -> Response[Model]:
|
122
|
+
"""Create or update model
|
123
|
+
|
124
|
+
Update a model by name.
|
125
|
+
|
126
|
+
Args:
|
127
|
+
model_name (str):
|
128
|
+
body (Model): Logical object representing a model
|
129
|
+
|
130
|
+
Raises:
|
131
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
132
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
133
|
+
|
134
|
+
Returns:
|
135
|
+
Response[Model]
|
136
|
+
"""
|
137
|
+
|
138
|
+
kwargs = _get_kwargs(
|
139
|
+
model_name=model_name,
|
140
|
+
body=body,
|
141
|
+
)
|
142
|
+
|
143
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
144
|
+
|
145
|
+
return _build_response(client=client, response=response)
|
146
|
+
|
147
|
+
|
148
|
+
async def asyncio(
|
149
|
+
model_name: str,
|
150
|
+
*,
|
151
|
+
client: AuthenticatedClient,
|
152
|
+
body: Model,
|
153
|
+
) -> Optional[Model]:
|
154
|
+
"""Create or update model
|
155
|
+
|
156
|
+
Update a model by name.
|
157
|
+
|
158
|
+
Args:
|
159
|
+
model_name (str):
|
160
|
+
body (Model): Logical object representing a model
|
161
|
+
|
162
|
+
Raises:
|
163
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
164
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
165
|
+
|
166
|
+
Returns:
|
167
|
+
Model
|
168
|
+
"""
|
169
|
+
|
170
|
+
return (
|
171
|
+
await asyncio_detailed(
|
172
|
+
model_name=model_name,
|
173
|
+
client=client,
|
174
|
+
body=body,
|
175
|
+
)
|
176
|
+
).parsed
|
File without changes
|
@@ -0,0 +1,167 @@
|
|
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.policy import Policy
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
*,
|
14
|
+
body: Policy,
|
15
|
+
) -> dict[str, Any]:
|
16
|
+
headers: dict[str, Any] = {}
|
17
|
+
|
18
|
+
_kwargs: dict[str, Any] = {
|
19
|
+
"method": "post",
|
20
|
+
"url": "/policies",
|
21
|
+
}
|
22
|
+
|
23
|
+
_body = body.to_dict()
|
24
|
+
|
25
|
+
_kwargs["json"] = _body
|
26
|
+
headers["Content-Type"] = "application/json"
|
27
|
+
|
28
|
+
_kwargs["headers"] = headers
|
29
|
+
return _kwargs
|
30
|
+
|
31
|
+
|
32
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Policy]:
|
33
|
+
if response.status_code == 200:
|
34
|
+
response_200 = Policy.from_dict(response.json())
|
35
|
+
|
36
|
+
return response_200
|
37
|
+
if client.raise_on_unexpected_status:
|
38
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
39
|
+
else:
|
40
|
+
return None
|
41
|
+
|
42
|
+
|
43
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Policy]:
|
44
|
+
return Response(
|
45
|
+
status_code=HTTPStatus(response.status_code),
|
46
|
+
content=response.content,
|
47
|
+
headers=response.headers,
|
48
|
+
parsed=_parse_response(client=client, response=response),
|
49
|
+
)
|
50
|
+
|
51
|
+
|
52
|
+
def sync_detailed(
|
53
|
+
*,
|
54
|
+
client: AuthenticatedClient,
|
55
|
+
body: Policy,
|
56
|
+
) -> Response[Policy]:
|
57
|
+
"""Create policy
|
58
|
+
|
59
|
+
Creates a policy.
|
60
|
+
|
61
|
+
Args:
|
62
|
+
body (Policy): Rule that controls how a deployment is made and served (e.g. location
|
63
|
+
restrictions)
|
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[Policy]
|
71
|
+
"""
|
72
|
+
|
73
|
+
kwargs = _get_kwargs(
|
74
|
+
body=body,
|
75
|
+
)
|
76
|
+
|
77
|
+
response = client.get_httpx_client().request(
|
78
|
+
**kwargs,
|
79
|
+
)
|
80
|
+
|
81
|
+
return _build_response(client=client, response=response)
|
82
|
+
|
83
|
+
|
84
|
+
def sync(
|
85
|
+
*,
|
86
|
+
client: AuthenticatedClient,
|
87
|
+
body: Policy,
|
88
|
+
) -> Optional[Policy]:
|
89
|
+
"""Create policy
|
90
|
+
|
91
|
+
Creates a policy.
|
92
|
+
|
93
|
+
Args:
|
94
|
+
body (Policy): Rule that controls how a deployment is made and served (e.g. location
|
95
|
+
restrictions)
|
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
|
+
Policy
|
103
|
+
"""
|
104
|
+
|
105
|
+
return sync_detailed(
|
106
|
+
client=client,
|
107
|
+
body=body,
|
108
|
+
).parsed
|
109
|
+
|
110
|
+
|
111
|
+
async def asyncio_detailed(
|
112
|
+
*,
|
113
|
+
client: AuthenticatedClient,
|
114
|
+
body: Policy,
|
115
|
+
) -> Response[Policy]:
|
116
|
+
"""Create policy
|
117
|
+
|
118
|
+
Creates a policy.
|
119
|
+
|
120
|
+
Args:
|
121
|
+
body (Policy): Rule that controls how a deployment is made and served (e.g. location
|
122
|
+
restrictions)
|
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[Policy]
|
130
|
+
"""
|
131
|
+
|
132
|
+
kwargs = _get_kwargs(
|
133
|
+
body=body,
|
134
|
+
)
|
135
|
+
|
136
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
137
|
+
|
138
|
+
return _build_response(client=client, response=response)
|
139
|
+
|
140
|
+
|
141
|
+
async def asyncio(
|
142
|
+
*,
|
143
|
+
client: AuthenticatedClient,
|
144
|
+
body: Policy,
|
145
|
+
) -> Optional[Policy]:
|
146
|
+
"""Create policy
|
147
|
+
|
148
|
+
Creates a policy.
|
149
|
+
|
150
|
+
Args:
|
151
|
+
body (Policy): Rule that controls how a deployment is made and served (e.g. location
|
152
|
+
restrictions)
|
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
|
+
Policy
|
160
|
+
"""
|
161
|
+
|
162
|
+
return (
|
163
|
+
await asyncio_detailed(
|
164
|
+
client=client,
|
165
|
+
body=body,
|
166
|
+
)
|
167
|
+
).parsed
|