beamlit 0.0.56rc104__py3-none-any.whl → 0.0.56rc105__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.
Files changed (34) hide show
  1. beamlit/agents/chain.py +2 -1
  2. beamlit/api/default/list_mcp_hub_definitions.py +127 -0
  3. beamlit/api/generation/__init__.py +0 -0
  4. beamlit/api/generation/run_information_generation_agent.py +168 -0
  5. beamlit/api/knowledgebases/delete_knowledgebase.py +18 -18
  6. beamlit/api/knowledgebases/get_knowledgebase.py +18 -18
  7. beamlit/api/knowledgebases/update_knowledgebase.py +14 -14
  8. beamlit/deploy/deploy.py +5 -2
  9. beamlit/functions/remote/remote.py +3 -2
  10. beamlit/models/__init__.py +30 -0
  11. beamlit/models/agent_information_request.py +63 -0
  12. beamlit/models/agent_information_response.py +88 -0
  13. beamlit/models/agent_spec.py +9 -0
  14. beamlit/models/entrypoint.py +96 -0
  15. beamlit/models/entrypoint_env.py +45 -0
  16. beamlit/models/form.py +120 -0
  17. beamlit/models/form_config.py +45 -0
  18. beamlit/models/form_oauthomitempty.py +45 -0
  19. beamlit/models/form_secrets.py +45 -0
  20. beamlit/models/mcp_definition.py +188 -0
  21. beamlit/models/mcp_definition_entrypoint.py +45 -0
  22. beamlit/models/mcp_definition_form.py +45 -0
  23. beamlit/models/mcp_hub_artifact.py +188 -0
  24. beamlit/models/mcp_hub_artifact_entrypoint.py +45 -0
  25. beamlit/models/mcp_hub_artifact_form.py +45 -0
  26. beamlit/models/model_spec.py +0 -9
  27. beamlit/models/o_auth.py +72 -0
  28. beamlit/models/workspace.py +9 -9
  29. {beamlit-0.0.56rc104.dist-info → beamlit-0.0.56rc105.dist-info}/METADATA +1 -1
  30. {beamlit-0.0.56rc104.dist-info → beamlit-0.0.56rc105.dist-info}/RECORD +33 -16
  31. beamlit/api/workspaces/workspace_quotas_request.py +0 -97
  32. {beamlit-0.0.56rc104.dist-info → beamlit-0.0.56rc105.dist-info}/WHEEL +0 -0
  33. {beamlit-0.0.56rc104.dist-info → beamlit-0.0.56rc105.dist-info}/entry_points.txt +0 -0
  34. {beamlit-0.0.56rc104.dist-info → beamlit-0.0.56rc105.dist-info}/licenses/LICENSE +0 -0
beamlit/deploy/deploy.py CHANGED
@@ -59,6 +59,7 @@ def set_default_values(resource: Resource, deployment: Agent | Function):
59
59
  return deployment
60
60
 
61
61
  def get_beamlit_deployment_from_resource(
62
+ settings: Settings,
62
63
  resource: Resource,
63
64
  ) -> Agent | Function:
