beamlit 0.0.29rc31__py3-none-any.whl → 0.0.30__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- beamlit/api/agents/get_agent_trace_ids.py +71 -6
- beamlit/api/functions/get_function_trace_ids.py +71 -6
- beamlit/api/models/get_model_trace_ids.py +71 -6
- beamlit/common/__init__.py +4 -1
- beamlit/common/error.py +9 -0
- beamlit/common/settings.py +1 -1
- beamlit/deploy/deploy.py +13 -5
- beamlit/deploy/parser.py +2 -1
- beamlit/models/__init__.py +2 -0
- beamlit/models/trace_ids_response.py +63 -0
- beamlit/run.py +3 -1
- beamlit/serve/app.py +12 -8
- {beamlit-0.0.29rc31.dist-info → beamlit-0.0.30.dist-info}/METADATA +1 -1
- {beamlit-0.0.29rc31.dist-info → beamlit-0.0.30.dist-info}/RECORD +15 -13
- {beamlit-0.0.29rc31.dist-info → beamlit-0.0.30.dist-info}/WHEEL +0 -0
@@ -5,6 +5,7 @@ import httpx
|
|
5
5
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import AuthenticatedClient, Client
|
8
|
+
from ...models.trace_ids_response import TraceIdsResponse
|
8
9
|
from ...types import UNSET, Response, Unset
|
9
10
|
|
10
11
|
|
@@ -28,14 +29,22 @@ def _get_kwargs(
|
|
28
29
|
return _kwargs
|
29
30
|
|
30
31
|
|
31
|
-
def _parse_response(
|
32
|
+
def _parse_response(
|
33
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
34
|
+
) -> Optional[TraceIdsResponse]:
|
35
|
+
if response.status_code == 200:
|
36
|
+
response_200 = TraceIdsResponse.from_dict(response.json())
|
37
|
+
|
38
|
+
return response_200
|
32
39
|
if client.raise_on_unexpected_status:
|
33
40
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
34
41
|
else:
|
35
42
|
return None
|
36
43
|
|
37
44
|
|
38
|
-
def _build_response(
|
45
|
+
def _build_response(
|
46
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
47
|
+
) -> Response[TraceIdsResponse]:
|
39
48
|
return Response(
|
40
49
|
status_code=HTTPStatus(response.status_code),
|
41
50
|
content=response.content,
|
@@ -49,7 +58,7 @@ def sync_detailed(
|
|
49
58
|
*,
|
50
59
|
client: AuthenticatedClient,
|
51
60
|
environment: Union[Unset, str] = UNSET,
|
52
|
-
) -> Response[
|
61
|
+
) -> Response[TraceIdsResponse]:
|
53
62
|
"""Get agent trace IDs
|
54
63
|
|
55
64
|
Args:
|
@@ -61,7 +70,7 @@ def sync_detailed(
|
|
61
70
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
62
71
|
|
63
72
|
Returns:
|
64
|
-
Response[
|
73
|
+
Response[TraceIdsResponse]
|
65
74
|
"""
|
66
75
|
|
67
76
|
kwargs = _get_kwargs(
|
@@ -76,12 +85,39 @@ def sync_detailed(
|
|
76
85
|
return _build_response(client=client, response=response)
|
77
86
|
|
78
87
|
|
88
|
+
def sync(
|
89
|
+
agent_name: str,
|
90
|
+
*,
|
91
|
+
client: AuthenticatedClient,
|
92
|
+
environment: Union[Unset, str] = UNSET,
|
93
|
+
) -> Optional[TraceIdsResponse]:
|
94
|
+
"""Get agent trace IDs
|
95
|
+
|
96
|
+
Args:
|
97
|
+
agent_name (str):
|
98
|
+
environment (Union[Unset, str]):
|
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
|
+
TraceIdsResponse
|
106
|
+
"""
|
107
|
+
|
108
|
+
return sync_detailed(
|
109
|
+
agent_name=agent_name,
|
110
|
+
client=client,
|
111
|
+
environment=environment,
|
112
|
+
).parsed
|
113
|
+
|
114
|
+
|
79
115
|
async def asyncio_detailed(
|
80
116
|
agent_name: str,
|
81
117
|
*,
|
82
118
|
client: AuthenticatedClient,
|
83
119
|
environment: Union[Unset, str] = UNSET,
|
84
|
-
) -> Response[
|
120
|
+
) -> Response[TraceIdsResponse]:
|
85
121
|
"""Get agent trace IDs
|
86
122
|
|
87
123
|
Args:
|
@@ -93,7 +129,7 @@ async def asyncio_detailed(
|
|
93
129
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
94
130
|
|
95
131
|
Returns:
|
96
|
-
Response[
|
132
|
+
Response[TraceIdsResponse]
|
97
133
|
"""
|
98
134
|
|
99
135
|
kwargs = _get_kwargs(
|
@@ -104,3 +140,32 @@ async def asyncio_detailed(
|
|
104
140
|
response = await client.get_async_httpx_client().request(**kwargs)
|
105
141
|
|
106
142
|
return _build_response(client=client, response=response)
|
143
|
+
|
144
|
+
|
145
|
+
async def asyncio(
|
146
|
+
agent_name: str,
|
147
|
+
*,
|
148
|
+
client: AuthenticatedClient,
|
149
|
+
environment: Union[Unset, str] = UNSET,
|
150
|
+
) -> Optional[TraceIdsResponse]:
|
151
|
+
"""Get agent trace IDs
|
152
|
+
|
153
|
+
Args:
|
154
|
+
agent_name (str):
|
155
|
+
environment (Union[Unset, str]):
|
156
|
+
|
157
|
+
Raises:
|
158
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
159
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
160
|
+
|
161
|
+
Returns:
|
162
|
+
TraceIdsResponse
|
163
|
+
"""
|
164
|
+
|
165
|
+
return (
|
166
|
+
await asyncio_detailed(
|
167
|
+
agent_name=agent_name,
|
168
|
+
client=client,
|
169
|
+
environment=environment,
|
170
|
+
)
|
171
|
+
).parsed
|
@@ -5,6 +5,7 @@ import httpx
|
|
5
5
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import AuthenticatedClient, Client
|
8
|
+
from ...models.trace_ids_response import TraceIdsResponse
|
8
9
|
from ...types import UNSET, Response, Unset
|
9
10
|
|
10
11
|
|
@@ -28,14 +29,22 @@ def _get_kwargs(
|
|
28
29
|
return _kwargs
|
29
30
|
|
30
31
|
|
31
|
-
def _parse_response(
|
32
|
+
def _parse_response(
|
33
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
34
|
+
) -> Optional[TraceIdsResponse]:
|
35
|
+
if response.status_code == 200:
|
36
|
+
response_200 = TraceIdsResponse.from_dict(response.json())
|
37
|
+
|
38
|
+
return response_200
|
32
39
|
if client.raise_on_unexpected_status:
|
33
40
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
34
41
|
else:
|
35
42
|
return None
|
36
43
|
|
37
44
|
|
38
|
-
def _build_response(
|
45
|
+
def _build_response(
|
46
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
47
|
+
) -> Response[TraceIdsResponse]:
|
39
48
|
return Response(
|
40
49
|
status_code=HTTPStatus(response.status_code),
|
41
50
|
content=response.content,
|
@@ -49,7 +58,7 @@ def sync_detailed(
|
|
49
58
|
*,
|
50
59
|
client: AuthenticatedClient,
|
51
60
|
environment: Union[Unset, str] = UNSET,
|
52
|
-
) -> Response[
|
61
|
+
) -> Response[TraceIdsResponse]:
|
53
62
|
"""Get function trace IDs
|
54
63
|
|
55
64
|
Args:
|
@@ -61,7 +70,7 @@ def sync_detailed(
|
|
61
70
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
62
71
|
|
63
72
|
Returns:
|
64
|
-
Response[
|
73
|
+
Response[TraceIdsResponse]
|
65
74
|
"""
|
66
75
|
|
67
76
|
kwargs = _get_kwargs(
|
@@ -76,12 +85,39 @@ def sync_detailed(
|
|
76
85
|
return _build_response(client=client, response=response)
|
77
86
|
|
78
87
|
|
88
|
+
def sync(
|
89
|
+
function_name: str,
|
90
|
+
*,
|
91
|
+
client: AuthenticatedClient,
|
92
|
+
environment: Union[Unset, str] = UNSET,
|
93
|
+
) -> Optional[TraceIdsResponse]:
|
94
|
+
"""Get function trace IDs
|
95
|
+
|
96
|
+
Args:
|
97
|
+
function_name (str):
|
98
|
+
environment (Union[Unset, str]):
|
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
|
+
TraceIdsResponse
|
106
|
+
"""
|
107
|
+
|
108
|
+
return sync_detailed(
|
109
|
+
function_name=function_name,
|
110
|
+
client=client,
|
111
|
+
environment=environment,
|
112
|
+
).parsed
|
113
|
+
|
114
|
+
|
79
115
|
async def asyncio_detailed(
|
80
116
|
function_name: str,
|
81
117
|
*,
|
82
118
|
client: AuthenticatedClient,
|
83
119
|
environment: Union[Unset, str] = UNSET,
|
84
|
-
) -> Response[
|
120
|
+
) -> Response[TraceIdsResponse]:
|
85
121
|
"""Get function trace IDs
|
86
122
|
|
87
123
|
Args:
|
@@ -93,7 +129,7 @@ async def asyncio_detailed(
|
|
93
129
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
94
130
|
|
95
131
|
Returns:
|
96
|
-
Response[
|
132
|
+
Response[TraceIdsResponse]
|
97
133
|
"""
|
98
134
|
|
99
135
|
kwargs = _get_kwargs(
|
@@ -104,3 +140,32 @@ async def asyncio_detailed(
|
|
104
140
|
response = await client.get_async_httpx_client().request(**kwargs)
|
105
141
|
|
106
142
|
return _build_response(client=client, response=response)
|
143
|
+
|
144
|
+
|
145
|
+
async def asyncio(
|
146
|
+
function_name: str,
|
147
|
+
*,
|
148
|
+
client: AuthenticatedClient,
|
149
|
+
environment: Union[Unset, str] = UNSET,
|
150
|
+
) -> Optional[TraceIdsResponse]:
|
151
|
+
"""Get function trace IDs
|
152
|
+
|
153
|
+
Args:
|
154
|
+
function_name (str):
|
155
|
+
environment (Union[Unset, str]):
|
156
|
+
|
157
|
+
Raises:
|
158
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
159
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
160
|
+
|
161
|
+
Returns:
|
162
|
+
TraceIdsResponse
|
163
|
+
"""
|
164
|
+
|
165
|
+
return (
|
166
|
+
await asyncio_detailed(
|
167
|
+
function_name=function_name,
|
168
|
+
client=client,
|
169
|
+
environment=environment,
|
170
|
+
)
|
171
|
+
).parsed
|
@@ -5,6 +5,7 @@ import httpx
|
|
5
5
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import AuthenticatedClient, Client
|
8
|
+
from ...models.trace_ids_response import TraceIdsResponse
|
8
9
|
from ...types import UNSET, Response, Unset
|
9
10
|
|
10
11
|
|
@@ -28,14 +29,22 @@ def _get_kwargs(
|
|
28
29
|
return _kwargs
|
29
30
|
|
30
31
|
|
31
|
-
def _parse_response(
|
32
|
+
def _parse_response(
|
33
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
34
|
+
) -> Optional[TraceIdsResponse]:
|
35
|
+
if response.status_code == 200:
|
36
|
+
response_200 = TraceIdsResponse.from_dict(response.json())
|
37
|
+
|
38
|
+
return response_200
|
32
39
|
if client.raise_on_unexpected_status:
|
33
40
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
34
41
|
else:
|
35
42
|
return None
|
36
43
|
|
37
44
|
|
38
|
-
def _build_response(
|
45
|
+
def _build_response(
|
46
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
47
|
+
) -> Response[TraceIdsResponse]:
|
39
48
|
return Response(
|
40
49
|
status_code=HTTPStatus(response.status_code),
|
41
50
|
content=response.content,
|
@@ -49,7 +58,7 @@ def sync_detailed(
|
|
49
58
|
*,
|
50
59
|
client: AuthenticatedClient,
|
51
60
|
environment: Union[Unset, str] = UNSET,
|
52
|
-
) -> Response[
|
61
|
+
) -> Response[TraceIdsResponse]:
|
53
62
|
"""Get model trace IDs
|
54
63
|
|
55
64
|
Args:
|
@@ -61,7 +70,7 @@ def sync_detailed(
|
|
61
70
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
62
71
|
|
63
72
|
Returns:
|
64
|
-
Response[
|
73
|
+
Response[TraceIdsResponse]
|
65
74
|
"""
|
66
75
|
|
67
76
|
kwargs = _get_kwargs(
|
@@ -76,12 +85,39 @@ def sync_detailed(
|
|
76
85
|
return _build_response(client=client, response=response)
|
77
86
|
|
78
87
|
|
88
|
+
def sync(
|
89
|
+
model_name: str,
|
90
|
+
*,
|
91
|
+
client: AuthenticatedClient,
|
92
|
+
environment: Union[Unset, str] = UNSET,
|
93
|
+
) -> Optional[TraceIdsResponse]:
|
94
|
+
"""Get model trace IDs
|
95
|
+
|
96
|
+
Args:
|
97
|
+
model_name (str):
|
98
|
+
environment (Union[Unset, str]):
|
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
|
+
TraceIdsResponse
|
106
|
+
"""
|
107
|
+
|
108
|
+
return sync_detailed(
|
109
|
+
model_name=model_name,
|
110
|
+
client=client,
|
111
|
+
environment=environment,
|
112
|
+
).parsed
|
113
|
+
|
114
|
+
|
79
115
|
async def asyncio_detailed(
|
80
116
|
model_name: str,
|
81
117
|
*,
|
82
118
|
client: AuthenticatedClient,
|
83
119
|
environment: Union[Unset, str] = UNSET,
|
84
|
-
) -> Response[
|
120
|
+
) -> Response[TraceIdsResponse]:
|
85
121
|
"""Get model trace IDs
|
86
122
|
|
87
123
|
Args:
|
@@ -93,7 +129,7 @@ async def asyncio_detailed(
|
|
93
129
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
94
130
|
|
95
131
|
Returns:
|
96
|
-
Response[
|
132
|
+
Response[TraceIdsResponse]
|
97
133
|
"""
|
98
134
|
|
99
135
|
kwargs = _get_kwargs(
|
@@ -104,3 +140,32 @@ async def asyncio_detailed(
|
|
104
140
|
response = await client.get_async_httpx_client().request(**kwargs)
|
105
141
|
|
106
142
|
return _build_response(client=client, response=response)
|
143
|
+
|
144
|
+
|
145
|
+
async def asyncio(
|
146
|
+
model_name: str,
|
147
|
+
*,
|
148
|
+
client: AuthenticatedClient,
|
149
|
+
environment: Union[Unset, str] = UNSET,
|
150
|
+
) -> Optional[TraceIdsResponse]:
|
151
|
+
"""Get model trace IDs
|
152
|
+
|
153
|
+
Args:
|
154
|
+
model_name (str):
|
155
|
+
environment (Union[Unset, str]):
|
156
|
+
|
157
|
+
Raises:
|
158
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
159
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
160
|
+
|
161
|
+
Returns:
|
162
|
+
TraceIdsResponse
|
163
|
+
"""
|
164
|
+
|
165
|
+
return (
|
166
|
+
await asyncio_detailed(
|
167
|
+
model_name=model_name,
|
168
|
+
client=client,
|
169
|
+
environment=environment,
|
170
|
+
)
|
171
|
+
).parsed
|
beamlit/common/__init__.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
from .error import HTTPError
|
1
2
|
from .logger import init as init_logger
|
2
3
|
from .secrets import Secret
|
3
|
-
from .settings import Settings, get_settings, init_agent
|
4
|
+
from .settings import Settings, get_settings, init, init_agent
|
4
5
|
from .utils import copy_folder
|
5
6
|
|
6
7
|
__all__ = [
|
@@ -8,6 +9,8 @@ __all__ = [
|
|
8
9
|
"Settings",
|
9
10
|
"get_settings",
|
10
11
|
"init_agent",
|
12
|
+
"init",
|
11
13
|
"copy_folder",
|
12
14
|
"init_logger",
|
15
|
+
"HTTPError",
|
13
16
|
]
|
beamlit/common/error.py
ADDED
beamlit/common/settings.py
CHANGED
@@ -42,7 +42,7 @@ class SettingsServer(BaseSettings):
|
|
42
42
|
module: str = Field(default="main.main")
|
43
43
|
port: int = Field(default=80)
|
44
44
|
host: str = Field(default="0.0.0.0")
|
45
|
-
|
45
|
+
directory: str = Field(default="src")
|
46
46
|
|
47
47
|
class Settings(BaseSettings):
|
48
48
|
model_config = SettingsConfigDict(
|
beamlit/deploy/deploy.py
CHANGED
@@ -174,15 +174,15 @@ def dockerfile(
|
|
174
174
|
Returns:
|
175
175
|
str: Dockerfile content
|
176
176
|
"""
|
177
|
+
settings = get_settings()
|
177
178
|
if type == "agent":
|
178
179
|
module = f"{resource.module.__file__.split('/')[-1].replace('.py', '')}.{resource.module.__name__}"
|
179
180
|
else:
|
180
|
-
module = f"functions.{resource.module.
|
181
|
+
module = f"functions.{resource.module.__file__.split('/')[-1].replace('.py', '')}.{resource.module.__name__}"
|
181
182
|
cmd = ["bl", "serve", "--port", "80", "--module", module]
|
182
183
|
if type == "agent":
|
183
184
|
cmd.append("--remote")
|
184
185
|
cmd_str = ",".join([f'"{c}"' for c in cmd])
|
185
|
-
|
186
186
|
return f"""
|
187
187
|
FROM python:3.12-slim
|
188
188
|
|
@@ -201,7 +201,7 @@ RUN uv sync --no-cache
|
|
201
201
|
|
202
202
|
COPY README.m[d] /beamlit/README.md
|
203
203
|
COPY LICENS[E] /beamlit/LICENSE
|
204
|
-
COPY
|
204
|
+
COPY {settings.server.directory} /beamlit/src
|
205
205
|
|
206
206
|
ENV PATH="/beamlit/.venv/bin:$PATH"
|
207
207
|
|
@@ -226,11 +226,11 @@ def generate_beamlit_deployment(directory: str):
|
|
226
226
|
logger.info(f"Importing server module: {settings.server.module}")
|
227
227
|
functions: list[tuple[Resource, Function]] = []
|
228
228
|
agents: list[tuple[Resource, Agent]] = []
|
229
|
-
for resource in get_resources("agent"):
|
229
|
+
for resource in get_resources("agent", settings.server.directory):
|
230
230
|
agent = get_beamlit_deployment_from_resource(resource)
|
231
231
|
if agent:
|
232
232
|
agents.append((resource, agent))
|
233
|
-
for resource in get_resources("function"):
|
233
|
+
for resource in get_resources("function", settings.server.directory):
|
234
234
|
function = get_beamlit_deployment_from_resource(resource)
|
235
235
|
if function:
|
236
236
|
functions.append((resource, function))
|
@@ -251,6 +251,10 @@ def generate_beamlit_deployment(directory: str):
|
|
251
251
|
with open(os.path.join(agent_dir, f"Dockerfile"), "w") as f:
|
252
252
|
content = dockerfile("agent", resource, agent)
|
253
253
|
f.write(content)
|
254
|
+
# write destination docker
|
255
|
+
with open(os.path.join(agent_dir, f"destination.txt"), "w") as f:
|
256
|
+
content = agent.spec.runtime.image
|
257
|
+
f.write(content)
|
254
258
|
for resource, function in functions:
|
255
259
|
# write deployment file
|
256
260
|
function_dir = os.path.join(functions_dir, function.metadata.name)
|
@@ -262,3 +266,7 @@ def generate_beamlit_deployment(directory: str):
|
|
262
266
|
with open(os.path.join(function_dir, f"Dockerfile"), "w") as f:
|
263
267
|
content = dockerfile("function", resource, function)
|
264
268
|
f.write(content)
|
269
|
+
# write destination docker
|
270
|
+
with open(os.path.join(function_dir, f"destination.txt"), "w") as f:
|
271
|
+
content = function.spec.runtime.image
|
272
|
+
f.write(content)
|
beamlit/deploy/parser.py
CHANGED
@@ -7,6 +7,7 @@ from typing import Callable, Literal
|
|
7
7
|
|
8
8
|
from beamlit.models import StoreFunctionParameter
|
9
9
|
|
10
|
+
|
10
11
|
@dataclass
|
11
12
|
class Resource:
|
12
13
|
type: Literal["agent", "function"]
|
@@ -16,7 +17,7 @@ class Resource:
|
|
16
17
|
func: Callable
|
17
18
|
|
18
19
|
|
19
|
-
def get_resources(from_decorator, dir
|
20
|
+
def get_resources(from_decorator, dir) -> list[Resource]:
|
20
21
|
"""
|
21
22
|
Scans through Python files in a directory to find functions decorated with a specific decorator.
|
22
23
|
|
beamlit/models/__init__.py
CHANGED
@@ -93,6 +93,7 @@ from .store_function_kit import StoreFunctionKit
|
|
93
93
|
from .store_function_labels import StoreFunctionLabels
|
94
94
|
from .store_function_parameter import StoreFunctionParameter
|
95
95
|
from .time_fields import TimeFields
|
96
|
+
from .trace_ids_response import TraceIdsResponse
|
96
97
|
from .update_workspace_service_account_body import UpdateWorkspaceServiceAccountBody
|
97
98
|
from .update_workspace_service_account_response_200 import UpdateWorkspaceServiceAccountResponse200
|
98
99
|
from .update_workspace_user_role_body import UpdateWorkspaceUserRoleBody
|
@@ -191,6 +192,7 @@ __all__ = (
|
|
191
192
|
"StoreFunctionLabels",
|
192
193
|
"StoreFunctionParameter",
|
193
194
|
"TimeFields",
|
195
|
+
"TraceIdsResponse",
|
194
196
|
"UpdateWorkspaceServiceAccountBody",
|
195
197
|
"UpdateWorkspaceServiceAccountResponse200",
|
196
198
|
"UpdateWorkspaceUserRoleBody",
|
@@ -0,0 +1,63 @@
|
|
1
|
+
from typing import Any, TypeVar, Union, cast
|
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="TraceIdsResponse")
|
9
|
+
|
10
|
+
|
11
|
+
@_attrs_define
|
12
|
+
class TraceIdsResponse:
|
13
|
+
"""Response containing trace IDs
|
14
|
+
|
15
|
+
Attributes:
|
16
|
+
trace_ids (Union[Unset, list[str]]): List of trace IDs
|
17
|
+
"""
|
18
|
+
|
19
|
+
trace_ids: Union[Unset, list[str]] = UNSET
|
20
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
21
|
+
|
22
|
+
def to_dict(self) -> dict[str, Any]:
|
23
|
+
trace_ids: Union[Unset, list[str]] = UNSET
|
24
|
+
if not isinstance(self.trace_ids, Unset):
|
25
|
+
trace_ids = self.trace_ids
|
26
|
+
|
27
|
+
field_dict: dict[str, Any] = {}
|
28
|
+
field_dict.update(self.additional_properties)
|
29
|
+
field_dict.update({})
|
30
|
+
if trace_ids is not UNSET:
|
31
|
+
field_dict["trace_ids"] = trace_ids
|
32
|
+
|
33
|
+
return field_dict
|
34
|
+
|
35
|
+
@classmethod
|
36
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
37
|
+
if not src_dict:
|
38
|
+
return None
|
39
|
+
d = src_dict.copy()
|
40
|
+
trace_ids = cast(list[str], d.pop("trace_ids", UNSET))
|
41
|
+
|
42
|
+
trace_ids_response = cls(
|
43
|
+
trace_ids=trace_ids,
|
44
|
+
)
|
45
|
+
|
46
|
+
trace_ids_response.additional_properties = d
|
47
|
+
return trace_ids_response
|
48
|
+
|
49
|
+
@property
|
50
|
+
def additional_keys(self) -> list[str]:
|
51
|
+
return list(self.additional_properties.keys())
|
52
|
+
|
53
|
+
def __getitem__(self, key: str) -> Any:
|
54
|
+
return self.additional_properties[key]
|
55
|
+
|
56
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
57
|
+
self.additional_properties[key] = value
|
58
|
+
|
59
|
+
def __delitem__(self, key: str) -> None:
|
60
|
+
del self.additional_properties[key]
|
61
|
+
|
62
|
+
def __contains__(self, key: str) -> bool:
|
63
|
+
return key in self.additional_properties
|
beamlit/run.py
CHANGED
@@ -3,7 +3,7 @@ from typing import Any
|
|
3
3
|
|
4
4
|
import requests
|
5
5
|
from beamlit.client import AuthenticatedClient
|
6
|
-
from beamlit.common
|
6
|
+
from beamlit.common import HTTPError, get_settings
|
7
7
|
|
8
8
|
|
9
9
|
class RunClient:
|
@@ -45,4 +45,6 @@ class RunClient:
|
|
45
45
|
kwargs["json"] = json
|
46
46
|
|
47
47
|
response = client.request(method, url, **kwargs)
|
48
|
+
if response.status_code >= 400:
|
49
|
+
raise HTTPError(response.status_code, response.text)
|
48
50
|
return response
|
beamlit/serve/app.py
CHANGED
@@ -7,13 +7,10 @@ from logging import getLogger
|
|
7
7
|
from uuid import uuid4
|
8
8
|
|
9
9
|
from asgi_correlation_id import CorrelationIdMiddleware
|
10
|
-
from beamlit.common
|
11
|
-
from beamlit.common.instrumentation import (
|
12
|
-
|
13
|
-
|
14
|
-
get_span_exporter,
|
15
|
-
instrument_app,
|
16
|
-
)
|
10
|
+
from beamlit.common import HTTPError, get_settings, init
|
11
|
+
from beamlit.common.instrumentation import (get_metrics_exporter,
|
12
|
+
get_resource_attributes,
|
13
|
+
get_span_exporter, instrument_app)
|
17
14
|
from fastapi import FastAPI, Request, Response
|
18
15
|
from fastapi.responses import JSONResponse
|
19
16
|
from traceloop.sdk import Traceloop
|
@@ -90,10 +87,17 @@ async def root(request: Request):
|
|
90
87
|
content = {"error": str(e)}
|
91
88
|
if settings.environment == "development":
|
92
89
|
content["traceback"] = str(traceback.format_exc())
|
93
|
-
logger.error(
|
90
|
+
logger.error(str(traceback.format_exc()))
|
94
91
|
return JSONResponse(status_code=400, content=content)
|
92
|
+
except HTTPError as e:
|
93
|
+
content = {"error": e.message, "status_code": e.status_code}
|
94
|
+
if settings.environment == "development":
|
95
|
+
content["traceback"] = str(traceback.format_exc())
|
96
|
+
logger.error(f"{e.status_code} {str(traceback.format_exc())}")
|
97
|
+
return JSONResponse(status_code=e.status_code, content=content)
|
95
98
|
except Exception as e:
|
96
99
|
content = {"error": f"Internal server error, {e}"}
|
97
100
|
if settings.environment == "development":
|
98
101
|
content["traceback"] = str(traceback.format_exc())
|
102
|
+
logger.error(str(traceback.format_exc()))
|
99
103
|
return JSONResponse(status_code=500, content=content)
|
@@ -2,7 +2,7 @@ beamlit/__init__.py,sha256=545gFC-wLLwUktWcOAjUWe_Glha40tBetRTOYSfHnbI,164
|
|
2
2
|
beamlit/client.py,sha256=PnR6ybZk5dLIJPnDKAf2epHOeQC_7yL0fG4muvphHjA,12695
|
3
3
|
beamlit/errors.py,sha256=gO8GBmKqmSNgAg-E5oT-oOyxztvp7V_6XG7OUTT15q0,546
|
4
4
|
beamlit/py.typed,sha256=8ZJUsxZiuOy1oJeVhsTWQhTG_6pTVHVXk5hJL79ebTk,25
|
5
|
-
beamlit/run.py,sha256=
|
5
|
+
beamlit/run.py,sha256=BCVQXdtIzJedxqGSWttYlJphO5ru7VNDYrUAQmCNq_c,1445
|
6
6
|
beamlit/types.py,sha256=E1hhDh_zXfsSQ0NCt9-uw90_Mr5iIlsdfnfvxv5HarU,1005
|
7
7
|
beamlit/agents/__init__.py,sha256=nf1iwQwGtCG6nDqyVhxfWoqR6dv6X3bvSpCeqkTCFaM,101
|
8
8
|
beamlit/agents/chain.py,sha256=HzBs3nI4xaH86I_r-M-HGGp6roXsJxMx-qXl_GrJaY0,2831
|
@@ -18,7 +18,7 @@ beamlit/api/agents/get_agent.py,sha256=IBMiNb36CyNKKyW-RvMSakmOaGrP2hSm3HRa_Gm_c
|
|
18
18
|
beamlit/api/agents/get_agent_environment_logs.py,sha256=Fdd_mvlJXO17BQHbnl0YpUbXcX-1BsuZI2WKz6cgacA,3759
|
19
19
|
beamlit/api/agents/get_agent_history.py,sha256=sDKZQhul8wrSbuRY8WNI6jRNYgFcYtCnaU2fgR1owM8,3846
|
20
20
|
beamlit/api/agents/get_agent_metrics.py,sha256=IRdex5XAekCHSep6T7KQHB9T1J1f9egDx-MaiNynRVU,4344
|
21
|
-
beamlit/api/agents/get_agent_trace_ids.py,sha256=
|
21
|
+
beamlit/api/agents/get_agent_trace_ids.py,sha256=nCYXzCCmu8VXeLvPRX8Rc6N2JKMLVTTObbKtiCOzIg0,4365
|
22
22
|
beamlit/api/agents/list_agent_history.py,sha256=ZMTG5PSSkfd4OLmVHDIvDZy13bElrhQivF7QtBDLK9w,3775
|
23
23
|
beamlit/api/agents/list_agents.py,sha256=d6j_LM-8--2nfTHFjueRkoimHf02RRMAOWTpt8anJGg,4101
|
24
24
|
beamlit/api/agents/put_agent_history.py,sha256=lt1_9yFW_vEgeS_jlh-4EumgbTZCdcZYy9GbA91gewU,4590
|
@@ -43,7 +43,7 @@ beamlit/api/functions/delete_function.py,sha256=dzCBAL50Yg18bDUpcC1COjwFstnfBpqt
|
|
43
43
|
beamlit/api/functions/get_function.py,sha256=U4dXy47eKQh7spED7hyyHOepj6bU2U6QFJ0a2RS2y_8,4301
|
44
44
|
beamlit/api/functions/get_function_environment_logs.py,sha256=Ia7bDcx8k7qCBhxsm8jdDSbYGKwdTDYhkAcgv25Zz-o,3816
|
45
45
|
beamlit/api/functions/get_function_metrics.py,sha256=8FC7OCyj2QTXKRHyY7BPKfF2EAzXw0rg-r8yM19fQSc,4413
|
46
|
-
beamlit/api/functions/get_function_trace_ids.py,sha256=
|
46
|
+
beamlit/api/functions/get_function_trace_ids.py,sha256=Sz0DNr7K7z0Qzs9wJ8KYb7C8_vZj1aqoFk38MRYC_Xw,4434
|
47
47
|
beamlit/api/functions/list_functions.py,sha256=Z9PaBzpRCv4cfEMSiBaVLnKzRoWCBys4jOXXBWOzEU8,4167
|
48
48
|
beamlit/api/functions/update_function.py,sha256=sH-Oy2epz-X-59_eDnazzeeUsZMVNqG5J8VPe6nYJkg,4084
|
49
49
|
beamlit/api/history/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -78,7 +78,7 @@ beamlit/api/models/delete_model.py,sha256=4uENeuBKoIooCfniM1uZFjScqgHzlEDxl7aLjA
|
|
78
78
|
beamlit/api/models/get_model.py,sha256=sTE7fGpJ91svBMSKy7PGySqSOVy5g1YH3oHjhWbMr9s,4285
|
79
79
|
beamlit/api/models/get_model_environment_logs.py,sha256=Xi4c3I0y7y_JbqUDeZEH64oLom9DZ1Uk735j47QvDT0,3939
|
80
80
|
beamlit/api/models/get_model_metrics.py,sha256=06BcFFYS1Ml0tifIbDos9EqH6gSgGnwssKq75vhO5eU,4516
|
81
|
-
beamlit/api/models/get_model_trace_ids.py,sha256=
|
81
|
+
beamlit/api/models/get_model_trace_ids.py,sha256=xIUVeVf3oa1j8m3x7PO58bB3P3y_5mskKEOpWeJteIk,4365
|
82
82
|
beamlit/api/models/list_models.py,sha256=Keqg_qyTTGB-aJNA6JiMGnLdNwUSLIkzr08sdhhXxo4,4297
|
83
83
|
beamlit/api/models/release_model.py,sha256=ik1HHjOUVnaVJEvbbSS1ByQ2TMzkkUbNiGUXmlTiwBo,3893
|
84
84
|
beamlit/api/models/update_model.py,sha256=odMblGfUK6EAJHpu5mWUtpSNjFB8NvyTgqDp0JUygDA,4521
|
@@ -128,17 +128,18 @@ beamlit/authentication/authentication.py,sha256=8R-3WdQSykNjCbebAW2p8Glvw5nlAmSE
|
|
128
128
|
beamlit/authentication/clientcredentials.py,sha256=cxZPPu--CgizwqX0pdfFQ91gJt1EFKwyy-aBB_dXX7I,3990
|
129
129
|
beamlit/authentication/credentials.py,sha256=p_1xenabCbQuRz7BiFk7oTK4uCxAt_zoyku5o-jcKGE,5343
|
130
130
|
beamlit/authentication/device_mode.py,sha256=tmr22gllKOZwBRub_QjF5pYa425x-nE8tQNpZ_EGR6g,3644
|
131
|
-
beamlit/common/__init__.py,sha256=
|
131
|
+
beamlit/common/__init__.py,sha256=vj4_boIBVitMsaQR8BqBqE2eupOIh6MWBAYlYyCCH98,341
|
132
|
+
beamlit/common/error.py,sha256=f9oJDFxhoHK-vpjxBgEp0NwWIk0N_THPemUI7uQxVzU,270
|
132
133
|
beamlit/common/generate.py,sha256=LtdCju_QayRS4lZrrb_0VHqWWvTcv4Mbf-iV1TB_Qko,7522
|
133
134
|
beamlit/common/instrumentation.py,sha256=MsBDfFcMYqGDiHHj4j5hLHE4EWxZExkhmCeFS3SKzJY,3181
|
134
135
|
beamlit/common/logger.py,sha256=VFRbaZh93n8ZGugeeYKe88IP2nI3g2JNa7XN4j8wVJE,1116
|
135
136
|
beamlit/common/secrets.py,sha256=sid81bOe3LflkMKDHwBsBs9nIju8bp5-v9qU9gkyNMc,212
|
136
|
-
beamlit/common/settings.py,sha256=
|
137
|
+
beamlit/common/settings.py,sha256=2V06qodZHwPBqRDdpPyZhdCO7HeMjWr2rkEePOgmHqE,5936
|
137
138
|
beamlit/common/utils.py,sha256=jouz5igBvT37Xn_e94-foCHyQczVim-UzVcoIF6RWJ4,657
|
138
139
|
beamlit/deploy/__init__.py,sha256=GS7l7Jtm2yKs7iNLKcfjYO-rAhUzggQ3xiYSf3oxLBY,91
|
139
|
-
beamlit/deploy/deploy.py,sha256=
|
140
|
+
beamlit/deploy/deploy.py,sha256=AbQxSVGAPbwBn4wKPiMEF5GjtGa8q4u3DBuhnYdz4GI,9706
|
140
141
|
beamlit/deploy/format.py,sha256=78tOoeNPJ8969AhQTeFlIwZgQ3un8gmTSMmrYbRQSds,1818
|
141
|
-
beamlit/deploy/parser.py,sha256=
|
142
|
+
beamlit/deploy/parser.py,sha256=Ga0poCZkoRnuTw082QnTcNGCBJncoRAnVsn8-1FsaJE,6907
|
142
143
|
beamlit/functions/__init__.py,sha256=_RPG1Bfg54JGdIPnViAU6n9zD7E1cDNsdXi8oYGskzE,138
|
143
144
|
beamlit/functions/decorator.py,sha256=NsdIWs55Yhn-TUO855DIE2AarV-euXtl7Qt5c2W3AUo,3239
|
144
145
|
beamlit/functions/github/__init__.py,sha256=gYnUkeegukOfbymdabuuJkScvH-_ZJygX05BoqkPn0o,49
|
@@ -151,7 +152,7 @@ beamlit/functions/mcp/mcp.py,sha256=gXzvUPAKmvGQPHUKTVzMiINukxpw1BV6H8M2iOWvIGU,
|
|
151
152
|
beamlit/functions/remote/remote.py,sha256=x2eHh4oYkWwHuZWwg5XeylY-E9Opa6SzfN_0396ePZw,3775
|
152
153
|
beamlit/functions/search/__init__.py,sha256=5NAthQ9PBwrkNg1FpLRx4flauvv0HyWuwaVS589c1Pw,49
|
153
154
|
beamlit/functions/search/search.py,sha256=8s9ECltq7YE17j6rTxb12uY2EQY4_eTLHmwlIMThI0w,515
|
154
|
-
beamlit/models/__init__.py,sha256=
|
155
|
+
beamlit/models/__init__.py,sha256=0BldOldXzMn1A6d1bOhsU8mk7i3uRmh33_U-0IYjIRY,7803
|
155
156
|
beamlit/models/acl.py,sha256=tH67gsl_BMaviSbTaaIkO1g9cWZgJ6VgAnYVjQSzGZY,3952
|
156
157
|
beamlit/models/agent.py,sha256=oGZBwd2Hy-i6q_up4WQ0IvOmxqouR5I1Gk8vXvfLKvc,3384
|
157
158
|
beamlit/models/agent_chain.py,sha256=8PN8wVSayS-LoBN2nahZsOmr6r3t62H_LPDK_8fnkM8,2255
|
@@ -243,6 +244,7 @@ beamlit/models/store_function_kit.py,sha256=S0i3KMHkJ6FwWwMcPqUOYfXi8AYZ21WC7TLI
|
|
243
244
|
beamlit/models/store_function_labels.py,sha256=ZoEKD_CUDs7HcdHEobDsPz8OcUAZ11pFW3pVYrbz0KQ,1274
|
244
245
|
beamlit/models/store_function_parameter.py,sha256=0iuvA6WVExwzqt5HRNusS9PFtke5_qwVu8fT2MFOH8c,2553
|
245
246
|
beamlit/models/time_fields.py,sha256=5X-SFQ1-cfs5gTvyFjuQ8tfMJJrAGoK0OBZLuOM5phY,2006
|
247
|
+
beamlit/models/trace_ids_response.py,sha256=fmXsxlIc6dNEduKjCG-Yd-oC6MhsI2VSUWkWk9MSQ0s,1806
|
246
248
|
beamlit/models/update_workspace_service_account_body.py,sha256=fz2MGqwRfrYkMmL8PaFHQdsu3RQcRljvP6n6JIru45o,2004
|
247
249
|
beamlit/models/update_workspace_service_account_response_200.py,sha256=nCLPHFP_iR1MIpicgQMpbiyme97ZMfTFhyQUEbhzkHI,2968
|
248
250
|
beamlit/models/update_workspace_user_role_body.py,sha256=FyLCWy9oRgUxoFPxxtrDvwzh1kHLkoTZ1pL5w3ayexM,1572
|
@@ -250,10 +252,10 @@ beamlit/models/websocket_channel.py,sha256=jg3vN7yS_oOIwGtndtIUr1LsyEA58RXLXahqS
|
|
250
252
|
beamlit/models/workspace.py,sha256=l__bIpbA4oJvxXo7UbEoCcqkvu9MiNt5aXXpZ3bgwHg,4309
|
251
253
|
beamlit/models/workspace_labels.py,sha256=WbnUY6eCTkUNdY7hhhSF-KQCl8fWFfkCf7hzCTiNp4A,1246
|
252
254
|
beamlit/models/workspace_user.py,sha256=70CcifQWYbeWG7TDui4pblTzUe5sVK0AS19vNCzKE8g,3423
|
253
|
-
beamlit/serve/app.py,sha256=
|
255
|
+
beamlit/serve/app.py,sha256=k9THiOqcPs4lcQQhZaucLcboXCR_5AKP9AFCMNRbdPI,3559
|
254
256
|
beamlit/serve/middlewares/__init__.py,sha256=1dVmnOmhAQWvWktqHkKSIX-YoF6fmMU8xkUQuhg_rJU,148
|
255
257
|
beamlit/serve/middlewares/accesslog.py,sha256=Mu4T4_9OvHybjA0ApzZFpgi2C8f3X1NbUk-76v634XM,631
|
256
258
|
beamlit/serve/middlewares/processtime.py,sha256=lDAaIasZ4bwvN-HKHvZpaD9r-yrkVNZYx4abvbjbrCg,411
|
257
|
-
beamlit-0.0.
|
258
|
-
beamlit-0.0.
|
259
|
-
beamlit-0.0.
|
259
|
+
beamlit-0.0.30.dist-info/METADATA,sha256=UNYwevCSKK872KofAvX_-dHOIuFA_9LcrmF4lgT4mFg,2401
|
260
|
+
beamlit-0.0.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
261
|
+
beamlit-0.0.30.dist-info/RECORD,,
|
File without changes
|