syllable-sdk 0.41.23__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 (32) hide show
  1. syllable_sdk/_version.py +3 -3
  2. syllable_sdk/models/__init__.py +406 -3
  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/eventtask.py +98 -0
  12. syllable_sdk/models/eventtaskevents.py +83 -0
  13. syllable_sdk/models/expressiontask.py +150 -0
  14. syllable_sdk/models/expressiontaskevents.py +116 -0
  15. syllable_sdk/models/incrementaction.py +106 -0
  16. syllable_sdk/models/inputparameter.py +106 -0
  17. syllable_sdk/models/jmespathexpression.py +33 -0
  18. syllable_sdk/models/loadtoolfromfiletask.py +112 -0
  19. syllable_sdk/models/nextstep.py +97 -0
  20. syllable_sdk/models/saveaction.py +103 -0
  21. syllable_sdk/models/sayaction.py +108 -0
  22. syllable_sdk/models/session.py +7 -0
  23. syllable_sdk/models/setvalueaction.py +140 -0
  24. syllable_sdk/models/step.py +65 -0
  25. syllable_sdk/models/stepeventactions.py +145 -0
  26. syllable_sdk/models/stepstask.py +98 -0
  27. syllable_sdk/models/steptools.py +67 -0
  28. syllable_sdk/models/tooldefinition.py +11 -3
  29. syllable_sdk/models/variable.py +149 -0
  30. {syllable_sdk-0.41.23.dist-info → syllable_sdk-0.43.1.dist-info}/METADATA +1 -1
  31. {syllable_sdk-0.41.23.dist-info → syllable_sdk-0.43.1.dist-info}/RECORD +32 -7
  32. {syllable_sdk-0.41.23.dist-info → syllable_sdk-0.43.1.dist-info}/WHEEL +0 -0