64
65
  """
@@ -75,6 +76,7 @@ def get_beamlit_deployment_from_resource(
75
76
  if isinstance(arg.value, ast.Dict):
76
77
  value = arg_to_dict(arg.value)
77
78
  metadata = EnvironmentMetadata(**value.get("metadata", {}))
79
+ metadata.environment = settings.environment
78
80
  spec = AgentSpec(**value.get("spec", {}))
79
81
  agent = Agent(metadata=metadata, spec=spec)
80
82
  if not agent.spec.prompt:
@@ -84,6 +86,7 @@ def get_beamlit_deployment_from_resource(
84
86
  if isinstance(arg.value, ast.Dict):
85
87
  value = arg_to_dict(arg.value)
86
88
  metadata = EnvironmentMetadata(**value.get("metadata", {}))
89
+ metadata.environment = settings.environment
87
90
  spec = FunctionSpec(**value.get("spec", {}))
88
91
  func = Function(metadata=metadata, spec=spec)
89
92
  if not func.spec.parameters:
@@ -265,13 +268,13 @@ def generate_beamlit_deployment(directory: str, name: str):
265
268
  functions: list[tuple[Resource, Function]] = []
266
269
  agents: list[tuple[Resource, Agent]] = []
267
270
  for resource in get_resources("agent", settings.server.directory):
268
- agent = get_beamlit_deployment_from_resource(resource)
271
+ agent = get_beamlit_deployment_from_resource(settings, resource)
269
272
  if name and agent.metadata.name != name:
270
273
  agent.metadata.name = slugify(name)
271
274
  if agent:
272
275
  agents.append((resource, agent))
273
276
  for resource in get_resources("function", settings.server.directory):
274
- function = get_beamlit_deployment_from_resource(resource)
277
+ function = get_beamlit_deployment_from_resource(settings, resource)
275
278
  if function:
276
279
  functions.append((resource, function))
277
280
 
@@ -4,13 +4,15 @@ It includes classes for creating dynamic schemas based on function parameters an
4
4
  """
5
5
 
6
6
  import asyncio
7
+ import os
7
8
  import warnings
8
9
  from dataclasses import dataclass
9
10
  from typing import Callable
10
- import os
11
11
 
12
12
  import pydantic
13
13
  import typing_extensions as t
14
+ from langchain_core.tools.base import BaseTool, ToolException
15
+
14
16
  from beamlit.api.functions import get_function, list_functions
15
17
  from beamlit.authentication.authentication import AuthenticatedClient
16
18
  from beamlit.common.settings import get_settings
@@ -18,7 +20,6 @@ from beamlit.errors import UnexpectedStatus
18
20
  from beamlit.functions.mcp.mcp import MCPClient, MCPToolkit
19
21
  from beamlit.models import Function, StoreFunctionParameter
20
22
  from beamlit.run import RunClient
21
- from langchain_core.tools.base import BaseTool, ToolException
22
23
 
23
24
 
24
25
  def create_dynamic_schema(name: str, parameters: list[StoreFunctionParameter]) -> type[pydantic.BaseModel]:
@@ -5,6 +5,8 @@ from .agent import Agent
5
5
  from .agent_chain import AgentChain
6
6
  from .agent_history import AgentHistory
7
7
  from .agent_history_event import AgentHistoryEvent
8
+ from .agent_information_request import AgentInformationRequest
9
+ from .agent_information_response import AgentInformationResponse
8
10
  from .agent_release import AgentRelease
9
11
  from .agent_spec import AgentSpec
10
12
  from .api_key import ApiKey
@@ -18,11 +20,17 @@ from .create_api_key_for_service_account_body import CreateApiKeyForServiceAccou
18
20
  from .create_workspace_service_account_body import CreateWorkspaceServiceAccountBody
19
21
  from .create_workspace_service_account_response_200 import CreateWorkspaceServiceAccountResponse200
20
22
  from .delete_workspace_service_account_response_200 import DeleteWorkspaceServiceAccountResponse200
23
+ from .entrypoint import Entrypoint
24
+ from .entrypoint_env import EntrypointEnv
21
25
  from .environment import Environment
22
26
  from .environment_metadata import EnvironmentMetadata
23
27
  from .environment_metrics import EnvironmentMetrics
24
28
  from .environment_spec import EnvironmentSpec
25
29
  from .flavor import Flavor
30
+ from .form import Form
31
+ from .form_config import FormConfig
32
+ from .form_oauthomitempty import FormOauthomitempty
33
+ from .form_secrets import FormSecrets
26
34
  from .function import Function
27
35
  from .function_kit import FunctionKit
28
36
  from .function_release import FunctionRelease
@@ -49,6 +57,12 @@ from .knowledgebase_spec_options import KnowledgebaseSpecOptions
49
57
  from .last_n_requests_metric import LastNRequestsMetric
