beamlit 0.0.23rc15__py3-none-any.whl → 0.0.24__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- beamlit/agents/chat.py +37 -11
- beamlit/agents/decorator.py +101 -68
- beamlit/api/agents/create_agent.py +9 -14
- beamlit/api/agents/delete_agent.py +22 -1
- beamlit/api/agents/delete_agent_history.py +2 -6
- beamlit/api/agents/get_agent.py +22 -1
- beamlit/api/agents/get_agent_environment_logs.py +11 -11
- beamlit/api/agents/get_agent_history.py +2 -6
- beamlit/api/agents/get_agent_metrics.py +22 -1
- beamlit/api/agents/list_agent_history.py +11 -11
- beamlit/api/agents/list_agents.py +36 -4
- beamlit/api/agents/put_agent_history.py +2 -6
- beamlit/api/agents/update_agent.py +9 -14
- beamlit/api/functions/create_function.py +9 -14
- beamlit/api/functions/delete_function.py +22 -1
- beamlit/api/functions/get_function.py +22 -1
- beamlit/api/functions/get_function_environment_logs.py +11 -11
- beamlit/api/functions/get_function_metrics.py +22 -1
- beamlit/api/functions/list_functions.py +36 -4
- beamlit/api/functions/update_function.py +9 -14
- beamlit/api/history/get_agents_history.py +12 -12
- beamlit/api/history/list_agents_history.py +12 -12
- beamlit/api/integrations/get_integration_connection.py +16 -12
- beamlit/api/integrations/get_integration_connection_model.py +8 -1
- beamlit/api/integrations/get_integration_model.py +8 -1
- beamlit/api/locations/list_locations.py +12 -12
- beamlit/api/models/create_model.py +13 -14
- beamlit/api/models/delete_model.py +22 -1
- beamlit/api/models/get_model.py +22 -1
- beamlit/api/models/get_model_environment_logs.py +11 -11
- beamlit/api/models/get_model_metrics.py +38 -13
- beamlit/api/models/list_models.py +36 -4
- beamlit/api/models/update_model.py +13 -14
- beamlit/api/privateclusters/__init__.py +0 -0
- beamlit/api/{agents/get_agent_deployment_metrics.py → privateclusters/create_private_cluster.py} +28 -55
- beamlit/api/{functions/list_function_deployments.py → privateclusters/delete_private_cluster.py} +38 -37
- beamlit/api/{agents/get_agent_deployment.py → privateclusters/get_private_cluster.py} +40 -44
- beamlit/api/privateclusters/get_private_cluster_health.py +97 -0
- beamlit/api/{agents/list_agent_deployments.py → privateclusters/list_private_clusters.py} +30 -45
- beamlit/api/{models/list_model_deployments.py → privateclusters/update_private_cluster.py} +38 -45
- beamlit/api/privateclusters/update_private_cluster_health.py +97 -0
- beamlit/authentication/device_mode.py +3 -9
- beamlit/common/generate.py +47 -34
- beamlit/common/settings.py +29 -27
- beamlit/deploy/deploy.py +101 -342
- beamlit/deploy/format.py +70 -0
- beamlit/deploy/parser.py +175 -0
- beamlit/functions/decorator.py +17 -14
- beamlit/models/__init__.py +64 -78
- beamlit/models/acl.py +4 -22
- beamlit/models/agent.py +34 -95
- beamlit/models/agent_history.py +7 -5
- beamlit/models/agent_history_event.py +11 -9
- beamlit/models/agent_metadata.py +5 -3
- beamlit/models/agent_spec.py +54 -45
- beamlit/models/api_key.py +14 -14
- beamlit/models/configuration.py +11 -0
- beamlit/models/core_spec.py +45 -32
- beamlit/models/{model_deployment_metrics_query_per_second_per_region_per_code.py → core_spec_configurations.py} +22 -22
- beamlit/models/environment.py +33 -105
- beamlit/models/environment_metadata.py +146 -0
- beamlit/models/environment_spec.py +8 -6
- beamlit/models/function.py +34 -95
- beamlit/models/function_metadata.py +5 -3
- beamlit/models/function_spec.py +53 -40
- beamlit/models/integration_connection.py +31 -137
- beamlit/models/integration_connection_spec.py +6 -4
- beamlit/models/metadata.py +5 -3
- beamlit/models/metadata_labels.py +4 -2
- beamlit/models/model.py +33 -94
- beamlit/models/model_metadata.py +5 -3
- beamlit/models/{function_provider_ref.py → model_private_cluster.py} +23 -14
- beamlit/models/model_provider.py +27 -43
- beamlit/models/model_spec.py +45 -32
- beamlit/models/owner_fields.py +4 -2
- beamlit/models/pending_invitation.py +14 -14
- beamlit/models/pod_template_spec.py +4 -2
- beamlit/models/policy.py +33 -159
- beamlit/models/policy_spec.py +24 -28
- beamlit/models/private_cluster.py +183 -0
- beamlit/models/{model_provider_ref.py → private_location.py} +7 -16
- beamlit/models/resource_deployment_metrics.py +0 -108
- beamlit/models/resource_environment_metrics.py +143 -71
- beamlit/models/{resource_deployment_metrics_inference_per_region.py → resource_environment_metrics_inference_per_region.py} +5 -5
- beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +9 -11
- beamlit/models/{resource_deployment_metrics_query_per_region_per_code.py → resource_environment_metrics_query_per_region_per_code.py} +5 -5
- beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +5 -3
- beamlit/models/resource_log.py +4 -2
- beamlit/models/runtime.py +20 -2
- beamlit/models/serverless_config.py +28 -21
- beamlit/models/spec_configuration.py +7 -5
- beamlit/models/store_agent.py +14 -14
- beamlit/models/store_function.py +14 -14
- beamlit/models/time_fields.py +4 -2
- beamlit/models/websocket_channel.py +4 -2
- beamlit/models/workspace.py +23 -14
- beamlit/run.py +0 -1
- beamlit/serve/app.py +10 -3
- beamlit/serve/middlewares/accesslog.py +3 -1
- {beamlit-0.0.23rc15.dist-info → beamlit-0.0.24.dist-info}/METADATA +2 -2
- beamlit-0.0.24.dist-info/RECORD +243 -0
- {beamlit-0.0.23rc15.dist-info → beamlit-0.0.24.dist-info}/WHEEL +1 -1
- beamlit/api/agents/delete_agent_deployment.py +0 -163
- beamlit/api/agents/delete_agent_deployment_history.py +0 -172
- beamlit/api/agents/get_agent_deployment_history.py +0 -172
- beamlit/api/agents/get_agent_deployment_logs.py +0 -164
- beamlit/api/agents/list_agent_deployment_history.py +0 -164
- beamlit/api/agents/put_agent_deployment.py +0 -185
- beamlit/api/agents/put_agent_deployment_history.py +0 -198
- beamlit/api/functions/delete_function_deployment.py +0 -163
- beamlit/api/functions/get_function_deployment.py +0 -163
- beamlit/api/functions/get_function_deployment_logs.py +0 -164
- beamlit/api/functions/get_function_deployment_metrics.py +0 -159
- beamlit/api/functions/put_function_deployment.py +0 -185
- beamlit/api/models/delete_model_deployment.py +0 -171
- beamlit/api/models/get_model_deployment.py +0 -171
- beamlit/api/models/get_model_deployment_logs.py +0 -168
- beamlit/api/models/get_model_deployment_metrics.py +0 -163
- beamlit/api/models/put_model_deployment.py +0 -193
- beamlit/models/agent_configuration.py +0 -70
- beamlit/models/agent_deployment.py +0 -340
- beamlit/models/agent_deployment_configuration.py +0 -45
- beamlit/models/agent_deployment_configuration_type_0.py +0 -43
- beamlit/models/agent_deployment_history.py +0 -185
- beamlit/models/agent_deployment_history_event.py +0 -133
- beamlit/models/agent_deployment_pod_template.py +0 -45
- beamlit/models/agent_deployment_pod_template_type_0.py +0 -43
- beamlit/models/agent_with_deployments.py +0 -176
- beamlit/models/authentication_provider_model.py +0 -144
- beamlit/models/authentication_provider_organization.py +0 -88
- beamlit/models/deployment_configuration.py +0 -70
- beamlit/models/deployment_configurations.py +0 -58
- beamlit/models/deployment_serverless_config.py +0 -131
- beamlit/models/deployment_serverless_config_type_0.py +0 -220
- beamlit/models/function_configuration.py +0 -70
- beamlit/models/function_deployment.py +0 -340
- beamlit/models/function_deployment_configuration.py +0 -45
- beamlit/models/function_deployment_configuration_type_0.py +0 -43
- beamlit/models/function_deployment_pod_template.py +0 -45
- beamlit/models/function_deployment_pod_template_type_0.py +0 -43
- beamlit/models/function_with_deployments.py +0 -176
- beamlit/models/integration.py +0 -198
- beamlit/models/integration_config.py +0 -45
- beamlit/models/integration_secret.py +0 -61
- beamlit/models/labels_type_0.py +0 -45
- beamlit/models/location.py +0 -122
- beamlit/models/model_deployment.py +0 -296
- beamlit/models/model_deployment_log.py +0 -70
- beamlit/models/model_deployment_metrics.py +0 -172
- beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +0 -77
- beamlit/models/model_deployment_pod_template.py +0 -45
- beamlit/models/model_deployment_pod_template_type_0.py +0 -43
- beamlit/models/model_metrics.py +0 -96
- beamlit/models/model_with_deployments.py +0 -176
- beamlit/models/resource_deployment_log.py +0 -70
- beamlit/models/resource_deployment_metrics_inference_per_region_type_0.py +0 -79
- beamlit/models/resource_deployment_metrics_inference_per_second_per_region_type_0.py +0 -79
- beamlit/models/resource_deployment_metrics_query_per_region_per_code_type_0.py +0 -73
- beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code_type_0.py +0 -73
- beamlit/models/runtime_readiness_probe_type_0.py +0 -43
- beamlit/models/runtime_type_0.py +0 -111
- beamlit/models/runtime_type_0_readiness_probe.py +0 -43
- beamlit/models/runtime_type_0_readiness_probe_type_0.py +0 -43
- beamlit/models/runtime_type_0_resources.py +0 -59
- beamlit/models/standard_fields_dynamo_db.py +0 -88
- beamlit/models/store_agent_configuration.py +0 -97
- beamlit/models/store_agent_labels_type_0.py +0 -43
- beamlit/models/store_function_configuration.py +0 -97
- beamlit/models/store_function_labels_type_0.py +0 -43
- beamlit-0.0.23rc15.dist-info/RECORD +0 -303
beamlit/agents/chat.py
CHANGED
@@ -2,14 +2,14 @@ from logging import getLogger
|
|
2
2
|
|
3
3
|
from beamlit.authentication import get_authentication_headers, new_client
|
4
4
|
from beamlit.common.settings import get_settings
|
5
|
-
from beamlit.models import
|
5
|
+
from beamlit.models import Model
|
6
6
|
|
7
7
|
logger = getLogger(__name__)
|
8
8
|
|
9
9
|
|
10
|
-
def get_base_url(agent_model:
|
10
|
+
def get_base_url(agent_model: Model):
|
11
11
|
settings = get_settings()
|
12
|
-
return f"{settings.run_url}/{settings.workspace}/models/{agent_model.
|
12
|
+
return f"{settings.run_url}/{settings.workspace}/models/{agent_model.metadata.name}/v1"
|
13
13
|
|
14
14
|
|
15
15
|
def get_mistral_chat_model(**kwargs):
|
@@ -29,16 +29,25 @@ def get_anthropic_chat_model(**kwargs):
|
|
29
29
|
|
30
30
|
return ChatAnthropic(**kwargs)
|
31
31
|
|
32
|
+
def get_xai_chat_model(**kwargs):
|
33
|
+
from langchain_xai import ChatXAI # type: ignore
|
32
34
|
|
33
|
-
|
35
|
+
return ChatXAI(**kwargs)
|
36
|
+
|
37
|
+
def get_cohere_chat_model(**kwargs):
|
38
|
+
from langchain_cohere import ChatCohere # type: ignore
|
39
|
+
|
40
|
+
return ChatCohere(**kwargs)
|
41
|
+
|
42
|
+
def get_chat_model(agent_model: Model):
|
34
43
|
settings = get_settings()
|
35
44
|
client = new_client()
|
36
45
|
|
37
46
|
headers = get_authentication_headers(settings)
|
38
|
-
headers["X-Beamlit-Environment"] = agent_model.environment
|
47
|
+
headers["X-Beamlit-Environment"] = agent_model.metadata.environment
|
39
48
|
|
40
49
|
jwt = headers.get("X-Beamlit-Authorization", "").replace("Bearer ", "")
|
41
|
-
params = {"environment": agent_model.environment}
|
50
|
+
params = {"environment": agent_model.metadata.environment}
|
42
51
|
chat_classes = {
|
43
52
|
"openai": {
|
44
53
|
"func": get_openai_chat_model,
|
@@ -57,19 +66,33 @@ def get_chat_model(agent_model: AgentDeployment):
|
|
57
66
|
"api_key": jwt,
|
58
67
|
},
|
59
68
|
},
|
69
|
+
"xai": {
|
70
|
+
"func": get_xai_chat_model,
|
71
|
+
"kwargs": {
|
72
|
+
"api_key": jwt,
|
73
|
+
"xai_api_base": get_base_url(),
|
74
|
+
},
|
75
|
+
"remove_kwargs": ["base_url"],
|
76
|
+
},
|
77
|
+
"cohere": {
|
78
|
+
"func": get_cohere_chat_model,
|
79
|
+
"kwargs": {
|
80
|
+
"cohere_api_key": jwt,
|
81
|
+
},
|
82
|
+
},
|
60
83
|
}
|
61
84
|
|
62
85
|
if agent_model is None:
|
63
86
|
raise ValueError("agent_model not found in configuration")
|
64
|
-
if agent_model.runtime is None:
|
87
|
+
if agent_model.spec.runtime is None:
|
65
88
|
raise ValueError("runtime not found in agent model")
|
66
|
-
if agent_model.runtime.type_ is None:
|
89
|
+
if agent_model.spec.runtime.type_ is None:
|
67
90
|
raise ValueError("type not found in runtime")
|
68
|
-
if agent_model.runtime.model is None:
|
91
|
+
if agent_model.spec.runtime.model is None:
|
69
92
|
raise ValueError("model not found in runtime")
|
70
93
|
|
71
|
-
provider = agent_model.runtime.type_
|
72
|
-
model = agent_model.runtime.model
|
94
|
+
provider = agent_model.spec.runtime.type_
|
95
|
+
model = agent_model.spec.runtime.model
|
73
96
|
|
74
97
|
kwargs = {
|
75
98
|
"model": model,
|
@@ -85,4 +108,7 @@ def get_chat_model(agent_model: AgentDeployment):
|
|
85
108
|
chat_class = chat_classes["openai"]
|
86
109
|
if "kwargs" in chat_class:
|
87
110
|
kwargs.update(chat_class["kwargs"])
|
111
|
+
if "remove_kwargs" in chat_class:
|
112
|
+
for key in chat_class["remove_kwargs"]:
|
113
|
+
kwargs.pop(key, None)
|
88
114
|
return chat_class["func"](**kwargs)
|
beamlit/agents/decorator.py
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# Import necessary modules
|
2
2
|
import ast
|
3
3
|
import asyncio
|
4
|
+
import functools
|
4
5
|
import importlib
|
5
6
|
import os
|
6
7
|
from logging import getLogger
|
7
8
|
|
8
|
-
from
|
9
|
-
from langgraph.checkpoint.memory import MemorySaver
|
10
|
-
from langgraph.prebuilt import create_react_agent
|
11
|
-
|
12
|
-
from beamlit.api.models import get_model_deployment
|
9
|
+
from beamlit.api.models import get_model
|
13
10
|
from beamlit.authentication import new_client
|
14
11
|
from beamlit.common.settings import get_settings, init
|
15
12
|
from beamlit.errors import UnexpectedStatus
|
16
|
-
from beamlit.models import
|
13
|
+
from beamlit.models import Agent, AgentSpec, Metadata
|
14
|
+
from langchain_core.tools import Tool
|
15
|
+
from langgraph.checkpoint.memory import MemorySaver
|
16
|
+
from langgraph.prebuilt import create_react_agent
|
17
17
|
|
18
18
|
from .chat import get_chat_model
|
19
19
|
|
@@ -23,6 +23,8 @@ def get_functions(dir="src/functions", from_decorator="function"):
|
|
23
23
|
logger = getLogger(__name__)
|
24
24
|
|
25
25
|
# Walk through all Python files in functions directory and subdirectories
|
26
|
+
if not os.path.exists(dir):
|
27
|
+
return []
|
26
28
|
for root, _, files in os.walk(dir):
|
27
29
|
for file in files:
|
28
30
|
if file.endswith(".py"):
|
@@ -37,9 +39,9 @@ def get_functions(dir="src/functions", from_decorator="function"):
|
|
37
39
|
# Look for function definitions with decorators
|
38
40
|
for node in ast.walk(tree):
|
39
41
|
if (
|
40
|
-
|
41
|
-
|
42
|
-
):
|
42
|
+
not isinstance(node, ast.FunctionDef)
|
43
|
+
and not isinstance(node, ast.AsyncFunctionDef)
|
44
|
+
) or len(node.decorator_list) == 0:
|
43
45
|
continue
|
44
46
|
decorator = node.decorator_list[0]
|
45
47
|
|
@@ -76,77 +78,108 @@ def get_functions(dir="src/functions", from_decorator="function"):
|
|
76
78
|
if not is_kit and hasattr(module, func_name):
|
77
79
|
func = getattr(module, func_name)
|
78
80
|
if asyncio.iscoroutinefunction(func):
|
79
|
-
functions.append(
|
81
|
+
functions.append(
|
82
|
+
Tool(
|
83
|
+
name=func.__name__,
|
84
|
+
description=func.__doc__,
|
85
|
+
func=func,
|
86
|
+
coroutine=func,
|
87
|
+
)
|
88
|
+
)
|
80
89
|
else:
|
81
|
-
functions.append(
|
90
|
+
functions.append(
|
91
|
+
Tool(
|
92
|
+
name=func.__name__,
|
93
|
+
description=func.__doc__,
|
94
|
+
func=func,
|
95
|
+
)
|
96
|
+
)
|
82
97
|
except Exception as e:
|
83
98
|
logger.warning(f"Error processing {file_path}: {e!s}")
|
84
99
|
return functions
|
85
100
|
|
86
101
|
|
87
102
|
def agent(
|
88
|
-
|
89
|
-
|
90
|
-
|
103
|
+
agent: Agent | dict = None,
|
104
|
+
override_chat_model=None,
|
105
|
+
override_agent=None,
|
91
106
|
):
|
92
|
-
settings = init()
|
93
107
|
logger = getLogger(__name__)
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
def wrapped(*args, **kwargs):
|
99
|
-
return func(
|
100
|
-
settings.agent.agent,
|
101
|
-
settings.agent.chat_model,
|
102
|
-
settings.agent.functions,
|
103
|
-
*args,
|
104
|
-
**kwargs,
|
108
|
+
try:
|
109
|
+
if agent is not None and not isinstance(agent, dict):
|
110
|
+
raise Exception(
|
111
|
+
'agent must be a dictionary, example: @agent(agent={"metadata": {"name": "my_agent"}})'
|
105
112
|
)
|
106
113
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
114
|
+
chat_model = override_chat_model or None
|
115
|
+
settings = init()
|
116
|
+
|
117
|
+
def wrapper(func):
|
118
|
+
@functools.wraps(func)
|
119
|
+
def wrapped(*args, **kwargs):
|
120
|
+
return func(
|
121
|
+
settings.agent.agent,
|
122
|
+
settings.agent.chat_model,
|
123
|
+
settings.agent.functions,
|
124
|
+
*args,
|
125
|
+
**kwargs,
|
126
|
+
)
|
127
|
+
|
128
|
+
return wrapped
|
129
|
+
|
130
|
+
# Initialize functions array to store decorated functions
|
131
|
+
functions = get_functions(dir=settings.agent.functions_directory)
|
132
|
+
settings.agent.functions = functions
|
133
|
+
|
134
|
+
if agent is not None:
|
135
|
+
metadata = Metadata(**agent.get("metadata", {}))
|
136
|
+
spec = AgentSpec(**agent.get("spec", {}))
|
137
|
+
agent = Agent(metadata=metadata, spec=spec)
|
138
|
+
if agent.spec.model and chat_model is None:
|
139
|
+
client = new_client()
|
122
140
|
try:
|
123
|
-
response =
|
124
|
-
|
141
|
+
response = get_model.sync_detailed(
|
142
|
+
agent.spec.model, environment=settings.environment, client=client
|
125
143
|
)
|
126
144
|
settings.agent.model = response.parsed
|
127
145
|
except UnexpectedStatus as e:
|
128
|
-
if e.status_code == 404:
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
146
|
+
if e.status_code == 404 and settings.environment != "production":
|
147
|
+
try:
|
148
|
+
response = get_model.sync_detailed(
|
149
|
+
agent.spec.model, environment="production", client=client
|
150
|
+
)
|
151
|
+
settings.agent.model = response.parsed
|
152
|
+
except UnexpectedStatus as e:
|
153
|
+
if e.status_code == 404:
|
154
|
+
raise ValueError(f"Model {agent.spec.model} not found")
|
155
|
+
else:
|
156
|
+
raise e
|
157
|
+
except Exception as e:
|
158
|
+
raise e
|
159
|
+
|
160
|
+
if settings.agent.model:
|
161
|
+
chat_model = get_chat_model(settings.agent.model)
|
162
|
+
settings.agent.chat_model = chat_model
|
163
|
+
runtime = settings.agent.model.spec.runtime
|
164
|
+
logger.info(f"Chat model configured, using: {runtime.type_}:{runtime.model}")
|
165
|
+
|
166
|
+
if override_agent is None and len(functions) == 0:
|
167
|
+
raise ValueError(
|
168
|
+
"You must define at least one function, you can define this function in directory "
|
169
|
+
f'"{settings.agent.functions_directory}". Here is a sample function you can use:\n\n'
|
170
|
+
"from beamlit.functions import function\n\n"
|
171
|
+
"@function()\n"
|
172
|
+
"def hello_world(query: str):\n"
|
173
|
+
" return 'Hello, world!'\n"
|
174
|
+
)
|
175
|
+
|
176
|
+
if override_agent is None and chat_model is not None:
|
177
|
+
memory = MemorySaver()
|
178
|
+
agent = create_react_agent(chat_model, functions, checkpointer=memory)
|
179
|
+
settings.agent.agent = agent
|
180
|
+
else:
|
181
|
+
settings.agent.agent = override_agent
|
182
|
+
return wrapper
|
183
|
+
except Exception as e:
|
184
|
+
logger.error(f"Error in agent decorator: {e!s} at line {e.__traceback__.tb_lineno}")
|
185
|
+
raise e
|
@@ -6,13 +6,12 @@ import httpx
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import AuthenticatedClient, Client
|
8
8
|
from ...models.agent import Agent
|
9
|
-
from ...models.agent_with_deployments import AgentWithDeployments
|
10
9
|
from ...types import Response
|
11
10
|
|
12
11
|
|
13
12
|
def _get_kwargs(
|
14
13
|
*,
|
15
|
-
body:
|
14
|
+
body: Agent,
|
16
15
|
) -> dict[str, Any]:
|
17
16
|
headers: dict[str, Any] = {}
|
18
17
|
|
@@ -53,13 +52,12 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt
|
|
53
52
|
def sync_detailed(
|
54
53
|
*,
|
55
54
|
client: AuthenticatedClient,
|
56
|
-
body:
|
55
|
+
body: Agent,
|
57
56
|
) -> Response[Agent]:
|
58
57
|
"""Create agent by name
|
59
58
|
|
60
59
|
Args:
|
61
|
-
body (
|
62
|
-
definition inside
|
60
|
+
body (Agent): Agent
|
63
61
|
|
64
62
|
Raises:
|
65
63
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -83,13 +81,12 @@ def sync_detailed(
|
|
83
81
|
def sync(
|
84
82
|
*,
|
85
83
|
client: AuthenticatedClient,
|
86
|
-
body:
|
84
|
+
body: Agent,
|
87
85
|
) -> Optional[Agent]:
|
88
86
|
"""Create agent by name
|
89
87
|
|
90
88
|
Args:
|
91
|
-
body (
|
92
|
-
definition inside
|
89
|
+
body (Agent): Agent
|
93
90
|
|
94
91
|
Raises:
|
95
92
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -108,13 +105,12 @@ def sync(
|
|
108
105
|
async def asyncio_detailed(
|
109
106
|
*,
|
110
107
|
client: AuthenticatedClient,
|
111
|
-
body:
|
108
|
+
body: Agent,
|
112
109
|
) -> Response[Agent]:
|
113
110
|
"""Create agent by name
|
114
111
|
|
115
112
|
Args:
|
116
|
-
body (
|
117
|
-
definition inside
|
113
|
+
body (Agent): Agent
|
118
114
|
|
119
115
|
Raises:
|
120
116
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -136,13 +132,12 @@ async def asyncio_detailed(
|
|
136
132
|
async def asyncio(
|
137
133
|
*,
|
138
134
|
client: AuthenticatedClient,
|
139
|
-
body:
|
135
|
+
body: Agent,
|
140
136
|
) -> Optional[Agent]:
|
141
137
|
"""Create agent by name
|
142
138
|
|
143
139
|
Args:
|
144
|
-
body (
|
145
|
-
definition inside
|
140
|
+
body (Agent): Agent
|
146
141
|
|
147
142
|
Raises:
|
148
143
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -6,15 +6,24 @@ import httpx
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import AuthenticatedClient, Client
|
8
8
|
from ...models.agent import Agent
|
9
|
-
from ...types import Response
|
9
|
+
from ...types import UNSET, Response
|
10
10
|
|
11
11
|
|
12
12
|
def _get_kwargs(
|
13
13
|
agent_name: str,
|
14
|
+
*,
|
15
|
+
environment: str,
|
14
16
|
) -> dict[str, Any]:
|
17
|
+
params: dict[str, Any] = {}
|
18
|
+
|
19
|
+
params["environment"] = environment
|
20
|
+
|
21
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
22
|
+
|
15
23
|
_kwargs: dict[str, Any] = {
|
16
24
|
"method": "delete",
|
17
25
|
"url": f"/agents/{agent_name}",
|
26
|
+
"params": params,
|
18
27
|
}
|
19
28
|
|
20
29
|
return _kwargs
|
@@ -44,11 +53,13 @@ def sync_detailed(
|
|
44
53
|
agent_name: str,
|
45
54
|
*,
|
46
55
|
client: AuthenticatedClient,
|
56
|
+
environment: str,
|
47
57
|
) -> Response[Agent]:
|
48
58
|
"""Delete agent by name
|
49
59
|
|
50
60
|
Args:
|
51
61
|
agent_name (str):
|
62
|
+
environment (str):
|
52
63
|
|
53
64
|
Raises:
|
54
65
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -60,6 +71,7 @@ def sync_detailed(
|
|
60
71
|
|
61
72
|
kwargs = _get_kwargs(
|
62
73
|
agent_name=agent_name,
|
74
|
+
environment=environment,
|
63
75
|
)
|
64
76
|
|
65
77
|
response = client.get_httpx_client().request(
|
@@ -73,11 +85,13 @@ def sync(
|
|
73
85
|
agent_name: str,
|
74
86
|
*,
|
75
87
|
client: AuthenticatedClient,
|
88
|
+
environment: str,
|
76
89
|
) -> Optional[Agent]:
|
77
90
|
"""Delete agent by name
|
78
91
|
|
79
92
|
Args:
|
80
93
|
agent_name (str):
|
94
|
+
environment (str):
|
81
95
|
|
82
96
|
Raises:
|
83
97
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -90,6 +104,7 @@ def sync(
|
|
90
104
|
return sync_detailed(
|
91
105
|
agent_name=agent_name,
|
92
106
|
client=client,
|
107
|
+
environment=environment,
|
93
108
|
).parsed
|
94
109
|
|
95
110
|
|
@@ -97,11 +112,13 @@ async def asyncio_detailed(
|
|
97
112
|
agent_name: str,
|
98
113
|
*,
|
99
114
|
client: AuthenticatedClient,
|
115
|
+
environment: str,
|
100
116
|
) -> Response[Agent]:
|
101
117
|
"""Delete agent by name
|
102
118
|
|
103
119
|
Args:
|
104
120
|
agent_name (str):
|
121
|
+
environment (str):
|
105
122
|
|
106
123
|
Raises:
|
107
124
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -113,6 +130,7 @@ async def asyncio_detailed(
|
|
113
130
|
|
114
131
|
kwargs = _get_kwargs(
|
115
132
|
agent_name=agent_name,
|
133
|
+
environment=environment,
|
116
134
|
)
|
117
135
|
|
118
136
|
response = await client.get_async_httpx_client().request(**kwargs)
|
@@ -124,11 +142,13 @@ async def asyncio(
|
|
124
142
|
agent_name: str,
|
125
143
|
*,
|
126
144
|
client: AuthenticatedClient,
|
145
|
+
environment: str,
|
127
146
|
) -> Optional[Agent]:
|
128
147
|
"""Delete agent by name
|
129
148
|
|
130
149
|
Args:
|
131
150
|
agent_name (str):
|
151
|
+
environment (str):
|
132
152
|
|
133
153
|
Raises:
|
134
154
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -142,5 +162,6 @@ async def asyncio(
|
|
142
162
|
await asyncio_detailed(
|
143
163
|
agent_name=agent_name,
|
144
164
|
client=client,
|
165
|
+
environment=environment,
|
145
166
|
)
|
146
167
|
).parsed
|
@@ -21,9 +21,7 @@ def _get_kwargs(
|
|
21
21
|
return _kwargs
|
22
22
|
|
23
23
|
|
24
|
-
def _parse_response(
|
25
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
26
|
-
) -> Optional[AgentHistory]:
|
24
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AgentHistory]:
|
27
25
|
if response.status_code == 200:
|
28
26
|
response_200 = AgentHistory.from_dict(response.json())
|
29
27
|
|
@@ -34,9 +32,7 @@ def _parse_response(
|
|
34
32
|
return None
|
35
33
|
|
36
34
|
|
37
|
-
def _build_response(
|
38
|
-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
39
|
-
) -> Response[AgentHistory]:
|
35
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AgentHistory]:
|
40
36
|
return Response(
|
41
37
|
status_code=HTTPStatus(response.status_code),
|
42
38
|
content=response.content,
|
beamlit/api/agents/get_agent.py
CHANGED
@@ -6,15 +6,24 @@ import httpx
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import AuthenticatedClient, Client
|
8
8
|
from ...models.agent import Agent
|
9
|
-
from ...types import Response
|
9
|
+
from ...types import UNSET, Response, Unset
|
10
10
|
|
11
11
|
|
12
12
|
def _get_kwargs(
|
13
13
|
agent_name: str,
|
14
|
+
*,
|
15
|
+
environment: Union[Unset, str] = UNSET,
|
14
16
|
) -> dict[str, Any]:
|
17
|
+
params: dict[str, Any] = {}
|
18
|
+
|
19
|
+
params["environment"] = environment
|
20
|
+
|
21
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
22
|
+
|
15
23
|
_kwargs: dict[str, Any] = {
|
16
24
|
"method": "get",
|
17
25
|
"url": f"/agents/{agent_name}",
|
26
|
+
"params": params,
|
18
27
|
}
|
19
28
|
|
20
29
|
return _kwargs
|
@@ -44,11 +53,13 @@ def sync_detailed(
|
|
44
53
|
agent_name: str,
|
45
54
|
*,
|
46
55
|
client: AuthenticatedClient,
|
56
|
+
environment: Union[Unset, str] = UNSET,
|
47
57
|
) -> Response[Agent]:
|
48
58
|
"""Get agent by name
|
49
59
|
|
50
60
|
Args:
|
51
61
|
agent_name (str):
|
62
|
+
environment (Union[Unset, str]):
|
52
63
|
|
53
64
|
Raises:
|
54
65
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -60,6 +71,7 @@ def sync_detailed(
|
|
60
71
|
|
61
72
|
kwargs = _get_kwargs(
|
62
73
|
agent_name=agent_name,
|
74
|
+
environment=environment,
|
63
75
|
)
|
64
76
|
|
65
77
|
response = client.get_httpx_client().request(
|
@@ -73,11 +85,13 @@ def sync(
|
|
73
85
|
agent_name: str,
|
74
86
|
*,
|
75
87
|
client: AuthenticatedClient,
|
88
|
+
environment: Union[Unset, str] = UNSET,
|
76
89
|
) -> Optional[Agent]:
|
77
90
|
"""Get agent by name
|
78
91
|
|
79
92
|
Args:
|
80
93
|
agent_name (str):
|
94
|
+
environment (Union[Unset, str]):
|
81
95
|
|
82
96
|
Raises:
|
83
97
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -90,6 +104,7 @@ def sync(
|
|
90
104
|
return sync_detailed(
|
91
105
|
agent_name=agent_name,
|
92
106
|
client=client,
|
107
|
+
environment=environment,
|
93
108
|
).parsed
|
94
109
|
|
95
110
|
|
@@ -97,11 +112,13 @@ async def asyncio_detailed(
|
|
97
112
|
agent_name: str,
|
98
113
|
*,
|
99
114
|
client: AuthenticatedClient,
|
115
|
+
environment: Union[Unset, str] = UNSET,
|
100
116
|
) -> Response[Agent]:
|
101
117
|
"""Get agent by name
|
102
118
|
|
103
119
|
Args:
|
104
120
|
agent_name (str):
|
121
|
+
environment (Union[Unset, str]):
|
105
122
|
|
106
123
|
Raises:
|
107
124
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -113,6 +130,7 @@ async def asyncio_detailed(
|
|
113
130
|
|
114
131
|
kwargs = _get_kwargs(
|
115
132
|
agent_name=agent_name,
|
133
|
+
environment=environment,
|
116
134
|
)
|
117
135
|
|
118
136
|
response = await client.get_async_httpx_client().request(**kwargs)
|
@@ -124,11 +142,13 @@ async def asyncio(
|
|
124
142
|
agent_name: str,
|
125
143
|
*,
|
126
144
|
client: AuthenticatedClient,
|
145
|
+
environment: Union[Unset, str] = UNSET,
|
127
146
|
) -> Optional[Agent]:
|
128
147
|
"""Get agent by name
|
129
148
|
|
130
149
|
Args:
|
131
150
|
agent_name (str):
|
151
|
+
environment (Union[Unset, str]):
|
132
152
|
|
133
153
|
Raises:
|
134
154
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -142,5 +162,6 @@ async def asyncio(
|
|
142
162
|
await asyncio_detailed(
|
143
163
|
agent_name=agent_name,
|
144
164
|
client=client,
|
165
|
+
environment=environment,
|
145
166
|
)
|
146
167
|
).parsed
|