@@ -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 .eventtaskevents import EventTaskEvents, EventTaskEventsTypedDict
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 EventTaskTypedDict(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["event"]
31
+ version: Literal["v1alpha"]
32
+ on: NotRequired[EventTaskEventsTypedDict]
33
+
34
+
35
+ class EventTask(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["event"]], AfterValidator(validate_const("event"))],
49
+ pydantic.Field(alias="type"),
50
+ ] = "event"
51
+
52
+ VERSION: Annotated[
53
+ Annotated[
54
+ Optional[Literal["v1alpha"]], AfterValidator(validate_const("v1alpha"))
55
+ ],
56
+ pydantic.Field(alias="version"),
57
+ ] = "v1alpha"
58
+
59
+ on: Optional[EventTaskEvents] = 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
+ "on",
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,83 @@
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
+ EventTaskEventsStartTypedDict = TypeAliasType(
23
+ "EventTaskEventsStartTypedDict",
24
+ Union[
25
+ SayActionTypedDict,
26
+ SaveActionTypedDict,
27
+ IncrementActionTypedDict,
28
+ SetValueActionTypedDict,
29
+ CallActionTypedDict,
30
+ ],
31
+ )
32
+
33
+
34
+ EventTaskEventsStart = 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
+ class EventTaskEventsTypedDict(TypedDict):
47
+ start: NotRequired[Nullable[List[EventTaskEventsStartTypedDict]]]
48
+ r"""Actions to execute on the first input from the user."""
49
+
50
+
51
+ class EventTaskEvents(BaseModel):
52
+ start: OptionalNullable[List[EventTaskEventsStart]] = UNSET
53
+ r"""Actions to execute on the first input from the user."""
54
+
55
+ @model_serializer(mode="wrap")
56
+ def serialize_model(self, handler):
57
+ optional_fields = ["start"]
58
+ nullable_fields = ["start"]
59
+ null_default_fields = []
60
+
61
+ serialized = handler(self)
62
+
63
+ m = {}
64
+
65
+ for n, f in type(self).model_fields.items():
66
+ k = f.alias or n
67
+ val = serialized.get(k)
68
+ serialized.pop(k, None)
69
+
70
+ optional_nullable = k in optional_fields and k in nullable_fields
71
+ is_set = (
72
+ self.__pydantic_fields_set__.intersection({n})
73
+ or k in null_default_fields
74
+ ) # pylint: disable=no-member
75
+
76
+ if val is not None and val != UNSET_SENTINEL:
77
+ m[k] = val
78
+ elif val != UNSET_SENTINEL and (
79
+ not k in optional_fields or (optional_nullable and is_set)
80
+ ):
81
+ m[k] = val
82
+
83
+ return m
@@ -0,0 +1,150 @@
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 .contexttaskmetadata import ContextTaskMetadata, ContextTaskMetadataTypedDict
7
+ from .contexttoolinfo import ContextToolInfo, ContextToolInfoTypedDict
8
+ from .expressiontaskevents import ExpressionTaskEvents, ExpressionTaskEventsTypedDict
9
+ from .inputparameter import InputParameter, InputParameterTypedDict
10
+ from .jmespathexpression import JMESPathExpression, JMESPathExpressionTypedDict
11
+ from .variable import Variable, VariableTypedDict
12
+ import pydantic
13
+ from pydantic import Discriminator, Tag, model_serializer
14
+ from pydantic.functional_validators import AfterValidator
15
+ from syllable_sdk.types import (
16
+ BaseModel,
17
+ Nullable,
18
+ OptionalNullable,
19
+ UNSET,
20
+ UNSET_SENTINEL,
21
+ )
22
+ from syllable_sdk.utils import get_discriminator, validate_const
23
+ from typing import Any, Dict, List, Literal, Optional, Union
24
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
25
+
26
+
27
+ Expression1TypedDict = TypeAliasType(
28
+ "Expression1TypedDict", Union[CelExpressionTypedDict, JMESPathExpressionTypedDict]
29
+ )
30
+
31
+
32
+ Expression1 = Annotated[
33
+ Union[
34
+ Annotated[CelExpression, Tag("cel")],
35
+ Annotated[JMESPathExpression, Tag("jmespath")],
36
+ Annotated[JMESPathExpression, Tag("jp")],
37
+ ],
38
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
39
+ ]
40
+
41
+
42
+ Expression2TypedDict = TypeAliasType(
43
+ "Expression2TypedDict", Union[CaseExpressionTypedDict, Expression1TypedDict, str]
44
+ )
45
+
46
+
47
+ Expression2 = TypeAliasType("Expression2", Union[CaseExpression, Expression1, str])
48
+
49
+
50
+ class ExpressionTaskTypedDict(TypedDict):
51
+ id: NotRequired[Nullable[str]]
52
+ r"""A unique identifier for the task."""
53
+ config: NotRequired[Nullable[Dict[str, Any]]]
54
+ variables: NotRequired[Nullable[List[VariableTypedDict]]]
55
+ metadata: NotRequired[Nullable[ContextTaskMetadataTypedDict]]
56
+ tool: NotRequired[Nullable[ContextToolInfoTypedDict]]
57
+ type: Literal["expression"]
58
+ version: Literal["v1alpha"]
59
+ inputs: NotRequired[List[InputParameterTypedDict]]
60
+ expression: NotRequired[Nullable[Expression2TypedDict]]
61
+ output: NotRequired[Nullable[Any]]
62
+ on: NotRequired[ExpressionTaskEventsTypedDict]
63
+ r"""Actions to perform when events occur (enter, submit)."""
64
+
65
+
66
+ class ExpressionTask(BaseModel):
67
+ id: OptionalNullable[str] = UNSET
68
+ r"""A unique identifier for the task."""
69
+
70
+ config: OptionalNullable[Dict[str, Any]] = UNSET
71
+
72
+ variables: OptionalNullable[List[Variable]] = UNSET
73
+
74
+ metadata: OptionalNullable[ContextTaskMetadata] = UNSET
75
+
76
+ tool: OptionalNullable[ContextToolInfo] = UNSET
77
+
78
+ TYPE: Annotated[
79
+ Annotated[
80
+ Optional[Literal["expression"]],
81
+ AfterValidator(validate_const("expression")),
82
+ ],
83
+ pydantic.Field(alias="type"),
84
+ ] = "expression"
85
+
86
+ VERSION: Annotated[
87
+ Annotated[
88
+ Optional[Literal["v1alpha"]], AfterValidator(validate_const("v1alpha"))
89
+ ],
90
+ pydantic.Field(alias="version"),
91
+ ] = "v1alpha"
92
+
93
+ inputs: Optional[List[InputParameter]] = None
94
+
95
+ expression: OptionalNullable[Expression2] = UNSET
96
+
97
+ output: OptionalNullable[Any] = UNSET
98
+
99
+ on: Optional[ExpressionTaskEvents] = None
100
+ r"""Actions to perform when events occur (enter, submit)."""
101
+
102
+ @model_serializer(mode="wrap")
103
+ def serialize_model(self, handler):
104
+ optional_fields = [
105
+ "id",
106
+ "config",
107
+ "variables",
108
+ "metadata",
109
+ "tool",
110
+ "type",
111
+ "version",
112
+ "inputs",
113
+ "expression",
114
+ "output",
115
+ "on",
116
+ ]
117
+ nullable_fields = [
118
+ "id",
119
+ "config",
120
+ "variables",
121
+ "metadata",
122
+ "tool",
123
+ "expression",
124
+ "output",
125
+ ]
126
+ null_default_fields = []
127
+
128
+ serialized = handler(self)
129
+
130
+ m = {}
131
+
132
+ for n, f in type(self).model_fields.items():
133
+ k = f.alias or n
134
+ val = serialized.get(k)
135
+ serialized.pop(k, None)
136
+
137
+ optional_nullable = k in optional_fields and k in nullable_fields
138
+ is_set = (
139
+ self.__pydantic_fields_set__.intersection({n})
140
+ or k in null_default_fields
141
+ ) # pylint: disable=no-member
142
+
143
+ if val is not None and val != UNSET_SENTINEL:
144
+ m[k] = val
145
+ elif val != UNSET_SENTINEL and (
146
+ not k in optional_fields or (optional_nullable and is_set)
147
+ ):
148
+ m[k] = val
149
+
150
+ return m
@@ -0,0 +1,116 @@
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
+ ExpressionTaskEventsStartTypedDict = TypeAliasType(
23
+ "ExpressionTaskEventsStartTypedDict",
24
+ Union[
25
+ SayActionTypedDict,
26
+ SaveActionTypedDict,
27
+ IncrementActionTypedDict,
28
+ SetValueActionTypedDict,
29
+ CallActionTypedDict,
30
+ ],
31
+ )
32
+
33
+
34
+ ExpressionTaskEventsStart = 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
+ ExpressionTaskEventsSubmitTypedDict = TypeAliasType(
47
+ "ExpressionTaskEventsSubmitTypedDict",
48
+ Union[
49
+ IncrementActionTypedDict,
50
+ SayActionTypedDict,
51
+ SaveActionTypedDict,
52
+ SetValueActionTypedDict,
53
+ CallActionTypedDict,
54
+ ],
55
+ )
56
+
57
+
58
+ ExpressionTaskEventsSubmit = 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
+ class ExpressionTaskEventsTypedDict(TypedDict):
71
+ r"""Actions to perform when events occur (enter, submit)."""
72
+
73
+ start: NotRequired[Nullable[List[ExpressionTaskEventsStartTypedDict]]]
74
+ r"""Actions to execute on the first input from the user."""
75
+ submit: NotRequired[Nullable[List[ExpressionTaskEventsSubmitTypedDict]]]
76
+ r"""Actions to execute when the tool/step is submitted by the LLM."""
77
+
78
+
79
+ class ExpressionTaskEvents(BaseModel):
80
+ r"""Actions to perform when events occur (enter, submit)."""
81
+
82
+ start: OptionalNullable[List[ExpressionTaskEventsStart]] = UNSET
83
+ r"""Actions to execute on the first input from the user."""
84
+
85
+ submit: OptionalNullable[List[ExpressionTaskEventsSubmit]] = UNSET
86
+ r"""Actions to execute when the tool/step is submitted by the LLM."""
87
+
88
+ @model_serializer(mode="wrap")
89
+ def serialize_model(self, handler):
90
+ optional_fields = ["start", "submit"]
91
+ nullable_fields = ["start", "submit"]
92
+ null_default_fields = []
93
+
94
+ serialized = handler(self)
95
+
96
+ m = {}
97
+
98
+ for n, f in type(self).model_fields.items():
99
+ k = f.alias or n
100
+ val = serialized.get(k)
101
+ serialized.pop(k, None)
102
+
103
+ optional_nullable = k in optional_fields and k in nullable_fields
104
+ is_set = (
105
+ self.__pydantic_fields_set__.intersection({n})
106
+ or k in null_default_fields
107
+ ) # pylint: disable=no-member
108
+
109
+ if val is not None and val != UNSET_SENTINEL:
110
+ m[k] = val
111
+ elif val != UNSET_SENTINEL and (
112
+ not k in optional_fields or (optional_nullable and is_set)
113
+ ):
114
+ m[k] = val
115
+
116
+ return m
@@ -0,0 +1,106 @@
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 Literal, Optional, Union
19
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
20
+
21
+
22
+ IncrementActionIf1TypedDict = TypeAliasType(
23
+ "IncrementActionIf1TypedDict",
24
+ Union[CelExpressionTypedDict, JMESPathExpressionTypedDict],
25
+ )
26
+
27
+
28
+ IncrementActionIf1 = 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
+ IncrementActionIf2TypedDict = TypeAliasType(
39
+ "IncrementActionIf2TypedDict",
40
+ Union[CaseExpressionTypedDict, IncrementActionIf1TypedDict, str],
41
+ )
42
+ r"""An expression that must evaluate to true for the action to be applied."""
43
+
44
+
45
+ IncrementActionIf2 = TypeAliasType(
46
+ "IncrementActionIf2", Union[CaseExpression, IncrementActionIf1, str]
47
+ )
48
+ r"""An expression that must evaluate to true for the action to be applied."""
49
+
50
+
51
+ class IncrementActionTypedDict(TypedDict):
52
+ name: str
53
+ r"""Numeric destination path to increment."""
54
+ if_: NotRequired[Nullable[IncrementActionIf2TypedDict]]
55
+ r"""An expression that must evaluate to true for the action to be applied."""
56
+ action: Literal["inc"]
57
+ by: NotRequired[int]
58
+ r"""Increment amount (defaults to 1)."""
59
+
60
+
61
+ class IncrementAction(BaseModel):
62
+ name: str
63
+ r"""Numeric destination path to increment."""
64
+
65
+ if_: Annotated[OptionalNullable[IncrementActionIf2], pydantic.Field(alias="if")] = (
66
+ UNSET
67
+ )
68
+ r"""An expression that must evaluate to true for the action to be applied."""
69
+
70
+ ACTION: Annotated[
71
+ Annotated[Optional[Literal["inc"]], AfterValidator(validate_const("inc"))],
72
+ pydantic.Field(alias="action"),
73
+ ] = "inc"
74
+
75
+ by: Optional[int] = 1
76
+ r"""Increment amount (defaults to 1)."""
77
+
78
+ @model_serializer(mode="wrap")
79
+ def serialize_model(self, handler):
80
+ optional_fields = ["if", "action", "by"]
81
+ nullable_fields = ["if"]
82
+ null_default_fields = []
83
+
84
+ serialized = handler(self)
85
+
86
+ m = {}
87
+
88
+ for n, f in type(self).model_fields.items():
89
+ k = f.alias or n
90
+ val = serialized.get(k)
91
+ serialized.pop(k, None)
92
+
93
+ optional_nullable = k in optional_fields and k in nullable_fields
94
+ is_set = (
95
+ self.__pydantic_fields_set__.intersection({n})
96
+ or k in null_default_fields
97
+ ) # pylint: disable=no-member
98
+
99
+ if val is not None and val != UNSET_SENTINEL:
100
+ m[k] = val
101
+ elif val != UNSET_SENTINEL and (
102
+ not k in optional_fields or (optional_nullable and is_set)
103
+ ):
104
+ m[k] = val
105
+
106
+ return m
@@ -0,0 +1,106 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from enum import Enum
5
+ import pydantic
6
+ from pydantic import model_serializer
7
+ from syllable_sdk.types import (
8
+ BaseModel,
9
+ Nullable,
10
+ OptionalNullable,
11
+ UNSET,
12
+ UNSET_SENTINEL,
13
+ )
14
+ from typing import Any, List, Optional
15
+ from typing_extensions import Annotated, NotRequired, TypedDict
16
+
17
+
18
+ class InputParameterType(str, Enum):
19
+ STRING = "string"
20
+ NUMBER = "number"
21
+ INTEGER = "integer"
22
+ BOOLEAN = "boolean"
23
+ OBJECT = "object"
24
+ ARRAY = "array"
25
+ NULL = "null"
26
+
27
+
28
+ class InputParameterTypedDict(TypedDict):
29
+ name: str
30
+ r"""The name of the property."""
31
+ type: NotRequired[Nullable[InputParameterType]]
32
+ description: NotRequired[Nullable[str]]
33
+ title: NotRequired[Nullable[str]]
34
+ format_: NotRequired[Nullable[str]]
35
+ pattern: NotRequired[Nullable[str]]
36
+ enum: NotRequired[Nullable[List[str]]]
37
+ examples: NotRequired[Nullable[List[Any]]]
38
+ required: NotRequired[bool]
39
+
40
+
41
+ class InputParameter(BaseModel):
42
+ name: str
43
+ r"""The name of the property."""
44
+
45
+ type: OptionalNullable[InputParameterType] = UNSET
46
+
47
+ description: OptionalNullable[str] = UNSET
48
+
49
+ title: OptionalNullable[str] = UNSET
50
+
51
+ format_: Annotated[OptionalNullable[str], pydantic.Field(alias="format")] = UNSET
52
+
53
+ pattern: OptionalNullable[str] = UNSET
54
+
55
+ enum: OptionalNullable[List[str]] = UNSET
56
+
57
+ examples: OptionalNullable[List[Any]] = UNSET
58
+
59
+ required: Optional[bool] = True
60
+
61
+ @model_serializer(mode="wrap")
62
+ def serialize_model(self, handler):
63
+ optional_fields = [
64
+ "type",
65
+ "description",
66
+ "title",
67
+ "format",
68
+ "pattern",
69
+ "enum",
70
+ "examples",
71
+ "required",
72
+ ]
73
+ nullable_fields = [
74
+ "type",
75
+ "description",
76
+ "title",
77
+ "format",
78
+ "pattern",
79
+ "enum",
80
+ "examples",
81
+ ]
82
+ null_default_fields = []
83
+
84
+ serialized = handler(self)
85
+
86
+ m = {}
87
+
88
+ for n, f in type(self).model_fields.items():
89
+ k = f.alias or n
90
+ val = serialized.get(k)
91
+ serialized.pop(k, None)
92
+
93
+ optional_nullable = k in optional_fields and k in nullable_fields
94
+ is_set = (
95
+ self.__pydantic_fields_set__.intersection({n})
96
+ or k in null_default_fields
97
+ ) # pylint: disable=no-member
98
+
99
+ if val is not None and val != UNSET_SENTINEL:
100
+ m[k] = val
101
+ elif val != UNSET_SENTINEL and (
102
+ not k in optional_fields or (optional_nullable and is_set)
103
+ ):
104
+ m[k] = val
105
+
106
+ return m
@@ -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."""