50
58
  from .latency_metric import LatencyMetric
51
59
  from .location_response import LocationResponse
60
+ from .mcp_definition import MCPDefinition
61
+ from .mcp_definition_entrypoint import MCPDefinitionEntrypoint
62
+ from .mcp_definition_form import MCPDefinitionForm
63
+ from .mcp_hub_artifact import MCPHubArtifact
64
+ from .mcp_hub_artifact_entrypoint import MCPHubArtifactEntrypoint
65
+ from .mcp_hub_artifact_form import MCPHubArtifactForm
52
66
  from .metadata import Metadata
53
67
  from .metadata_labels import MetadataLabels
54
68
  from .metric import Metric
@@ -60,6 +74,7 @@ from .model import Model
60
74
  from .model_private_cluster import ModelPrivateCluster
61
75
  from .model_release import ModelRelease
62
76
  from .model_spec import ModelSpec
77
+ from .o_auth import OAuth
63
78
  from .owner_fields import OwnerFields
64
79
  from .pending_invitation import PendingInvitation
65
80
  from .pending_invitation_accept import PendingInvitationAccept
@@ -125,6 +140,8 @@ __all__ = (
125
140
  "AgentChain",
126
141
  "AgentHistory",
127
142
  "AgentHistoryEvent",
143
+ "AgentInformationRequest",
144
+ "AgentInformationResponse",
128
145
  "AgentRelease",
129
146
  "AgentSpec",
130
147
  "ApiKey",
@@ -138,11 +155,17 @@ __all__ = (
138
155
  "CreateWorkspaceServiceAccountBody",
139
156
  "CreateWorkspaceServiceAccountResponse200",
140
157
  "DeleteWorkspaceServiceAccountResponse200",
158
+ "Entrypoint",
159
+ "EntrypointEnv",
141
160
  "Environment",
142
161
  "EnvironmentMetadata",
143
162
  "EnvironmentMetrics",
144
163
  "EnvironmentSpec",
145
164
  "Flavor",
165
+ "Form",
166
+ "FormConfig",
167
+ "FormOauthomitempty",
168
+ "FormSecrets",
146
169
  "Function",
147
170
  "FunctionKit",
148
171
  "FunctionRelease",
@@ -167,6 +190,12 @@ __all__ = (
167
190
  "LastNRequestsMetric",
168
191
  "LatencyMetric",
169
192
  "LocationResponse",
193
+ "MCPDefinition",
194
+ "MCPDefinitionEntrypoint",
195
+ "MCPDefinitionForm",
196
+ "MCPHubArtifact",
197
+ "MCPHubArtifactEntrypoint",
198
+ "MCPHubArtifactForm",
170
199
  "Metadata",
171
200
  "MetadataLabels",
172
201
  "Metric",
@@ -178,6 +207,7 @@ __all__ = (
178
207
  "ModelPrivateCluster",
179
208
  "ModelRelease",
180
209
  "ModelSpec",
210
+ "OAuth",
181
211
  "OwnerFields",
182
212
  "PendingInvitation",
183
213
  "PendingInvitationAccept",
@@ -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="AgentInformationRequest")
9
+
10
+
11
+ @_attrs_define
12
+ class AgentInformationRequest:
13
+ """generation agent information request
14
+
15
+ Attributes:
16
+ functions (Union[Unset, list[Any]]): Functions to generate information for
17
+ """
18
+
19
+ functions: Union[Unset, list[Any]] = UNSET
20
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21
+
22
+ def to_dict(self) -> dict[str, Any]:
23
+ functions: Union[Unset, list[Any]] = UNSET
24
+ if not isinstance(self.functions, Unset):
25
+ functions = self.functions
26
+
27
+ field_dict: dict[str, Any] = {}
28
+ field_dict.update(self.additional_properties)
29
+ field_dict.update({})
30
+ if functions is not UNSET:
31
+ field_dict["functions"] = functions
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
+ functions = cast(list[Any], d.pop("functions", UNSET))
41
+
42
+ agent_information_request = cls(
43
+ functions=functions,
44
+ )
45
+
46
+ agent_information_request.additional_properties = d
47
+ return agent_information_request
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
@@ -0,0 +1,88 @@
1
+ from typing import Any, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ T = TypeVar("T", bound="AgentInformationResponse")
9
+
10
+
11
+ @_attrs_define
12
+ class AgentInformationResponse:
13
+ """generation agent information response
14
+
15
+ Attributes:
16
+ description (Union[Unset, str]): Description of the agent
17
+ display_name (Union[Unset, str]): Display name of the agent
18
+ name (Union[Unset, str]): Name of the agent
19
+ prompt (Union[Unset, str]): Prompt of the agent
20
+ """
21
+
22
+ description: Union[Unset, str] = UNSET
23
+ display_name: Union[Unset, str] = UNSET
24
+ name: Union[Unset, str] = UNSET
25
+ prompt: Union[Unset, str] = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ description = self.description
30
+
31
+ display_name = self.display_name
32
+
33
+ name = self.name
34
+
35
+ prompt = self.prompt
36
+
37
+ field_dict: dict[str, Any] = {}
38
+ field_dict.update(self.additional_properties)
39
+ field_dict.update({})
40
+ if description is not UNSET:
41
+ field_dict["description"] = description
42
+ if display_name is not UNSET:
43
+ field_dict["displayName"] = display_name
44
+ if name is not UNSET:
45
+ field_dict["name"] = name
46
+ if prompt is not UNSET:
47
+ field_dict["prompt"] = prompt
48
+
49
+ return field_dict
50
+
51
+ @classmethod
52
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
53
+ if not src_dict:
54
+ return None
55
+ d = src_dict.copy()
56
+ description = d.pop("description", UNSET)
57
+
58
+ display_name = d.pop("displayName", UNSET)
59
+
60
+ name = d.pop("name", UNSET)
61
+
62
+ prompt = d.pop("prompt", UNSET)
63
+
64
+ agent_information_response = cls(
65
+ description=description,
66
+ display_name=display_name,
67
+ name=name,
68
+ prompt=prompt,
69
+ )
70
+
71
+ agent_information_response.additional_properties = d
72
+ return agent_information_response
73
+
74
+ @property
75
+ def additional_keys(self) -> list[str]:
76
+ return list(self.additional_properties.keys())
77
+
78
+ def __getitem__(self, key: str) -> Any:
79
+ return self.additional_properties[key]
80
+
81
+ def __setitem__(self, key: str, value: Any) -> None:
82
+ self.additional_properties[key] = value
83
+
84
+ def __delitem__(self, key: str) -> None:
85
+ del self.additional_properties[key]
86
+
87
+ def __contains__(self, key: str) -> bool:
88
+ return key in self.additional_properties
@@ -37,6 +37,7 @@ class AgentSpec:
37
37
  agent_chain (Union[Unset, list['AgentChain']]): Agent chain
38
38
  description (Union[Unset, str]): Description, small description computed from the prompt
39
39
  functions (Union[Unset, list[str]]):
40
+ knowledgebase (Union[Unset, str]): Knowledgebase Name
40
41
  model (Union[Unset, str]): Model name
41
42
  prompt (Union[Unset, str]): Prompt, describe what your agent does
42
43
  repository (Union[Unset, Repository]): Repository
@@ -56,6 +57,7 @@ class AgentSpec:
56
57
  agent_chain: Union[Unset, list["AgentChain"]] = UNSET
57
58
  description: Union[Unset, str] = UNSET
58
59
  functions: Union[Unset, list[str]] = UNSET
60
+ knowledgebase: Union[Unset, str] = UNSET
59
61
  model: Union[Unset, str] = UNSET
60
62
  prompt: Union[Unset, str] = UNSET
61
63
  repository: Union[Unset, "Repository"] = UNSET
@@ -137,6 +139,8 @@ class AgentSpec:
137
139
  if not isinstance(self.functions, Unset):
138
140
  functions = self.functions
139
141
 
142
+ knowledgebase = self.knowledgebase
143
+
140
144
  model = self.model
141
145
 
142
146
  prompt = self.prompt
@@ -178,6 +182,8 @@ class AgentSpec:
178
182
  field_dict["description"] = description
179
183
  if functions is not UNSET:
180
184
  field_dict["functions"] = functions
185
+ if knowledgebase is not UNSET:
186
+ field_dict["knowledgebase"] = knowledgebase
181
187
  if model is not UNSET:
182
188
  field_dict["model"] = model
183
189
  if prompt is not UNSET:
@@ -264,6 +270,8 @@ class AgentSpec:
264
270
 
265
271
  functions = cast(list[str], d.pop("functions", UNSET))
266
272
 
273
+ knowledgebase = d.pop("knowledgebase", UNSET)
274
+
267
275
  model = d.pop("model", UNSET)
268
276
 
269
277
  prompt = d.pop("prompt", UNSET)
@@ -291,6 +299,7 @@ class AgentSpec:
291
299
  agent_chain=agent_chain,
292
300
  description=description,
293
301
  functions=functions,
302
+ knowledgebase=knowledgebase,
294
303
  model=model,
295
304
  prompt=prompt,
296
305
  repository=repository,
@@ -0,0 +1,96 @@
1
+ from typing import TYPE_CHECKING, 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
+ if TYPE_CHECKING:
9
+ from ..models.entrypoint_env import EntrypointEnv
10
+
11
+
12
+ T = TypeVar("T", bound="Entrypoint")
13
+
14
+
15
+ @_attrs_define
16
+ class Entrypoint:
17
+ """Entrypoint of the artifact
18
+
19
+ Attributes:
20
+ args (Union[Unset, list[Any]]): Args of the entrypoint
21
+ command (Union[Unset, str]): Command of the entrypoint
22
+ env (Union[Unset, EntrypointEnv]): Env of the entrypoint
23
+ """
24
+
25
+ args: Union[Unset, list[Any]] = UNSET
26
+ command: Union[Unset, str] = UNSET
27
+ env: Union[Unset, "EntrypointEnv"] = UNSET
28
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
29
+
30
+ def to_dict(self) -> dict[str, Any]:
31
+ args: Union[Unset, list[Any]] = UNSET
32
+ if not isinstance(self.args, Unset):
33
+ args = self.args
34
+
35
+ command = self.command
36
+
37
+ env: Union[Unset, dict[str, Any]] = UNSET
38
+ if self.env and not isinstance(self.env, Unset) and not isinstance(self.env, dict):
39
+ env = self.env.to_dict()
40
+ elif self.env and isinstance(self.env, dict):
41
+ env = self.env
42
+
43
+ field_dict: dict[str, Any] = {}
44
+ field_dict.update(self.additional_properties)
45
+ field_dict.update({})
46
+ if args is not UNSET:
47
+ field_dict["args"] = args
48
+ if command is not UNSET:
49
+ field_dict["command"] = command
50
+ if env is not UNSET:
51
+ field_dict["env"] = env
52
+
53
+ return field_dict
54
+
55
+ @classmethod
56
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
57
+ from ..models.entrypoint_env import EntrypointEnv
58
+
59
+ if not src_dict:
60
+ return None
61
+ d = src_dict.copy()
62
+ args = cast(list[Any], d.pop("args", UNSET))
63
+
64
+ command = d.pop("command", UNSET)
65
+
66
+ _env = d.pop("env", UNSET)
67
+ env: Union[Unset, EntrypointEnv]
68
+ if isinstance(_env, Unset):
69
+ env = UNSET
70
+ else:
71
+ env = EntrypointEnv.from_dict(_env)
72
+
73
+ entrypoint = cls(
74
+ args=args,
75
+ command=command,
76
+ env=env,
77
+ )
78
+
79
+ entrypoint.additional_properties = d
80
+ return entrypoint
81
+
82
+ @property
83
+ def additional_keys(self) -> list[str]:
84
+ return list(self.additional_properties.keys())
85
+
86
+ def __getitem__(self, key: str) -> Any:
87
+ return self.additional_properties[key]
88
+
89
+ def __setitem__(self, key: str, value: Any) -> None:
90
+ self.additional_properties[key] = value
91
+
92
+ def __delitem__(self, key: str) -> None:
93
+ del self.additional_properties[key]
94
+
95
+ def __contains__(self, key: str) -> bool:
96
+ return key in self.additional_properties
@@ -0,0 +1,45 @@
1
+ from typing import Any, TypeVar
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ T = TypeVar("T", bound="EntrypointEnv")
7
+
8
+
9
+ @_attrs_define
10
+ class EntrypointEnv:
11
+ """Env of the entrypoint"""
12
+
13
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
14
+
15
+ def to_dict(self) -> dict[str, Any]:
16
+ field_dict: dict[str, Any] = {}
17
+ field_dict.update(self.additional_properties)
18
+
19
+ return field_dict
20
+
21
+ @classmethod
22
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
23
+ if not src_dict:
24
+ return None
25
+ d = src_dict.copy()
26
+ entrypoint_env = cls()
27
+
28
+ entrypoint_env.additional_properties = d
29
+ return entrypoint_env
30
+
31
+ @property
32
+ def additional_keys(self) -> list[str]:
33
+ return list(self.additional_properties.keys())
34
+
35
+ def __getitem__(self, key: str) -> Any:
36
+ return self.additional_properties[key]
37
+
38
+ def __setitem__(self, key: str, value: Any) -> None:
39
+ self.additional_properties[key] = value
40
+
41
+ def __delitem__(self, key: str) -> None:
42
+ del self.additional_properties[key]
43
+
44
+ def __contains__(self, key: str) -> bool:
45
+ return key in self.additional_properties
beamlit/models/form.py ADDED
@@ -0,0 +1,120 @@
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ if TYPE_CHECKING:
9
+ from ..models.form_config import FormConfig
10
+ from ..models.form_oauthomitempty import FormOauthomitempty
11
+ from ..models.form_secrets import FormSecrets
12
+
13
+
14
+ T = TypeVar("T", bound="Form")
15
+
16
+
17
+ @_attrs_define
18
+ class Form:
19
+ """Form of the artifact
20
+
21
+ Attributes:
22
+ config (Union[Unset, FormConfig]): Config of the artifact
23
+ oauthomitempty (Union[Unset, FormOauthomitempty]): OAuth of the artifact
24
+ secrets (Union[Unset, FormSecrets]): Secrets of the artifact
25
+ """
26
+
27
+ config: Union[Unset, "FormConfig"] = UNSET
28
+ oauthomitempty: Union[Unset, "FormOauthomitempty"] = UNSET
29
+ secrets: Union[Unset, "FormSecrets"] = UNSET
30
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31
+
32
+ def to_dict(self) -> dict[str, Any]:
33
+ config: Union[Unset, dict[str, Any]] = UNSET
34
+ if self.config and not isinstance(self.config, Unset) and not isinstance(self.config, dict):
35
+ config = self.config.to_dict()
36
+ elif self.config and isinstance(self.config, dict):
37
+ config = self.config
38
+
39
+ oauthomitempty: Union[Unset, dict[str, Any]] = UNSET
40
+ if (
41
+ self.oauthomitempty
42
+ and not isinstance(self.oauthomitempty, Unset)
43
+ and not isinstance(self.oauthomitempty, dict)
44
+ ):
45
+ oauthomitempty = self.oauthomitempty.to_dict()
46
+ elif self.oauthomitempty and isinstance(self.oauthomitempty, dict):
47
+ oauthomitempty = self.oauthomitempty
48
+
49
+ secrets: Union[Unset, dict[str, Any]] = UNSET
50
+ if self.secrets and not isinstance(self.secrets, Unset) and not isinstance(self.secrets, dict):
51
+ secrets = self.secrets.to_dict()
52
+ elif self.secrets and isinstance(self.secrets, dict):
53
+ secrets = self.secrets
54
+
55
+ field_dict: dict[str, Any] = {}
56
+ field_dict.update(self.additional_properties)
57
+ field_dict.update({})
58
+ if config is not UNSET:
59
+ field_dict["config"] = config
60
+ if oauthomitempty is not UNSET:
61
+ field_dict["oauth,omitempty"] = oauthomitempty
62
+ if secrets is not UNSET:
63
+ field_dict["secrets"] = secrets
64
+
65
+ return field_dict
66
+
67
+ @classmethod
68
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
69
+ from ..models.form_config import FormConfig
70
+ from ..models.form_oauthomitempty import FormOauthomitempty
71
+ from ..models.form_secrets import FormSecrets
72
+
73
+ if not src_dict:
74
+ return None
75
+ d = src_dict.copy()
76
+ _config = d.pop("config", UNSET)
77
+ config: Union[Unset, FormConfig]
78
+ if isinstance(_config, Unset):
79
+ config = UNSET
80
+ else:
81
+ config = FormConfig.from_dict(_config)
82
+
83
+ _oauthomitempty = d.pop("oauth,omitempty", UNSET)
84
+ oauthomitempty: Union[Unset, FormOauthomitempty]
85
+ if isinstance(_oauthomitempty, Unset):
86
+ oauthomitempty = UNSET
87
+ else:
88
+ oauthomitempty = FormOauthomitempty.from_dict(_oauthomitempty)
89
+
90
+ _secrets = d.pop("secrets", UNSET)
91
+ secrets: Union[Unset, FormSecrets]
92
+ if isinstance(_secrets, Unset):
93
+ secrets = UNSET
94
+ else:
95
+ secrets = FormSecrets.from_dict(_secrets)
96
+
97
+ form = cls(
98
+ config=config,
99
+ oauthomitempty=oauthomitempty,
100
+ secrets=secrets,
101
+ )
102
+
103
+ form.additional_properties = d
104
+ return form
105
+
106
+ @property
107
+ def additional_keys(self) -> list[str]:
108
+ return list(self.additional_properties.keys())
109
+
110
+ def __getitem__(self, key: str) -> Any:
111
+ return self.additional_properties[key]
112
+
113
+ def __setitem__(self, key: str, value: Any) -> None:
114
+ self.additional_properties[key] = value
115
+
116
+ def __delitem__(self, key: str) -> None:
117
+ del self.additional_properties[key]
118
+
119
+ def __contains__(self, key: str) -> bool:
120
+ return key in self.additional_properties
@@ -0,0 +1,45 @@
1
+ from typing import Any, TypeVar
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ T = TypeVar("T", bound="FormConfig")
7
+
8
+
9
+ @_attrs_define
10
+ class FormConfig:
11
+ """Config of the artifact"""
12
+
13
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
14
+
15
+ def to_dict(self) -> dict[str, Any]:
16
+ field_dict: dict[str, Any] = {}
17
+ field_dict.update(self.additional_properties)
18
+
19
+ return field_dict
20
+
21
+ @classmethod
22
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
23
+ if not src_dict:
24
+ return None
25
+ d = src_dict.copy()
26
+ form_config = cls()
27
+
28
+ form_config.additional_properties = d
29
+ return form_config
30
+
31
+ @property
32
+ def additional_keys(self) -> list[str]:
33
+ return list(self.additional_properties.keys())
34
+
35
+ def __getitem__(self, key: str) -> Any:
36
+ return self.additional_properties[key]
37
+
38
+ def __setitem__(self, key: str, value: Any) -> None:
39
+ self.additional_properties[key] = value
40
+
41
+ def __delitem__(self, key: str) -> None:
42
+ del self.additional_properties[key]
43
+
44
+ def __contains__(self, key: str) -> bool:
45
+ return key in self.additional_properties