syllable-sdk 0.41.20__py3-none-any.whl → 0.43.1__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.
- syllable_sdk/_version.py +3 -3
- syllable_sdk/models/__init__.py +406 -8
- syllable_sdk/models/callaction.py +116 -0
- syllable_sdk/models/caseexpression.py +17 -0
- syllable_sdk/models/celexpression.py +31 -0
- syllable_sdk/models/conditionaltext.py +94 -0
- syllable_sdk/models/conditionalvalue.py +131 -0
- syllable_sdk/models/context.py +112 -0
- syllable_sdk/models/contexttaskmetadata.py +55 -0
- syllable_sdk/models/contexttoolinfo.py +57 -0
- syllable_sdk/models/custommessagecreaterequest.py +1 -7
- syllable_sdk/models/custommessageresponse.py +1 -7
- syllable_sdk/models/custommessageupdaterequest.py +1 -7
- syllable_sdk/models/eventtask.py +98 -0
- syllable_sdk/models/eventtaskevents.py +83 -0
- syllable_sdk/models/expressiontask.py +150 -0
- syllable_sdk/models/expressiontaskevents.py +116 -0
- syllable_sdk/models/incrementaction.py +106 -0
- syllable_sdk/models/inputparameter.py +106 -0
- syllable_sdk/models/jmespathexpression.py +33 -0
- syllable_sdk/models/loadtoolfromfiletask.py +112 -0
- syllable_sdk/models/nextstep.py +97 -0
- syllable_sdk/models/saveaction.py +103 -0
- syllable_sdk/models/sayaction.py +108 -0
- syllable_sdk/models/session.py +7 -0
- syllable_sdk/models/setvalueaction.py +140 -0
- syllable_sdk/models/step.py +65 -0
- syllable_sdk/models/stepeventactions.py +145 -0
- syllable_sdk/models/stepstask.py +98 -0
- syllable_sdk/models/steptools.py +67 -0
- syllable_sdk/models/tooldefinition.py +11 -3
- syllable_sdk/models/variable.py +149 -0
- {syllable_sdk-0.41.20.dist-info → syllable_sdk-0.43.1.dist-info}/METADATA +1 -1
- {syllable_sdk-0.41.20.dist-info → syllable_sdk-0.43.1.dist-info}/RECORD +35 -11
- syllable_sdk/models/custommessageconfig.py +0 -20
- {syllable_sdk-0.41.20.dist-info → syllable_sdk-0.43.1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .callaction import CallAction, CallActionTypedDict
|
|
5
|
+
from .incrementaction import IncrementAction, IncrementActionTypedDict
|
|
6
|
+
from .saveaction import SaveAction, SaveActionTypedDict
|
|
7
|
+
from .sayaction import SayAction, SayActionTypedDict
|
|
8
|
+
from .setvalueaction import SetValueAction, SetValueActionTypedDict
|
|
9
|
+
from pydantic import Discriminator, Tag, model_serializer
|
|
10
|
+
from syllable_sdk.types import (
|
|
11
|
+
BaseModel,
|
|
12
|
+
Nullable,
|
|
13
|
+
OptionalNullable,
|
|
14
|
+
UNSET,
|
|
15
|
+
UNSET_SENTINEL,
|
|
16
|
+
)
|
|
17
|
+
from syllable_sdk.utils import get_discriminator
|
|
18
|
+
from typing import List, Union
|
|
19
|
+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
StepEventActionsStartTypedDict = TypeAliasType(
|
|
23
|
+
"StepEventActionsStartTypedDict",
|
|
24
|
+
Union[
|
|
25
|
+
SayActionTypedDict,
|
|
26
|
+
SaveActionTypedDict,
|
|
27
|
+
IncrementActionTypedDict,
|
|
28
|
+
SetValueActionTypedDict,
|
|
29
|
+
CallActionTypedDict,
|
|
30
|
+
],
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
StepEventActionsStart = Annotated[
|
|
35
|
+
Union[
|
|
36
|
+
Annotated[CallAction, Tag("call")],
|
|
37
|
+
Annotated[IncrementAction, Tag("inc")],
|
|
38
|
+
Annotated[SaveAction, Tag("save")],
|
|
39
|
+
Annotated[SayAction, Tag("say")],
|
|
40
|
+
Annotated[SetValueAction, Tag("set")],
|
|
41
|
+
],
|
|
42
|
+
Discriminator(lambda m: get_discriminator(m, "action", "action")),
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
EnterTypedDict = TypeAliasType(
|
|
47
|
+
"EnterTypedDict",
|
|
48
|
+
Union[
|
|
49
|
+
IncrementActionTypedDict,
|
|
50
|
+
SayActionTypedDict,
|
|
51
|
+
SaveActionTypedDict,
|
|
52
|
+
SetValueActionTypedDict,
|
|
53
|
+
CallActionTypedDict,
|
|
54
|
+
],
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
Enter = Annotated[
|
|
59
|
+
Union[
|
|
60
|
+
Annotated[CallAction, Tag("call")],
|
|
61
|
+
Annotated[IncrementAction, Tag("inc")],
|
|
62
|
+
Annotated[SaveAction, Tag("save")],
|
|
63
|
+
Annotated[SayAction, Tag("say")],
|
|
64
|
+
Annotated[SetValueAction, Tag("set")],
|
|
65
|
+
],
|
|
66
|
+
Discriminator(lambda m: get_discriminator(m, "action", "action")),
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
StepEventActionsSubmitTypedDict = TypeAliasType(
|
|
71
|
+
"StepEventActionsSubmitTypedDict",
|
|
72
|
+
Union[
|
|
73
|
+
IncrementActionTypedDict,
|
|
74
|
+
SayActionTypedDict,
|
|
75
|
+
SaveActionTypedDict,
|
|
76
|
+
SetValueActionTypedDict,
|
|
77
|
+
CallActionTypedDict,
|
|
78
|
+
],
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
StepEventActionsSubmit = Annotated[
|
|
83
|
+
Union[
|
|
84
|
+
Annotated[CallAction, Tag("call")],
|
|
85
|
+
Annotated[IncrementAction, Tag("inc")],
|
|
86
|
+
Annotated[SaveAction, Tag("save")],
|
|
87
|
+
Annotated[SayAction, Tag("say")],
|
|
88
|
+
Annotated[SetValueAction, Tag("set")],
|
|
89
|
+
],
|
|
90
|
+
Discriminator(lambda m: get_discriminator(m, "action", "action")),
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class StepEventActionsTypedDict(TypedDict):
|
|
95
|
+
r"""Actions to perform when events occur (enter, submit)."""
|
|
96
|
+
|
|
97
|
+
start: NotRequired[Nullable[List[StepEventActionsStartTypedDict]]]
|
|
98
|
+
r"""Actions to execute on the first input from the user."""
|
|
99
|
+
enter: NotRequired[Nullable[List[EnterTypedDict]]]
|
|
100
|
+
r"""Actions to execute when entering a step (before collecting inputs)."""
|
|
101
|
+
submit: NotRequired[Nullable[List[StepEventActionsSubmitTypedDict]]]
|
|
102
|
+
r"""Actions to execute when the tool/step is submitted by the LLM."""
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class StepEventActions(BaseModel):
|
|
106
|
+
r"""Actions to perform when events occur (enter, submit)."""
|
|
107
|
+
|
|
108
|
+
start: OptionalNullable[List[StepEventActionsStart]] = UNSET
|
|
109
|
+
r"""Actions to execute on the first input from the user."""
|
|
110
|
+
|
|
111
|
+
enter: OptionalNullable[List[Enter]] = UNSET
|
|
112
|
+
r"""Actions to execute when entering a step (before collecting inputs)."""
|
|
113
|
+
|
|
114
|
+
submit: OptionalNullable[List[StepEventActionsSubmit]] = UNSET
|
|
115
|
+
r"""Actions to execute when the tool/step is submitted by the LLM."""
|
|
116
|
+
|
|
117
|
+
@model_serializer(mode="wrap")
|
|
118
|
+
def serialize_model(self, handler):
|
|
119
|
+
optional_fields = ["start", "enter", "submit"]
|
|
120
|
+
nullable_fields = ["start", "enter", "submit"]
|
|
121
|
+
null_default_fields = []
|
|
122
|
+
|
|
123
|
+
serialized = handler(self)
|
|
124
|
+
|
|
125
|
+
m = {}
|
|
126
|
+
|
|
127
|
+
for n, f in type(self).model_fields.items():
|
|
128
|
+
k = f.alias or n
|
|
129
|
+
val = serialized.get(k)
|
|
130
|
+
serialized.pop(k, None)
|
|
131
|
+
|
|
132
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
133
|
+
is_set = (
|
|
134
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
135
|
+
or k in null_default_fields
|
|
136
|
+
) # pylint: disable=no-member
|
|
137
|
+
|
|
138
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
139
|
+
m[k] = val
|
|
140
|
+
elif val != UNSET_SENTINEL and (
|
|
141
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
142
|
+
):
|
|
143
|
+
m[k] = val
|
|
144
|
+
|
|
145
|
+
return m
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .contexttaskmetadata import ContextTaskMetadata, ContextTaskMetadataTypedDict
|
|
5
|
+
from .contexttoolinfo import ContextToolInfo, ContextToolInfoTypedDict
|
|
6
|
+
from .step import Step, StepTypedDict
|
|
7
|
+
from .variable import Variable, VariableTypedDict
|
|
8
|
+
import pydantic
|
|
9
|
+
from pydantic import model_serializer
|
|
10
|
+
from pydantic.functional_validators import AfterValidator
|
|
11
|
+
from syllable_sdk.types import (
|
|
12
|
+
BaseModel,
|
|
13
|
+
Nullable,
|
|
14
|
+
OptionalNullable,
|
|
15
|
+
UNSET,
|
|
16
|
+
UNSET_SENTINEL,
|
|
17
|
+
)
|
|
18
|
+
from syllable_sdk.utils import validate_const
|
|
19
|
+
from typing import Any, Dict, List, Literal, Optional
|
|
20
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class StepsTaskTypedDict(TypedDict):
|
|
24
|
+
id: NotRequired[Nullable[str]]
|
|
25
|
+
r"""A unique identifier for the task."""
|
|
26
|
+
config: NotRequired[Nullable[Dict[str, Any]]]
|
|
27
|
+
variables: NotRequired[Nullable[List[VariableTypedDict]]]
|
|
28
|
+
metadata: NotRequired[Nullable[ContextTaskMetadataTypedDict]]
|
|
29
|
+
tool: NotRequired[Nullable[ContextToolInfoTypedDict]]
|
|
30
|
+
type: Literal["steps"]
|
|
31
|
+
version: Literal["v1alpha"]
|
|
32
|
+
steps: NotRequired[List[StepTypedDict]]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class StepsTask(BaseModel):
|
|
36
|
+
id: OptionalNullable[str] = UNSET
|
|
37
|
+
r"""A unique identifier for the task."""
|
|
38
|
+
|
|
39
|
+
config: OptionalNullable[Dict[str, Any]] = UNSET
|
|
40
|
+
|
|
41
|
+
variables: OptionalNullable[List[Variable]] = UNSET
|
|
42
|
+
|
|
43
|
+
metadata: OptionalNullable[ContextTaskMetadata] = UNSET
|
|
44
|
+
|
|
45
|
+
tool: OptionalNullable[ContextToolInfo] = UNSET
|
|
46
|
+
|
|
47
|
+
TYPE: Annotated[
|
|
48
|
+
Annotated[Optional[Literal["steps"]], AfterValidator(validate_const("steps"))],
|
|
49
|
+
pydantic.Field(alias="type"),
|
|
50
|
+
] = "steps"
|
|
51
|
+
|
|
52
|
+
VERSION: Annotated[
|
|
53
|
+
Annotated[
|
|
54
|
+
Optional[Literal["v1alpha"]], AfterValidator(validate_const("v1alpha"))
|
|
55
|
+
],
|
|
56
|
+
pydantic.Field(alias="version"),
|
|
57
|
+
] = "v1alpha"
|
|
58
|
+
|
|
59
|
+
steps: Optional[List[Step]] = None
|
|
60
|
+
|
|
61
|
+
@model_serializer(mode="wrap")
|
|
62
|
+
def serialize_model(self, handler):
|
|
63
|
+
optional_fields = [
|
|
64
|
+
"id",
|
|
65
|
+
"config",
|
|
66
|
+
"variables",
|
|
67
|
+
"metadata",
|
|
68
|
+
"tool",
|
|
69
|
+
"type",
|
|
70
|
+
"version",
|
|
71
|
+
"steps",
|
|
72
|
+
]
|
|
73
|
+
nullable_fields = ["id", "config", "variables", "metadata", "tool"]
|
|
74
|
+
null_default_fields = []
|
|
75
|
+
|
|
76
|
+
serialized = handler(self)
|
|
77
|
+
|
|
78
|
+
m = {}
|
|
79
|
+
|
|
80
|
+
for n, f in type(self).model_fields.items():
|
|
81
|
+
k = f.alias or n
|
|
82
|
+
val = serialized.get(k)
|
|
83
|
+
serialized.pop(k, None)
|
|
84
|
+
|
|
85
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
86
|
+
is_set = (
|
|
87
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
88
|
+
or k in null_default_fields
|
|
89
|
+
) # pylint: disable=no-member
|
|
90
|
+
|
|
91
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
92
|
+
m[k] = val
|
|
93
|
+
elif val != UNSET_SENTINEL and (
|
|
94
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
95
|
+
):
|
|
96
|
+
m[k] = val
|
|
97
|
+
|
|
98
|
+
return m
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from pydantic import model_serializer
|
|
5
|
+
from syllable_sdk.types import (
|
|
6
|
+
BaseModel,
|
|
7
|
+
Nullable,
|
|
8
|
+
OptionalNullable,
|
|
9
|
+
UNSET,
|
|
10
|
+
UNSET_SENTINEL,
|
|
11
|
+
)
|
|
12
|
+
from typing import List
|
|
13
|
+
from typing_extensions import NotRequired, TypedDict
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class StepToolsTypedDict(TypedDict):
|
|
17
|
+
r"""Configuration for tools available in a step."""
|
|
18
|
+
|
|
19
|
+
call: NotRequired[Nullable[bool]]
|
|
20
|
+
r"""Whether to force immediate tool call without user interaction."""
|
|
21
|
+
allow: NotRequired[Nullable[List[str]]]
|
|
22
|
+
r"""List of allowed tool names for this step."""
|
|
23
|
+
allow_go_to_step: NotRequired[Nullable[bool]]
|
|
24
|
+
r"""Whether to expose the go_to_step escape hatch to the LLM. Defaults to disabled."""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class StepTools(BaseModel):
|
|
28
|
+
r"""Configuration for tools available in a step."""
|
|
29
|
+
|
|
30
|
+
call: OptionalNullable[bool] = UNSET
|
|
31
|
+
r"""Whether to force immediate tool call without user interaction."""
|
|
32
|
+
|
|
33
|
+
allow: OptionalNullable[List[str]] = UNSET
|
|
34
|
+
r"""List of allowed tool names for this step."""
|
|
35
|
+
|
|
36
|
+
allow_go_to_step: OptionalNullable[bool] = UNSET
|
|
37
|
+
r"""Whether to expose the go_to_step escape hatch to the LLM. Defaults to disabled."""
|
|
38
|
+
|
|
39
|
+
@model_serializer(mode="wrap")
|
|
40
|
+
def serialize_model(self, handler):
|
|
41
|
+
optional_fields = ["call", "allow", "allow_go_to_step"]
|
|
42
|
+
nullable_fields = ["call", "allow", "allow_go_to_step"]
|
|
43
|
+
null_default_fields = []
|
|
44
|
+
|
|
45
|
+
serialized = handler(self)
|
|
46
|
+
|
|
47
|
+
m = {}
|
|
48
|
+
|
|
49
|
+
for n, f in type(self).model_fields.items():
|
|
50
|
+
k = f.alias or n
|
|
51
|
+
val = serialized.get(k)
|
|
52
|
+
serialized.pop(k, None)
|
|
53
|
+
|
|
54
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
55
|
+
is_set = (
|
|
56
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
57
|
+
or k in null_default_fields
|
|
58
|
+
) # pylint: disable=no-member
|
|
59
|
+
|
|
60
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
61
|
+
m[k] = val
|
|
62
|
+
elif val != UNSET_SENTINEL and (
|
|
63
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
64
|
+
):
|
|
65
|
+
m[k] = val
|
|
66
|
+
|
|
67
|
+
return m
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .context import Context, ContextTypedDict
|
|
4
5
|
from .internaltool import InternalTool, InternalToolTypedDict
|
|
5
6
|
from .statictoolparameter import StaticToolParameter, StaticToolParameterTypedDict
|
|
6
7
|
from .toolhttpendpoint import ToolHTTPEndpoint, ToolHTTPEndpointTypedDict
|
|
@@ -19,7 +20,7 @@ from typing import Any, Dict, List, Union
|
|
|
19
20
|
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
class
|
|
23
|
+
class ToolDefinitionType(str, Enum):
|
|
23
24
|
ACTION = "action"
|
|
24
25
|
ENDPOINT = "endpoint"
|
|
25
26
|
CONTEXT = "context"
|
|
@@ -41,10 +42,12 @@ class ToolDefinitionTypedDict(TypedDict):
|
|
|
41
42
|
|
|
42
43
|
tool: InternalToolTypedDict
|
|
43
44
|
r"""A tool definition to be used by the OpenAI API."""
|
|
44
|
-
type: NotRequired[Nullable[
|
|
45
|
+
type: NotRequired[Nullable[ToolDefinitionType]]
|
|
45
46
|
r"""The action to take when the LLM calls the tool."""
|
|
46
47
|
endpoint: NotRequired[Nullable[ToolHTTPEndpointTypedDict]]
|
|
47
48
|
r"""The configuration for an HTTP API call."""
|
|
49
|
+
context: NotRequired[Nullable[ContextTypedDict]]
|
|
50
|
+
r"""The configuration for a context tool."""
|
|
48
51
|
defaults: NotRequired[Nullable[DefaultsTypedDict]]
|
|
49
52
|
r"""The default values for the parameters of the function/tool call."""
|
|
50
53
|
static_parameters: NotRequired[Nullable[List[StaticToolParameterTypedDict]]]
|
|
@@ -61,12 +64,15 @@ class ToolDefinition(BaseModel):
|
|
|
61
64
|
tool: InternalTool
|
|
62
65
|
r"""A tool definition to be used by the OpenAI API."""
|
|
63
66
|
|
|
64
|
-
type: OptionalNullable[
|
|
67
|
+
type: OptionalNullable[ToolDefinitionType] = UNSET
|
|
65
68
|
r"""The action to take when the LLM calls the tool."""
|
|
66
69
|
|
|
67
70
|
endpoint: OptionalNullable[ToolHTTPEndpoint] = UNSET
|
|
68
71
|
r"""The configuration for an HTTP API call."""
|
|
69
72
|
|
|
73
|
+
context: OptionalNullable[Context] = UNSET
|
|
74
|
+
r"""The configuration for a context tool."""
|
|
75
|
+
|
|
70
76
|
defaults: OptionalNullable[Defaults] = UNSET
|
|
71
77
|
r"""The default values for the parameters of the function/tool call."""
|
|
72
78
|
|
|
@@ -84,6 +90,7 @@ class ToolDefinition(BaseModel):
|
|
|
84
90
|
optional_fields = [
|
|
85
91
|
"type",
|
|
86
92
|
"endpoint",
|
|
93
|
+
"context",
|
|
87
94
|
"defaults",
|
|
88
95
|
"static_parameters",
|
|
89
96
|
"result",
|
|
@@ -92,6 +99,7 @@ class ToolDefinition(BaseModel):
|
|
|
92
99
|
nullable_fields = [
|
|
93
100
|
"type",
|
|
94
101
|
"endpoint",
|
|
102
|
+
"context",
|
|
95
103
|
"defaults",
|
|
96
104
|
"static_parameters",
|
|
97
105
|
"result",
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .caseexpression import CaseExpression, CaseExpressionTypedDict
|
|
5
|
+
from .celexpression import CelExpression, CelExpressionTypedDict
|
|
6
|
+
from .jmespathexpression import JMESPathExpression, JMESPathExpressionTypedDict
|
|
7
|
+
from enum import Enum
|
|
8
|
+
import pydantic
|
|
9
|
+
from pydantic import Discriminator, Tag, model_serializer
|
|
10
|
+
from syllable_sdk.types import (
|
|
11
|
+
BaseModel,
|
|
12
|
+
Nullable,
|
|
13
|
+
OptionalNullable,
|
|
14
|
+
UNSET,
|
|
15
|
+
UNSET_SENTINEL,
|
|
16
|
+
)
|
|
17
|
+
from syllable_sdk.utils import get_discriminator
|
|
18
|
+
from typing import Any, List, Union
|
|
19
|
+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
VariableValueFrom1TypedDict = TypeAliasType(
|
|
23
|
+
"VariableValueFrom1TypedDict",
|
|
24
|
+
Union[CelExpressionTypedDict, JMESPathExpressionTypedDict],
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
VariableValueFrom1 = Annotated[
|
|
29
|
+
Union[
|
|
30
|
+
Annotated[CelExpression, Tag("cel")],
|
|
31
|
+
Annotated[JMESPathExpression, Tag("jmespath")],
|
|
32
|
+
Annotated[JMESPathExpression, Tag("jp")],
|
|
33
|
+
],
|
|
34
|
+
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
VariableValueFrom2TypedDict = TypeAliasType(
|
|
39
|
+
"VariableValueFrom2TypedDict",
|
|
40
|
+
Union[CaseExpressionTypedDict, VariableValueFrom1TypedDict, str],
|
|
41
|
+
)
|
|
42
|
+
r"""Expression to compute initial value (mutually exclusive with value)."""
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
VariableValueFrom2 = TypeAliasType(
|
|
46
|
+
"VariableValueFrom2", Union[CaseExpression, VariableValueFrom1, str]
|
|
47
|
+
)
|
|
48
|
+
r"""Expression to compute initial value (mutually exclusive with value)."""
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class VariableType(str, Enum):
|
|
52
|
+
STRING = "string"
|
|
53
|
+
NUMBER = "number"
|
|
54
|
+
INTEGER = "integer"
|
|
55
|
+
BOOLEAN = "boolean"
|
|
56
|
+
OBJECT = "object"
|
|
57
|
+
ARRAY = "array"
|
|
58
|
+
NULL = "null"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class VariableTypedDict(TypedDict):
|
|
62
|
+
name: str
|
|
63
|
+
r"""The name of the property."""
|
|
64
|
+
value: NotRequired[Nullable[Any]]
|
|
65
|
+
r"""Initial value of the variable."""
|
|
66
|
+
value_from: NotRequired[Nullable[VariableValueFrom2TypedDict]]
|
|
67
|
+
r"""Expression to compute initial value (mutually exclusive with value)."""
|
|
68
|
+
type: NotRequired[Nullable[VariableType]]
|
|
69
|
+
description: NotRequired[Nullable[str]]
|
|
70
|
+
title: NotRequired[Nullable[str]]
|
|
71
|
+
format_: NotRequired[Nullable[str]]
|
|
72
|
+
pattern: NotRequired[Nullable[str]]
|
|
73
|
+
enum: NotRequired[Nullable[List[str]]]
|
|
74
|
+
examples: NotRequired[Nullable[List[Any]]]
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class Variable(BaseModel):
|
|
78
|
+
name: str
|
|
79
|
+
r"""The name of the property."""
|
|
80
|
+
|
|
81
|
+
value: OptionalNullable[Any] = UNSET
|
|
82
|
+
r"""Initial value of the variable."""
|
|
83
|
+
|
|
84
|
+
value_from: OptionalNullable[VariableValueFrom2] = UNSET
|
|
85
|
+
r"""Expression to compute initial value (mutually exclusive with value)."""
|
|
86
|
+
|
|
87
|
+
type: OptionalNullable[VariableType] = UNSET
|
|
88
|
+
|
|
89
|
+
description: OptionalNullable[str] = UNSET
|
|
90
|
+
|
|
91
|
+
title: OptionalNullable[str] = UNSET
|
|
92
|
+
|
|
93
|
+
format_: Annotated[OptionalNullable[str], pydantic.Field(alias="format")] = UNSET
|
|
94
|
+
|
|
95
|
+
pattern: OptionalNullable[str] = UNSET
|
|
96
|
+
|
|
97
|
+
enum: OptionalNullable[List[str]] = UNSET
|
|
98
|
+
|
|
99
|
+
examples: OptionalNullable[List[Any]] = UNSET
|
|
100
|
+
|
|
101
|
+
@model_serializer(mode="wrap")
|
|
102
|
+
def serialize_model(self, handler):
|
|
103
|
+
optional_fields = [
|
|
104
|
+
"value",
|
|
105
|
+
"value_from",
|
|
106
|
+
"type",
|
|
107
|
+
"description",
|
|
108
|
+
"title",
|
|
109
|
+
"format",
|
|
110
|
+
"pattern",
|
|
111
|
+
"enum",
|
|
112
|
+
"examples",
|
|
113
|
+
]
|
|
114
|
+
nullable_fields = [
|
|
115
|
+
"value",
|
|
116
|
+
"value_from",
|
|
117
|
+
"type",
|
|
118
|
+
"description",
|
|
119
|
+
"title",
|
|
120
|
+
"format",
|
|
121
|
+
"pattern",
|
|
122
|
+
"enum",
|
|
123
|
+
"examples",
|
|
124
|
+
]
|
|
125
|
+
null_default_fields = []
|
|
126
|
+
|
|
127
|
+
serialized = handler(self)
|
|
128
|
+
|
|
129
|
+
m = {}
|
|
130
|
+
|
|
131
|
+
for n, f in type(self).model_fields.items():
|
|
132
|
+
k = f.alias or n
|
|
133
|
+
val = serialized.get(k)
|
|
134
|
+
serialized.pop(k, None)
|
|
135
|
+
|
|
136
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
137
|
+
is_set = (
|
|
138
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
139
|
+
or k in null_default_fields
|
|
140
|
+
) # pylint: disable=no-member
|
|
141
|
+
|
|
142
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
143
|
+
m[k] = val
|
|
144
|
+
elif val != UNSET_SENTINEL and (
|
|
145
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
146
|
+
):
|
|
147
|
+
m[k] = val
|
|
148
|
+
|
|
149
|
+
return m
|