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.
Files changed (36) hide show
  1. syllable_sdk/_version.py +3 -3
  2. syllable_sdk/models/__init__.py +406 -8
  3. syllable_sdk/models/callaction.py +116 -0
  4. syllable_sdk/models/caseexpression.py +17 -0
  5. syllable_sdk/models/celexpression.py +31 -0
  6. syllable_sdk/models/conditionaltext.py +94 -0
  7. syllable_sdk/models/conditionalvalue.py +131 -0
  8. syllable_sdk/models/context.py +112 -0
  9. syllable_sdk/models/contexttaskmetadata.py +55 -0
  10. syllable_sdk/models/contexttoolinfo.py +57 -0
  11. syllable_sdk/models/custommessagecreaterequest.py +1 -7
  12. syllable_sdk/models/custommessageresponse.py +1 -7
  13. syllable_sdk/models/custommessageupdaterequest.py +1 -7
  14. syllable_sdk/models/eventtask.py +98 -0
  15. syllable_sdk/models/eventtaskevents.py +83 -0
  16. syllable_sdk/models/expressiontask.py +150 -0
  17. syllable_sdk/models/expressiontaskevents.py +116 -0
  18. syllable_sdk/models/incrementaction.py +106 -0
  19. syllable_sdk/models/inputparameter.py +106 -0
  20. syllable_sdk/models/jmespathexpression.py +33 -0
  21. syllable_sdk/models/loadtoolfromfiletask.py +112 -0
  22. syllable_sdk/models/nextstep.py +97 -0
  23. syllable_sdk/models/saveaction.py +103 -0
  24. syllable_sdk/models/sayaction.py +108 -0
  25. syllable_sdk/models/session.py +7 -0
  26. syllable_sdk/models/setvalueaction.py +140 -0
  27. syllable_sdk/models/step.py +65 -0
  28. syllable_sdk/models/stepeventactions.py +145 -0
  29. syllable_sdk/models/stepstask.py +98 -0
  30. syllable_sdk/models/steptools.py +67 -0
  31. syllable_sdk/models/tooldefinition.py +11 -3
  32. syllable_sdk/models/variable.py +149 -0
  33. {syllable_sdk-0.41.20.dist-info → syllable_sdk-0.43.1.dist-info}/METADATA +1 -1
  34. {syllable_sdk-0.41.20.dist-info → syllable_sdk-0.43.1.dist-info}/RECORD +35 -11
  35. syllable_sdk/models/custommessageconfig.py +0 -20
  36. {syllable_sdk-0.41.20.dist-info → syllable_sdk-0.43.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,33 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from enum import Enum
5
+ from syllable_sdk.types import BaseModel
6
+ from typing import Optional
7
+ from typing_extensions import NotRequired, TypedDict
8
+
9
+
10
+ class JMESPathExpressionType(str, Enum):
11
+ r"""JMESPath expression."""
12
+
13
+ JP = "jp"
14
+ JMESPATH = "jmespath"
15
+
16
+
17
+ class JMESPathExpressionTypedDict(TypedDict):
18
+ r"""See https://jmespath.org/specification.html#grammar"""
19
+
20
+ expression: str
21
+ r"""The expression to evaluate."""
22
+ type: NotRequired[JMESPathExpressionType]
23
+ r"""JMESPath expression."""
24
+
25
+
26
+ class JMESPathExpression(BaseModel):
27
+ r"""See https://jmespath.org/specification.html#grammar"""
28
+
29
+ expression: str
30
+ r"""The expression to evaluate."""
31
+
32
+ type: Optional[JMESPathExpressionType] = JMESPathExpressionType.JP
33
+ r"""JMESPath expression."""
@@ -0,0 +1,112 @@
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 .variable import Variable, VariableTypedDict
7
+ import pydantic
8
+ from pydantic import model_serializer
9
+ from pydantic.functional_validators import AfterValidator
10
+ from syllable_sdk.types import (
11
+ BaseModel,
12
+ Nullable,
13
+ OptionalNullable,
14
+ UNSET,
15
+ UNSET_SENTINEL,
16
+ )
17
+ from syllable_sdk.utils import validate_const
18
+ from typing import Any, Dict, List, Literal, Optional, Union
19
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
20
+
21
+
22
+ FileTypedDict = TypeAliasType("FileTypedDict", Union[str, List[str]])
23
+ r"""The local path of the tool definition JSON file."""
24
+
25
+
26
+ File = TypeAliasType("File", Union[str, List[str]])
27
+ r"""The local path of the tool definition JSON file."""
28
+
29
+
30
+ class LoadToolFromFileTaskTypedDict(TypedDict):
31
+ r"""Bootstraps a tool from a file (for internal developer use only if ENV.local=True)."""
32
+
33
+ file: FileTypedDict
34
+ r"""The local path of the tool definition JSON file."""
35
+ id: NotRequired[Nullable[str]]
36
+ r"""A unique identifier for the task."""
37
+ config: NotRequired[Nullable[Dict[str, Any]]]
38
+ variables: NotRequired[Nullable[List[VariableTypedDict]]]
39
+ metadata: NotRequired[Nullable[ContextTaskMetadataTypedDict]]
40
+ tool: NotRequired[Nullable[ContextToolInfoTypedDict]]
41
+ type: Literal["import"]
42
+ version: Literal["v1alpha"]
43
+
44
+
45
+ class LoadToolFromFileTask(BaseModel):
46
+ r"""Bootstraps a tool from a file (for internal developer use only if ENV.local=True)."""
47
+
48
+ file: File
49
+ r"""The local path of the tool definition JSON file."""
50
+
51
+ id: OptionalNullable[str] = UNSET
52
+ r"""A unique identifier for the task."""
53
+
54
+ config: OptionalNullable[Dict[str, Any]] = UNSET
55
+
56
+ variables: OptionalNullable[List[Variable]] = UNSET
57
+
58
+ metadata: OptionalNullable[ContextTaskMetadata] = UNSET
59
+
60
+ tool: OptionalNullable[ContextToolInfo] = UNSET
61
+
62
+ TYPE: Annotated[
63
+ Annotated[
64
+ Optional[Literal["import"]], AfterValidator(validate_const("import"))
65
+ ],
66
+ pydantic.Field(alias="type"),
67
+ ] = "import"
68
+
69
+ VERSION: Annotated[
70
+ Annotated[
71
+ Optional[Literal["v1alpha"]], AfterValidator(validate_const("v1alpha"))
72
+ ],
73
+ pydantic.Field(alias="version"),
74
+ ] = "v1alpha"
75
+
76
+ @model_serializer(mode="wrap")
77
+ def serialize_model(self, handler):
78
+ optional_fields = [
79
+ "id",
80
+ "config",
81
+ "variables",
82
+ "metadata",
83
+ "tool",
84
+ "type",
85
+ "version",
86
+ ]
87
+ nullable_fields = ["id", "config", "variables", "metadata", "tool"]
88
+ null_default_fields = []
89
+
90
+ serialized = handler(self)
91
+
92
+ m = {}
93
+
94
+ for n, f in type(self).model_fields.items():
95
+ k = f.alias or n
96
+ val = serialized.get(k)
97
+ serialized.pop(k, None)
98
+
99
+ optional_nullable = k in optional_fields and k in nullable_fields
100
+ is_set = (
101
+ self.__pydantic_fields_set__.intersection({n})
102
+ or k in null_default_fields
103
+ ) # pylint: disable=no-member
104
+
105
+ if val is not None and val != UNSET_SENTINEL:
106
+ m[k] = val
107
+ elif val != UNSET_SENTINEL and (
108
+ not k in optional_fields or (optional_nullable and is_set)
109
+ ):
110
+ m[k] = val
111
+
112
+ return m
@@ -0,0 +1,97 @@
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
+ import pydantic
8
+ from pydantic import Discriminator, Tag, model_serializer
9
+ from syllable_sdk.types import (
10
+ BaseModel,
11
+ Nullable,
12
+ OptionalNullable,
13
+ UNSET,
14
+ UNSET_SENTINEL,
15
+ )
16
+ from syllable_sdk.utils import get_discriminator
17
+ from typing import List, Union
18
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
19
+
20
+
21
+ NextStepIf1TypedDict = TypeAliasType(
22
+ "NextStepIf1TypedDict", Union[CelExpressionTypedDict, JMESPathExpressionTypedDict]
23
+ )
24
+
25
+
26
+ NextStepIf1 = Annotated[
27
+ Union[
28
+ Annotated[CelExpression, Tag("cel")],
29
+ Annotated[JMESPathExpression, Tag("jmespath")],
30
+ Annotated[JMESPathExpression, Tag("jp")],
31
+ ],
32
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
33
+ ]
34
+
35
+
36
+ NextStepIf2TypedDict = TypeAliasType(
37
+ "NextStepIf2TypedDict", Union[CaseExpressionTypedDict, NextStepIf1TypedDict, str]
38
+ )
39
+ r"""An expression that must evaluate to true for the action to be applied."""
40
+
41
+
42
+ NextStepIf2 = TypeAliasType("NextStepIf2", Union[CaseExpression, NextStepIf1, str])
43
+ r"""An expression that must evaluate to true for the action to be applied."""
44
+
45
+
46
+ class NextStepTypedDict(TypedDict):
47
+ r"""Represents a conditional transition to the next step."""
48
+
49
+ id: str
50
+ r"""The identifier of the next step."""
51
+ if_: NotRequired[Nullable[NextStepIf2TypedDict]]
52
+ r"""An expression that must evaluate to true for the action to be applied."""
53
+ requires: NotRequired[Nullable[List[str]]]
54
+ r"""List of input field names required for this transition. Validates that specified inputs are collected before allowing transition."""
55
+
56
+
57
+ class NextStep(BaseModel):
58
+ r"""Represents a conditional transition to the next step."""
59
+
60
+ id: str
61
+ r"""The identifier of the next step."""
62
+
63
+ if_: Annotated[OptionalNullable[NextStepIf2], pydantic.Field(alias="if")] = UNSET
64
+ r"""An expression that must evaluate to true for the action to be applied."""
65
+
66
+ requires: OptionalNullable[List[str]] = UNSET
67
+ r"""List of input field names required for this transition. Validates that specified inputs are collected before allowing transition."""
68
+
69
+ @model_serializer(mode="wrap")
70
+ def serialize_model(self, handler):
71
+ optional_fields = ["if", "requires"]
72
+ nullable_fields = ["if", "requires"]
73
+ null_default_fields = []
74
+
75
+ serialized = handler(self)
76
+
77
+ m = {}
78
+
79
+ for n, f in type(self).model_fields.items():
80
+ k = f.alias or n
81
+ val = serialized.get(k)
82
+ serialized.pop(k, None)
83
+
84
+ optional_nullable = k in optional_fields and k in nullable_fields
85
+ is_set = (
86
+ self.__pydantic_fields_set__.intersection({n})
87
+ or k in null_default_fields
88
+ ) # pylint: disable=no-member
89
+
90
+ if val is not None and val != UNSET_SENTINEL:
91
+ m[k] = val
92
+ elif val != UNSET_SENTINEL and (
93
+ not k in optional_fields or (optional_nullable and is_set)
94
+ ):
95
+ m[k] = val
96
+
97
+ return m
@@ -0,0 +1,103 @@
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
+ import pydantic
8
+ from pydantic import Discriminator, Tag, model_serializer
9
+ from pydantic.functional_validators import AfterValidator
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, validate_const
18
+ from typing import List, Literal, Optional, Union
19
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
20
+
21
+
22
+ SaveActionIf1TypedDict = TypeAliasType(
23
+ "SaveActionIf1TypedDict", Union[CelExpressionTypedDict, JMESPathExpressionTypedDict]
24
+ )
25
+
26
+
27
+ SaveActionIf1 = Annotated[
28
+ Union[
29
+ Annotated[CelExpression, Tag("cel")],
30
+ Annotated[JMESPathExpression, Tag("jmespath")],
31
+ Annotated[JMESPathExpression, Tag("jp")],
32
+ ],
33
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
34
+ ]
35
+
36
+
37
+ SaveActionIf2TypedDict = TypeAliasType(
38
+ "SaveActionIf2TypedDict",
39
+ Union[CaseExpressionTypedDict, SaveActionIf1TypedDict, str],
40
+ )
41
+ r"""An expression that must evaluate to true for the action to be applied."""
42
+
43
+
44
+ SaveActionIf2 = TypeAliasType(
45
+ "SaveActionIf2", Union[CaseExpression, SaveActionIf1, str]
46
+ )
47
+ r"""An expression that must evaluate to true for the action to be applied."""
48
+
49
+
50
+ class SaveActionTypedDict(TypedDict):
51
+ if_: NotRequired[Nullable[SaveActionIf2TypedDict]]
52
+ r"""An expression that must evaluate to true for the action to be applied."""
53
+ action: Literal["save"]
54
+ name: NotRequired[Nullable[str]]
55
+ r"""Target name to save (defaults to global variable)."""
56
+ inputs: NotRequired[Nullable[List[str]]]
57
+ r"""Input field names to persist; None saves all collected inputs."""
58
+
59
+
60
+ class SaveAction(BaseModel):
61
+ if_: Annotated[OptionalNullable[SaveActionIf2], pydantic.Field(alias="if")] = UNSET
62
+ r"""An expression that must evaluate to true for the action to be applied."""
63
+
64
+ ACTION: Annotated[
65
+ Annotated[Optional[Literal["save"]], AfterValidator(validate_const("save"))],
66
+ pydantic.Field(alias="action"),
67
+ ] = "save"
68
+
69
+ name: OptionalNullable[str] = UNSET
70
+ r"""Target name to save (defaults to global variable)."""
71
+
72
+ inputs: OptionalNullable[List[str]] = UNSET
73
+ r"""Input field names to persist; None saves all collected inputs."""
74
+
75
+ @model_serializer(mode="wrap")
76
+ def serialize_model(self, handler):
77
+ optional_fields = ["if", "action", "name", "inputs"]
78
+ nullable_fields = ["if", "name", "inputs"]
79
+ null_default_fields = []
80
+
81
+ serialized = handler(self)
82
+
83
+ m = {}
84
+
85
+ for n, f in type(self).model_fields.items():
86
+ k = f.alias or n
87
+ val = serialized.get(k)
88
+ serialized.pop(k, None)
89
+
90
+ optional_nullable = k in optional_fields and k in nullable_fields
91
+ is_set = (
92
+ self.__pydantic_fields_set__.intersection({n})
93
+ or k in null_default_fields
94
+ ) # pylint: disable=no-member
95
+
96
+ if val is not None and val != UNSET_SENTINEL:
97
+ m[k] = val
98
+ elif val != UNSET_SENTINEL and (
99
+ not k in optional_fields or (optional_nullable and is_set)
100
+ ):
101
+ m[k] = val
102
+
103
+ return m
@@ -0,0 +1,108 @@
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 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 get_discriminator, validate_const
19
+ from typing import Literal, Optional, Union
20
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
21
+
22
+
23
+ SayActionIf1TypedDict = TypeAliasType(
24
+ "SayActionIf1TypedDict", Union[CelExpressionTypedDict, JMESPathExpressionTypedDict]
25
+ )
26
+
27
+
28
+ SayActionIf1 = 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
+ SayActionIf2TypedDict = TypeAliasType(
39
+ "SayActionIf2TypedDict", Union[CaseExpressionTypedDict, SayActionIf1TypedDict, str]
40
+ )
41
+ r"""An expression that must evaluate to true for the action to be applied."""
42
+
43
+
44
+ SayActionIf2 = TypeAliasType("SayActionIf2", Union[CaseExpression, SayActionIf1, str])
45
+ r"""An expression that must evaluate to true for the action to be applied."""
46
+
47
+
48
+ class Role(str, Enum):
49
+ r"""The role of the message."""
50
+
51
+ USER = "user"
52
+ ASSISTANT = "assistant"
53
+
54
+
55
+ class SayActionTypedDict(TypedDict):
56
+ text: str
57
+ r"""Text to apply if the condition is true."""
58
+ if_: NotRequired[Nullable[SayActionIf2TypedDict]]
59
+ r"""An expression that must evaluate to true for the action to be applied."""
60
+ action: Literal["say"]
61
+ role: NotRequired[Role]
62
+ r"""The role of the message."""
63
+
64
+
65
+ class SayAction(BaseModel):
66
+ text: str
67
+ r"""Text to apply if the condition is true."""
68
+
69
+ if_: Annotated[OptionalNullable[SayActionIf2], pydantic.Field(alias="if")] = UNSET
70
+ r"""An expression that must evaluate to true for the action to be applied."""
71
+
72
+ ACTION: Annotated[
73
+ Annotated[Optional[Literal["say"]], AfterValidator(validate_const("say"))],
74
+ pydantic.Field(alias="action"),
75
+ ] = "say"
76
+
77
+ role: Optional[Role] = Role.ASSISTANT
78
+ r"""The role of the message."""
79
+
80
+ @model_serializer(mode="wrap")
81
+ def serialize_model(self, handler):
82
+ optional_fields = ["if", "action", "role"]
83
+ nullable_fields = ["if"]
84
+ null_default_fields = []
85
+
86
+ serialized = handler(self)
87
+
88
+ m = {}
89
+
90
+ for n, f in type(self).model_fields.items():
91
+ k = f.alias or n
92
+ val = serialized.get(k)
93
+ serialized.pop(k, None)
94
+
95
+ optional_nullable = k in optional_fields and k in nullable_fields
96
+ is_set = (
97
+ self.__pydantic_fields_set__.intersection({n})
98
+ or k in null_default_fields
99
+ ) # pylint: disable=no-member
100
+
101
+ if val is not None and val != UNSET_SENTINEL:
102
+ m[k] = val
103
+ elif val != UNSET_SENTINEL and (
104
+ not k in optional_fields or (optional_nullable and is_set)
105
+ ):
106
+ m[k] = val
107
+
108
+ return m
@@ -56,6 +56,8 @@ class SessionTypedDict(TypedDict):
56
56
  r"""Whether the session occurred on the legacy Syllable system"""
57
57
  is_test: NotRequired[Nullable[bool]]
58
58
  r"""Whether the session is a test session"""
59
+ user_terminated: NotRequired[Nullable[bool]]
60
+ r"""Whether the voice session was ended by the recipient (outbound) / caller (inbound). False if the user was transferred or there was an error. Unset if the session was not a voice session."""
59
61
 
60
62
 
61
63
  class Session(BaseModel):
@@ -121,6 +123,9 @@ class Session(BaseModel):
121
123
  is_test: OptionalNullable[bool] = UNSET
122
124
  r"""Whether the session is a test session"""
123
125
 
126
+ user_terminated: OptionalNullable[bool] = UNSET
127
+ r"""Whether the voice session was ended by the recipient (outbound) / caller (inbound). False if the user was transferred or there was an error. Unset if the session was not a voice session."""
128
+
124
129
  @model_serializer(mode="wrap")
125
130
  def serialize_model(self, handler):
126
131
  optional_fields = [
@@ -143,6 +148,7 @@ class Session(BaseModel):
143
148
  "target",
144
149
  "is_legacy",
145
150
  "is_test",
151
+ "user_terminated",
146
152
  ]
147
153
  nullable_fields = [
148
154
  "session_id",
@@ -164,6 +170,7 @@ class Session(BaseModel):
164
170
  "target",
165
171
  "is_legacy",
166
172
  "is_test",
173
+ "user_terminated",
167
174
  ]
168
175
  null_default_fields = []
169
176
 
@@ -0,0 +1,140 @@
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
+ import pydantic
8
+ from pydantic import Discriminator, Tag, model_serializer
9
+ from pydantic.functional_validators import AfterValidator
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, validate_const
18
+ from typing import Any, Literal, Optional, Union
19
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
20
+
21
+
22
+ SetValueActionValueFrom1TypedDict = TypeAliasType(
23
+ "SetValueActionValueFrom1TypedDict",
24
+ Union[CelExpressionTypedDict, JMESPathExpressionTypedDict],
25
+ )
26
+
27
+
28
+ SetValueActionValueFrom1 = 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
+ SetValueActionValueFrom2TypedDict = TypeAliasType(
39
+ "SetValueActionValueFrom2TypedDict",
40
+ Union[CaseExpressionTypedDict, SetValueActionValueFrom1TypedDict, str],
41
+ )
42
+ r"""Expression to compute initial value (mutually exclusive with value)."""
43
+
44
+
45
+ SetValueActionValueFrom2 = TypeAliasType(
46
+ "SetValueActionValueFrom2", Union[CaseExpression, SetValueActionValueFrom1, str]
47
+ )
48
+ r"""Expression to compute initial value (mutually exclusive with value)."""
49
+
50
+
51
+ SetValueActionIf1TypedDict = TypeAliasType(
52
+ "SetValueActionIf1TypedDict",
53
+ Union[CelExpressionTypedDict, JMESPathExpressionTypedDict],
54
+ )
55
+
56
+
57
+ SetValueActionIf1 = Annotated[
58
+ Union[
59
+ Annotated[CelExpression, Tag("cel")],
60
+ Annotated[JMESPathExpression, Tag("jmespath")],
61
+ Annotated[JMESPathExpression, Tag("jp")],
62
+ ],
63
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
64
+ ]
65
+
66
+
67
+ SetValueActionIf2TypedDict = TypeAliasType(
68
+ "SetValueActionIf2TypedDict",
69
+ Union[CaseExpressionTypedDict, SetValueActionIf1TypedDict, str],
70
+ )
71
+ r"""An expression that must evaluate to true for the action to be applied."""
72
+
73
+
74
+ SetValueActionIf2 = TypeAliasType(
75
+ "SetValueActionIf2", Union[CaseExpression, SetValueActionIf1, str]
76
+ )
77
+ r"""An expression that must evaluate to true for the action to be applied."""
78
+
79
+
80
+ class SetValueActionTypedDict(TypedDict):
81
+ name: str
82
+ r"""Destination path to mutate (e.g. output.foo)."""
83
+ value: NotRequired[Nullable[Any]]
84
+ r"""Initial value of the variable."""
85
+ value_from: NotRequired[Nullable[SetValueActionValueFrom2TypedDict]]
86
+ r"""Expression to compute initial value (mutually exclusive with value)."""
87
+ if_: NotRequired[Nullable[SetValueActionIf2TypedDict]]
88
+ r"""An expression that must evaluate to true for the action to be applied."""
89
+ action: Literal["set"]
90
+
91
+
92
+ class SetValueAction(BaseModel):
93
+ name: str
94
+ r"""Destination path to mutate (e.g. output.foo)."""
95
+
96
+ value: OptionalNullable[Any] = UNSET
97
+ r"""Initial value of the variable."""
98
+
99
+ value_from: OptionalNullable[SetValueActionValueFrom2] = UNSET
100
+ r"""Expression to compute initial value (mutually exclusive with value)."""
101
+
102
+ if_: Annotated[OptionalNullable[SetValueActionIf2], pydantic.Field(alias="if")] = (
103
+ UNSET
104
+ )
105
+ r"""An expression that must evaluate to true for the action to be applied."""
106
+
107
+ ACTION: Annotated[
108
+ Annotated[Optional[Literal["set"]], AfterValidator(validate_const("set"))],
109
+ pydantic.Field(alias="action"),
110
+ ] = "set"
111
+
112
+ @model_serializer(mode="wrap")
113
+ def serialize_model(self, handler):
114
+ optional_fields = ["value", "value_from", "if", "action"]
115
+ nullable_fields = ["value", "value_from", "if"]
116
+ null_default_fields = []
117
+
118
+ serialized = handler(self)
119
+
120
+ m = {}
121
+
122
+ for n, f in type(self).model_fields.items():
123
+ k = f.alias or n
124
+ val = serialized.get(k)
125
+ serialized.pop(k, None)
126
+
127
+ optional_nullable = k in optional_fields and k in nullable_fields
128
+ is_set = (
129
+ self.__pydantic_fields_set__.intersection({n})
130
+ or k in null_default_fields
131
+ ) # pylint: disable=no-member
132
+
133
+ if val is not None and val != UNSET_SENTINEL:
134
+ m[k] = val
135
+ elif val != UNSET_SENTINEL and (
136
+ not k in optional_fields or (optional_nullable and is_set)
137
+ ):
138
+ m[k] = val
139
+
140
+ return m
@@ -0,0 +1,65 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .conditionaltext import ConditionalText, ConditionalTextTypedDict
5
+ from .inputparameter import InputParameter, InputParameterTypedDict
6
+ from .nextstep import NextStep, NextStepTypedDict
7
+ from .stepeventactions import StepEventActions, StepEventActionsTypedDict
8
+ from .steptools import StepTools, StepToolsTypedDict
9
+ from syllable_sdk.types import BaseModel
10
+ from typing import List, Optional, Union
11
+ from typing_extensions import NotRequired, TypeAliasType, TypedDict
12
+
13
+
14
+ InstructionTypedDict = TypeAliasType(
15
+ "InstructionTypedDict", Union[ConditionalTextTypedDict, str]
16
+ )
17
+
18
+
19
+ Instruction = TypeAliasType("Instruction", Union[ConditionalText, str])
20
+
21
+
22
+ NextTypedDict = TypeAliasType("NextTypedDict", Union[NextStepTypedDict, str])
23
+
24
+
25
+ Next = TypeAliasType("Next", Union[NextStep, str])
26
+
27
+
28
+ class StepTypedDict(TypedDict):
29
+ id: str
30
+ r"""The unique identifier of the step."""
31
+ goal: str
32
+ r"""The goal of the step."""
33
+ instructions: NotRequired[List[InstructionTypedDict]]
34
+ r"""The instructions for the step."""
35
+ tools: NotRequired[StepToolsTypedDict]
36
+ r"""Configuration for tools available in a step."""
37
+ inputs: NotRequired[List[InputParameterTypedDict]]
38
+ r"""The inputs for the step."""
39
+ on: NotRequired[StepEventActionsTypedDict]
40
+ r"""Actions to perform when events occur (enter, submit)."""
41
+ next: NotRequired[List[NextTypedDict]]
42
+ r"""The next steps to execute."""
43
+
44
+
45
+ class Step(BaseModel):
46
+ id: str
47
+ r"""The unique identifier of the step."""
48
+
49
+ goal: str
50
+ r"""The goal of the step."""
51
+
52
+ instructions: Optional[List[Instruction]] = None
53
+ r"""The instructions for the step."""
54
+
55
+ tools: Optional[StepTools] = None
56
+ r"""Configuration for tools available in a step."""
57
+
58
+ inputs: Optional[List[InputParameter]] = None
59
+ r"""The inputs for the step."""
60
+
61
+ on: Optional[StepEventActions] = None
62
+ r"""Actions to perform when events occur (enter, submit)."""
63
+
64
+ next: Optional[List[Next]] = None
65
+ r"""The next steps to execute."""