beamlit 0.0.20rc2__py3-none-any.whl → 0.0.20rc4__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- beamlit/api/agents/delete_agent_history.py +155 -0
- beamlit/api/agents/get_agent_deployment.py +1 -22
- beamlit/api/agents/get_agent_environment_logs.py +151 -0
- beamlit/api/agents/get_agent_history.py +155 -0
- beamlit/api/agents/list_agent_history.py +151 -0
- beamlit/api/agents/put_agent_history.py +181 -0
- beamlit/api/functions/get_function_environment_logs.py +151 -0
- beamlit/api/models/get_model_environment_logs.py +155 -0
- beamlit/common/generate.py +8 -3
- beamlit/common/settings.py +1 -6
- beamlit/models/__init__.py +28 -30
- beamlit/models/acl.py +2 -0
- beamlit/models/agent.py +2 -0
- beamlit/models/agent_chain.py +2 -0
- beamlit/models/agent_configuration.py +2 -0
- beamlit/models/agent_deployment.py +44 -99
- beamlit/models/agent_deployment_configuration.py +45 -0
- beamlit/models/agent_deployment_history.py +15 -46
- beamlit/models/agent_deployment_history_event.py +24 -78
- beamlit/models/agent_deployment_pod_template.py +45 -0
- beamlit/models/agent_history.py +165 -0
- beamlit/models/agent_history_event.py +131 -0
- beamlit/models/agent_metadata.py +144 -0
- beamlit/models/agent_release.py +2 -0
- beamlit/models/agent_spec.py +238 -0
- beamlit/models/agent_with_deployments.py +2 -0
- beamlit/models/api_key.py +2 -0
- beamlit/models/authentication_provider_model.py +2 -0
- beamlit/models/authentication_provider_organization.py +2 -0
- beamlit/models/configuration.py +2 -0
- beamlit/models/continent.py +2 -0
- beamlit/models/core_spec.py +179 -0
- beamlit/models/country.py +2 -0
- beamlit/models/create_api_key_for_service_account_body.py +2 -0
- beamlit/models/create_workspace_service_account_body.py +2 -0
- beamlit/models/create_workspace_service_account_response_200.py +2 -0
- beamlit/models/delete_workspace_service_account_response_200.py +2 -0
- beamlit/models/deployment_configuration.py +2 -0
- beamlit/models/deployment_configurations.py +2 -0
- beamlit/models/deployment_serverless_config.py +131 -0
- beamlit/models/environment.py +2 -0
- beamlit/models/environment_metrics.py +2 -0
- beamlit/models/environment_spec.py +61 -0
- beamlit/models/flavor.py +2 -0
- beamlit/models/function.py +2 -0
- beamlit/models/function_configuration.py +2 -0
- beamlit/models/function_deployment.py +44 -99
- beamlit/models/function_deployment_configuration.py +45 -0
- beamlit/models/function_deployment_pod_template.py +45 -0
- beamlit/models/function_kit.py +2 -0
- beamlit/models/function_metadata.py +144 -0
- beamlit/models/function_provider_ref.py +2 -0
- beamlit/models/function_release.py +2 -0
- beamlit/models/function_spec.py +240 -0
- beamlit/models/function_with_deployments.py +2 -0
- beamlit/models/get_workspace_service_accounts_response_200_item.py +2 -0
- beamlit/models/increase_and_rate_metric.py +2 -0
- beamlit/models/integration.py +2 -0
- beamlit/models/integration_config.py +2 -0
- beamlit/models/integration_connection.py +2 -0
- beamlit/models/integration_connection_config.py +2 -0
- beamlit/models/integration_connection_secret.py +2 -0
- beamlit/models/integration_connection_spec.py +99 -0
- beamlit/models/integration_model.py +2 -0
- beamlit/models/integration_secret.py +2 -0
- beamlit/models/invite_workspace_user_body.py +2 -0
- beamlit/models/labels_type_0.py +2 -0
- beamlit/models/location.py +2 -0
- beamlit/models/location_response.py +2 -0
- beamlit/models/metadata.py +135 -0
- beamlit/models/metadata_labels.py +43 -0
- beamlit/models/metric.py +2 -0
- beamlit/models/metrics.py +2 -0
- beamlit/models/model.py +2 -0
- beamlit/models/model_deployment.py +66 -85
- beamlit/models/model_deployment_log.py +2 -0
- beamlit/models/model_deployment_metrics.py +2 -0
- beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +2 -0
- beamlit/models/model_deployment_metrics_query_per_second_per_region_per_code.py +2 -0
- beamlit/models/model_deployment_pod_template.py +45 -0
- beamlit/models/model_metadata.py +144 -0
- beamlit/models/model_metrics.py +2 -0
- beamlit/models/model_provider.py +2 -0
- beamlit/models/model_provider_ref.py +2 -0
- beamlit/models/model_release.py +2 -0
- beamlit/models/model_spec.py +188 -0
- beamlit/models/model_with_deployments.py +2 -0
- beamlit/models/owner_fields.py +68 -0
- beamlit/models/pending_invitation.py +2 -0
- beamlit/models/pending_invitation_accept.py +2 -0
- beamlit/models/pending_invitation_render.py +2 -0
- beamlit/models/pending_invitation_render_invited_by.py +2 -0
- beamlit/models/pending_invitation_render_workspace.py +2 -0
- beamlit/models/pending_invitation_workspace_details.py +2 -0
- beamlit/models/pod_template_spec.py +43 -0
- beamlit/models/policy.py +36 -8
- beamlit/models/policy_location.py +2 -0
- beamlit/models/policy_spec.py +119 -0
- beamlit/models/provider_config.py +2 -0
- beamlit/models/qps.py +2 -0
- beamlit/models/resource_deployment_log.py +2 -0
- beamlit/models/resource_deployment_metrics.py +70 -155
- beamlit/models/resource_deployment_metrics_inference_per_region.py +77 -0
- beamlit/models/resource_deployment_metrics_inference_per_second_per_region.py +77 -0
- beamlit/models/resource_deployment_metrics_query_per_region_per_code.py +75 -0
- beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +75 -0
- beamlit/models/resource_environment_metrics.py +172 -0
- beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +75 -0
- beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +73 -0
- beamlit/models/resource_log.py +68 -0
- beamlit/models/resource_metrics.py +2 -0
- beamlit/models/runtime.py +14 -29
- beamlit/models/runtime_readiness_probe.py +45 -0
- beamlit/models/runtime_resources.py +2 -0
- beamlit/models/runtime_type_0.py +111 -0
- beamlit/models/runtime_type_0_readiness_probe.py +43 -0
- beamlit/models/runtime_type_0_readiness_probe_type_0.py +43 -0
- beamlit/models/runtime_type_0_resources.py +59 -0
- beamlit/models/serverless_config.py +2 -0
- beamlit/models/spec_configuration.py +68 -0
- beamlit/models/standard_fields_dynamo_db.py +2 -0
- beamlit/models/store_agent.py +15 -29
- beamlit/models/store_agent_configuration.py +2 -0
- beamlit/models/store_agent_labels.py +45 -0
- beamlit/models/store_configuration.py +6 -15
- beamlit/models/store_configuration_option.py +7 -18
- beamlit/models/store_function.py +15 -29
- beamlit/models/store_function_configuration.py +2 -0
- beamlit/models/store_function_kit.py +2 -0
- beamlit/models/store_function_labels.py +45 -0
- beamlit/models/store_function_parameter.py +2 -0
- beamlit/models/time_fields.py +68 -0
- beamlit/models/update_workspace_service_account_body.py +2 -0
- beamlit/models/update_workspace_service_account_response_200.py +2 -0
- beamlit/models/update_workspace_user_role_body.py +2 -0
- beamlit/models/websocket_channel.py +86 -0
- beamlit/models/workspace.py +2 -0
- beamlit/models/workspace_labels.py +2 -0
- beamlit/models/workspace_user.py +2 -0
- {beamlit-0.0.20rc2.dist-info → beamlit-0.0.20rc4.dist-info}/METADATA +1 -1
- {beamlit-0.0.20rc2.dist-info → beamlit-0.0.20rc4.dist-info}/RECORD +142 -95
- {beamlit-0.0.20rc2.dist-info → beamlit-0.0.20rc4.dist-info}/WHEEL +0 -0
@@ -0,0 +1,151 @@
|
|
1
|
+
from http import HTTPStatus
|
2
|
+
from typing import Any, List, Optional, Union
|
3
|
+
|
4
|
+
import httpx
|
5
|
+
|
6
|
+
from ... import errors
|
7
|
+
from ...client import AuthenticatedClient, Client
|
8
|
+
from ...models.agent_history import AgentHistory
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
agent_name: str,
|
14
|
+
) -> dict[str, Any]:
|
15
|
+
_kwargs: dict[str, Any] = {
|
16
|
+
"method": "get",
|
17
|
+
"url": f"/agents/{agent_name}/history",
|
18
|
+
}
|
19
|
+
|
20
|
+
return _kwargs
|
21
|
+
|
22
|
+
|
23
|
+
def _parse_response(
|
24
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
25
|
+
) -> Optional[List["AgentHistory"]]:
|
26
|
+
if response.status_code == 200:
|
27
|
+
response_200 = []
|
28
|
+
_response_200 = response.json()
|
29
|
+
for response_200_item_data in _response_200:
|
30
|
+
response_200_item = AgentHistory.from_dict(response_200_item_data)
|
31
|
+
|
32
|
+
response_200.append(response_200_item)
|
33
|
+
|
34
|
+
return response_200
|
35
|
+
if client.raise_on_unexpected_status:
|
36
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
37
|
+
else:
|
38
|
+
return None
|
39
|
+
|
40
|
+
|
41
|
+
def _build_response(
|
42
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
43
|
+
) -> Response[List["AgentHistory"]]:
|
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
|
+
agent_name: str,
|
54
|
+
*,
|
55
|
+
client: AuthenticatedClient,
|
56
|
+
) -> Response[List["AgentHistory"]]:
|
57
|
+
"""
|
58
|
+
Args:
|
59
|
+
agent_name (str):
|
60
|
+
|
61
|
+
Raises:
|
62
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
63
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
64
|
+
|
65
|
+
Returns:
|
66
|
+
Response[List['AgentHistory']]
|
67
|
+
"""
|
68
|
+
|
69
|
+
kwargs = _get_kwargs(
|
70
|
+
agent_name=agent_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
|
+
agent_name: str,
|
82
|
+
*,
|
83
|
+
client: AuthenticatedClient,
|
84
|
+
) -> Optional[List["AgentHistory"]]:
|
85
|
+
"""
|
86
|
+
Args:
|
87
|
+
agent_name (str):
|
88
|
+
|
89
|
+
Raises:
|
90
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
91
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
92
|
+
|
93
|
+
Returns:
|
94
|
+
List['AgentHistory']
|
95
|
+
"""
|
96
|
+
|
97
|
+
return sync_detailed(
|
98
|
+
agent_name=agent_name,
|
99
|
+
client=client,
|
100
|
+
).parsed
|
101
|
+
|
102
|
+
|
103
|
+
async def asyncio_detailed(
|
104
|
+
agent_name: str,
|
105
|
+
*,
|
106
|
+
client: AuthenticatedClient,
|
107
|
+
) -> Response[List["AgentHistory"]]:
|
108
|
+
"""
|
109
|
+
Args:
|
110
|
+
agent_name (str):
|
111
|
+
|
112
|
+
Raises:
|
113
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
114
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
115
|
+
|
116
|
+
Returns:
|
117
|
+
Response[List['AgentHistory']]
|
118
|
+
"""
|
119
|
+
|
120
|
+
kwargs = _get_kwargs(
|
121
|
+
agent_name=agent_name,
|
122
|
+
)
|
123
|
+
|
124
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
125
|
+
|
126
|
+
return _build_response(client=client, response=response)
|
127
|
+
|
128
|
+
|
129
|
+
async def asyncio(
|
130
|
+
agent_name: str,
|
131
|
+
*,
|
132
|
+
client: AuthenticatedClient,
|
133
|
+
) -> Optional[List["AgentHistory"]]:
|
134
|
+
"""
|
135
|
+
Args:
|
136
|
+
agent_name (str):
|
137
|
+
|
138
|
+
Raises:
|
139
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
140
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
141
|
+
|
142
|
+
Returns:
|
143
|
+
List['AgentHistory']
|
144
|
+
"""
|
145
|
+
|
146
|
+
return (
|
147
|
+
await asyncio_detailed(
|
148
|
+
agent_name=agent_name,
|
149
|
+
client=client,
|
150
|
+
)
|
151
|
+
).parsed
|
@@ -0,0 +1,181 @@
|
|
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.agent_history import AgentHistory
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
agent_name: str,
|
14
|
+
request_id: str,
|
15
|
+
*,
|
16
|
+
body: AgentHistory,
|
17
|
+
) -> dict[str, Any]:
|
18
|
+
headers: dict[str, Any] = {}
|
19
|
+
|
20
|
+
_kwargs: dict[str, Any] = {
|
21
|
+
"method": "put",
|
22
|
+
"url": f"/agents/{agent_name}/history/{request_id}",
|
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(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AgentHistory]:
|
35
|
+
if response.status_code == 200:
|
36
|
+
response_200 = AgentHistory.from_dict(response.json())
|
37
|
+
|
38
|
+
return response_200
|
39
|
+
if client.raise_on_unexpected_status:
|
40
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
41
|
+
else:
|
42
|
+
return None
|
43
|
+
|
44
|
+
|
45
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AgentHistory]:
|
46
|
+
return Response(
|
47
|
+
status_code=HTTPStatus(response.status_code),
|
48
|
+
content=response.content,
|
49
|
+
headers=response.headers,
|
50
|
+
parsed=_parse_response(client=client, response=response),
|
51
|
+
)
|
52
|
+
|
53
|
+
|
54
|
+
def sync_detailed(
|
55
|
+
agent_name: str,
|
56
|
+
request_id: str,
|
57
|
+
*,
|
58
|
+
client: AuthenticatedClient,
|
59
|
+
body: AgentHistory,
|
60
|
+
) -> Response[AgentHistory]:
|
61
|
+
"""Update agent's history by request ID
|
62
|
+
|
63
|
+
Args:
|
64
|
+
agent_name (str):
|
65
|
+
request_id (str):
|
66
|
+
body (AgentHistory): Agent deployment history
|
67
|
+
|
68
|
+
Raises:
|
69
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
70
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
71
|
+
|
72
|
+
Returns:
|
73
|
+
Response[AgentHistory]
|
74
|
+
"""
|
75
|
+
|
76
|
+
kwargs = _get_kwargs(
|
77
|
+
agent_name=agent_name,
|
78
|
+
request_id=request_id,
|
79
|
+
body=body,
|
80
|
+
)
|
81
|
+
|
82
|
+
response = client.get_httpx_client().request(
|
83
|
+
**kwargs,
|
84
|
+
)
|
85
|
+
|
86
|
+
return _build_response(client=client, response=response)
|
87
|
+
|
88
|
+
|
89
|
+
def sync(
|
90
|
+
agent_name: str,
|
91
|
+
request_id: str,
|
92
|
+
*,
|
93
|
+
client: AuthenticatedClient,
|
94
|
+
body: AgentHistory,
|
95
|
+
) -> Optional[AgentHistory]:
|
96
|
+
"""Update agent's history by request ID
|
97
|
+
|
98
|
+
Args:
|
99
|
+
agent_name (str):
|
100
|
+
request_id (str):
|
101
|
+
body (AgentHistory): Agent deployment history
|
102
|
+
|
103
|
+
Raises:
|
104
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
105
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
106
|
+
|
107
|
+
Returns:
|
108
|
+
AgentHistory
|
109
|
+
"""
|
110
|
+
|
111
|
+
return sync_detailed(
|
112
|
+
agent_name=agent_name,
|
113
|
+
request_id=request_id,
|
114
|
+
client=client,
|
115
|
+
body=body,
|
116
|
+
).parsed
|
117
|
+
|
118
|
+
|
119
|
+
async def asyncio_detailed(
|
120
|
+
agent_name: str,
|
121
|
+
request_id: str,
|
122
|
+
*,
|
123
|
+
client: AuthenticatedClient,
|
124
|
+
body: AgentHistory,
|
125
|
+
) -> Response[AgentHistory]:
|
126
|
+
"""Update agent's history by request ID
|
127
|
+
|
128
|
+
Args:
|
129
|
+
agent_name (str):
|
130
|
+
request_id (str):
|
131
|
+
body (AgentHistory): Agent deployment history
|
132
|
+
|
133
|
+
Raises:
|
134
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
135
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
136
|
+
|
137
|
+
Returns:
|
138
|
+
Response[AgentHistory]
|
139
|
+
"""
|
140
|
+
|
141
|
+
kwargs = _get_kwargs(
|
142
|
+
agent_name=agent_name,
|
143
|
+
request_id=request_id,
|
144
|
+
body=body,
|
145
|
+
)
|
146
|
+
|
147
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
148
|
+
|
149
|
+
return _build_response(client=client, response=response)
|
150
|
+
|
151
|
+
|
152
|
+
async def asyncio(
|
153
|
+
agent_name: str,
|
154
|
+
request_id: str,
|
155
|
+
*,
|
156
|
+
client: AuthenticatedClient,
|
157
|
+
body: AgentHistory,
|
158
|
+
) -> Optional[AgentHistory]:
|
159
|
+
"""Update agent's history by request ID
|
160
|
+
|
161
|
+
Args:
|
162
|
+
agent_name (str):
|
163
|
+
request_id (str):
|
164
|
+
body (AgentHistory): Agent deployment history
|
165
|
+
|
166
|
+
Raises:
|
167
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
168
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
169
|
+
|
170
|
+
Returns:
|
171
|
+
AgentHistory
|
172
|
+
"""
|
173
|
+
|
174
|
+
return (
|
175
|
+
await asyncio_detailed(
|
176
|
+
agent_name=agent_name,
|
177
|
+
request_id=request_id,
|
178
|
+
client=client,
|
179
|
+
body=body,
|
180
|
+
)
|
181
|
+
).parsed
|
@@ -0,0 +1,151 @@
|
|
1
|
+
from http import HTTPStatus
|
2
|
+
from typing import Any, List, Optional, Union
|
3
|
+
|
4
|
+
import httpx
|
5
|
+
|
6
|
+
from ... import errors
|
7
|
+
from ...client import AuthenticatedClient, Client
|
8
|
+
from ...models.resource_log import ResourceLog
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
function_name: str,
|
14
|
+
) -> dict[str, Any]:
|
15
|
+
_kwargs: dict[str, Any] = {
|
16
|
+
"method": "get",
|
17
|
+
"url": f"/functions/{function_name}/logs",
|
18
|
+
}
|
19
|
+
|
20
|
+
return _kwargs
|
21
|
+
|
22
|
+
|
23
|
+
def _parse_response(
|
24
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
25
|
+
) -> Optional[List["ResourceLog"]]:
|
26
|
+
if response.status_code == 200:
|
27
|
+
response_200 = []
|
28
|
+
_response_200 = response.json()
|
29
|
+
for response_200_item_data in _response_200:
|
30
|
+
response_200_item = ResourceLog.from_dict(response_200_item_data)
|
31
|
+
|
32
|
+
response_200.append(response_200_item)
|
33
|
+
|
34
|
+
return response_200
|
35
|
+
if client.raise_on_unexpected_status:
|
36
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
37
|
+
else:
|
38
|
+
return None
|
39
|
+
|
40
|
+
|
41
|
+
def _build_response(
|
42
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
43
|
+
) -> Response[List["ResourceLog"]]:
|
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
|
+
function_name: str,
|
54
|
+
*,
|
55
|
+
client: AuthenticatedClient,
|
56
|
+
) -> Response[List["ResourceLog"]]:
|
57
|
+
"""
|
58
|
+
Args:
|
59
|
+
function_name (str):
|
60
|
+
|
61
|
+
Raises:
|
62
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
63
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
64
|
+
|
65
|
+
Returns:
|
66
|
+
Response[List['ResourceLog']]
|
67
|
+
"""
|
68
|
+
|
69
|
+
kwargs = _get_kwargs(
|
70
|
+
function_name=function_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
|
+
function_name: str,
|
82
|
+
*,
|
83
|
+
client: AuthenticatedClient,
|
84
|
+
) -> Optional[List["ResourceLog"]]:
|
85
|
+
"""
|
86
|
+
Args:
|
87
|
+
function_name (str):
|
88
|
+
|
89
|
+
Raises:
|
90
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
91
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
92
|
+
|
93
|
+
Returns:
|
94
|
+
List['ResourceLog']
|
95
|
+
"""
|
96
|
+
|
97
|
+
return sync_detailed(
|
98
|
+
function_name=function_name,
|
99
|
+
client=client,
|
100
|
+
).parsed
|
101
|
+
|
102
|
+
|
103
|
+
async def asyncio_detailed(
|
104
|
+
function_name: str,
|
105
|
+
*,
|
106
|
+
client: AuthenticatedClient,
|
107
|
+
) -> Response[List["ResourceLog"]]:
|
108
|
+
"""
|
109
|
+
Args:
|
110
|
+
function_name (str):
|
111
|
+
|
112
|
+
Raises:
|
113
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
114
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
115
|
+
|
116
|
+
Returns:
|
117
|
+
Response[List['ResourceLog']]
|
118
|
+
"""
|
119
|
+
|
120
|
+
kwargs = _get_kwargs(
|
121
|
+
function_name=function_name,
|
122
|
+
)
|
123
|
+
|
124
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
125
|
+
|
126
|
+
return _build_response(client=client, response=response)
|
127
|
+
|
128
|
+
|
129
|
+
async def asyncio(
|
130
|
+
function_name: str,
|
131
|
+
*,
|
132
|
+
client: AuthenticatedClient,
|
133
|
+
) -> Optional[List["ResourceLog"]]:
|
134
|
+
"""
|
135
|
+
Args:
|
136
|
+
function_name (str):
|
137
|
+
|
138
|
+
Raises:
|
139
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
140
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
141
|
+
|
142
|
+
Returns:
|
143
|
+
List['ResourceLog']
|
144
|
+
"""
|
145
|
+
|
146
|
+
return (
|
147
|
+
await asyncio_detailed(
|
148
|
+
function_name=function_name,
|
149
|
+
client=client,
|
150
|
+
)
|
151
|
+
).parsed
|
@@ -0,0 +1,155 @@
|
|
1
|
+
from http import HTTPStatus
|
2
|
+
from typing import Any, List, Optional, Union
|
3
|
+
|
4
|
+
import httpx
|
5
|
+
|
6
|
+
from ... import errors
|
7
|
+
from ...client import AuthenticatedClient, Client
|
8
|
+
from ...models.resource_log import ResourceLog
|
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}/logs",
|
18
|
+
}
|
19
|
+
|
20
|
+
return _kwargs
|
21
|
+
|
22
|
+
|
23
|
+
def _parse_response(
|
24
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
25
|
+
) -> Optional[List["ResourceLog"]]:
|
26
|
+
if response.status_code == 200:
|
27
|
+
response_200 = []
|
28
|
+
_response_200 = response.json()
|
29
|
+
for response_200_item_data in _response_200:
|
30
|
+
response_200_item = ResourceLog.from_dict(response_200_item_data)
|
31
|
+
|
32
|
+
response_200.append(response_200_item)
|
33
|
+
|
34
|
+
return response_200
|
35
|
+
if client.raise_on_unexpected_status:
|
36
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
37
|
+
else:
|
38
|
+
return None
|
39
|
+
|
40
|
+
|
41
|
+
def _build_response(
|
42
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
43
|
+
) -> Response[List["ResourceLog"]]:
|
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
|
+
model_name: str,
|
54
|
+
*,
|
55
|
+
client: AuthenticatedClient,
|
56
|
+
) -> Response[List["ResourceLog"]]:
|
57
|
+
"""Returns logs for a model deployment by name.
|
58
|
+
|
59
|
+
Args:
|
60
|
+
model_name (str):
|
61
|
+
|
62
|
+
Raises:
|
63
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
64
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
65
|
+
|
66
|
+
Returns:
|
67
|
+
Response[List['ResourceLog']]
|
68
|
+
"""
|
69
|
+
|
70
|
+
kwargs = _get_kwargs(
|
71
|
+
model_name=model_name,
|
72
|
+
)
|
73
|
+
|
74
|
+
response = client.get_httpx_client().request(
|
75
|
+
**kwargs,
|
76
|
+
)
|
77
|
+
|
78
|
+
return _build_response(client=client, response=response)
|
79
|
+
|
80
|
+
|
81
|
+
def sync(
|
82
|
+
model_name: str,
|
83
|
+
*,
|
84
|
+
client: AuthenticatedClient,
|
85
|
+
) -> Optional[List["ResourceLog"]]:
|
86
|
+
"""Returns logs for a model deployment by name.
|
87
|
+
|
88
|
+
Args:
|
89
|
+
model_name (str):
|
90
|
+
|
91
|
+
Raises:
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
94
|
+
|
95
|
+
Returns:
|
96
|
+
List['ResourceLog']
|
97
|
+
"""
|
98
|
+
|
99
|
+
return sync_detailed(
|
100
|
+
model_name=model_name,
|
101
|
+
client=client,
|
102
|
+
).parsed
|
103
|
+
|
104
|
+
|
105
|
+
async def asyncio_detailed(
|
106
|
+
model_name: str,
|
107
|
+
*,
|
108
|
+
client: AuthenticatedClient,
|
109
|
+
) -> Response[List["ResourceLog"]]:
|
110
|
+
"""Returns logs for a model deployment by name.
|
111
|
+
|
112
|
+
Args:
|
113
|
+
model_name (str):
|
114
|
+
|
115
|
+
Raises:
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
118
|
+
|
119
|
+
Returns:
|
120
|
+
Response[List['ResourceLog']]
|
121
|
+
"""
|
122
|
+
|
123
|
+
kwargs = _get_kwargs(
|
124
|
+
model_name=model_name,
|
125
|
+
)
|
126
|
+
|
127
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
128
|
+
|
129
|
+
return _build_response(client=client, response=response)
|
130
|
+
|
131
|
+
|
132
|
+
async def asyncio(
|
133
|
+
model_name: str,
|
134
|
+
*,
|
135
|
+
client: AuthenticatedClient,
|
136
|
+
) -> Optional[List["ResourceLog"]]:
|
137
|
+
"""Returns logs for a model deployment by name.
|
138
|
+
|
139
|
+
Args:
|
140
|
+
model_name (str):
|
141
|
+
|
142
|
+
Raises:
|
143
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
144
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
145
|
+
|
146
|
+
Returns:
|
147
|
+
List['ResourceLog']
|
148
|
+
"""
|
149
|
+
|
150
|
+
return (
|
151
|
+
await asyncio_detailed(
|
152
|
+
model_name=model_name,
|
153
|
+
client=client,
|
154
|
+
)
|
155
|
+
).parsed
|
beamlit/common/generate.py
CHANGED
@@ -13,8 +13,13 @@ def generate_kit_function_code(settings: Settings, function: FunctionDeployment,
|
|
13
13
|
export_code = ""
|
14
14
|
code = ""
|
15
15
|
for kit in kit:
|
16
|
-
|
17
|
-
|
16
|
+
fn = FunctionDeployment(
|
17
|
+
function=kit.name,
|
18
|
+
workspace=settings.workspace,
|
19
|
+
parameters=kit.parameters,
|
20
|
+
description=kit.description,
|
21
|
+
)
|
22
|
+
new_code, export = generate_function_code(settings, fn, force_name_in_endpoint=function.function, kit=True)
|
18
23
|
code += new_code
|
19
24
|
export_code += export
|
20
25
|
return code, export_code
|
@@ -141,7 +146,7 @@ run_client = RunClient(client=client)
|
|
141
146
|
if settings.agent_functions and len(settings.agent_functions) > 0:
|
142
147
|
for function_config in settings.agent_functions:
|
143
148
|
if function_config.kit and len(function_config.kit) > 0:
|
144
|
-
new_code, export = generate_kit_function_code(settings, function_config)
|
149
|
+
new_code, export = generate_kit_function_code(settings, function_config, function_config.kit)
|
145
150
|
code += new_code
|
146
151
|
export_code += export
|
147
152
|
else:
|
beamlit/common/settings.py
CHANGED
@@ -23,7 +23,6 @@ def get_settings():
|
|
23
23
|
|
24
24
|
class Settings(BaseSettings):
|
25
25
|
model_config = SettingsConfigDict(
|
26
|
-
cli_parse_args=True,
|
27
26
|
yaml_file="beamlit.yaml",
|
28
27
|
env_prefix="bl_",
|
29
28
|
)
|
@@ -55,7 +54,7 @@ class Settings(BaseSettings):
|
|
55
54
|
) -> Tuple[PydanticBaseSettingsSource, ...]:
|
56
55
|
return (env_settings, dotenv_settings, file_secret_settings, YamlConfigSettingsSource(settings_cls), init_settings, )
|
57
56
|
|
58
|
-
def init_agent(client: AuthenticatedClient):
|
57
|
+
def init_agent(client: AuthenticatedClient, destination: str = f"{os.getcwd()}/src/beamlit_generated.py"):
|
59
58
|
from beamlit.api.agents import get_agent_deployment
|
60
59
|
from beamlit.common.generate import generate
|
61
60
|
|
@@ -90,10 +89,6 @@ def init_agent(client: AuthenticatedClient):
|
|
90
89
|
model_deployment = get_model_deployment.sync(agent_deployment.model, env , client=client)
|
91
90
|
SETTINGS.agent_model = model_deployment
|
92
91
|
|
93
|
-
|
94
|
-
destination = f"{os.getcwd()}/src/beamlit_generated.py"
|
95
|
-
|
96
|
-
|
97
92
|
content_generate = generate(destination, dry_run=True)
|
98
93
|
compared_content = None
|
99
94
|
if os.path.exists(destination):
|