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.
- syllable_sdk/_version.py +3 -3
- syllable_sdk/models/__init__.py +406 -3
- 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/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.23.dist-info → syllable_sdk-0.43.1.dist-info}/METADATA +1 -1
- {syllable_sdk-0.41.23.dist-info → syllable_sdk-0.43.1.dist-info}/RECORD +32 -7
- {syllable_sdk-0.41.23.dist-info → syllable_sdk-0.43.1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,116 @@
|
|
|
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, Dict, Literal, Optional, Union
|
|
19
|
+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
CallActionIf1TypedDict = TypeAliasType(
|
|
23
|
+
"CallActionIf1TypedDict", Union[CelExpressionTypedDict, JMESPathExpressionTypedDict]
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
CallActionIf1 = 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
|
+
CallActionIf2TypedDict = TypeAliasType(
|
|
38
|
+
"CallActionIf2TypedDict",
|
|
39
|
+
Union[CaseExpressionTypedDict, CallActionIf1TypedDict, str],
|
|
40
|
+
)
|
|
41
|
+
r"""An expression that must evaluate to true for the action to be applied."""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
CallActionIf2 = TypeAliasType(
|
|
45
|
+
"CallActionIf2", Union[CaseExpression, CallActionIf1, str]
|
|
46
|
+
)
|
|
47
|
+
r"""An expression that must evaluate to true for the action to be applied."""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
AutoPopulateTypedDict = TypeAliasType("AutoPopulateTypedDict", Union[bool, str])
|
|
51
|
+
r"""Auto-population strategy: True (hybrid - synthetic or LLM), False (always LLM), \"required\" (synthetic only if all required args available, else LLM)"""
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
AutoPopulate = TypeAliasType("AutoPopulate", Union[bool, str])
|
|
55
|
+
r"""Auto-population strategy: True (hybrid - synthetic or LLM), False (always LLM), \"required\" (synthetic only if all required args available, else LLM)"""
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class CallActionTypedDict(TypedDict):
|
|
59
|
+
name: str
|
|
60
|
+
r"""The name of the tool to call."""
|
|
61
|
+
if_: NotRequired[Nullable[CallActionIf2TypedDict]]
|
|
62
|
+
r"""An expression that must evaluate to true for the action to be applied."""
|
|
63
|
+
action: Literal["call"]
|
|
64
|
+
arguments: NotRequired[Nullable[Dict[str, Any]]]
|
|
65
|
+
r"""Optional arguments to pass to the tool (supports template strings)"""
|
|
66
|
+
auto_populate: NotRequired[AutoPopulateTypedDict]
|
|
67
|
+
r"""Auto-population strategy: True (hybrid - synthetic or LLM), False (always LLM), \"required\" (synthetic only if all required args available, else LLM)"""
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class CallAction(BaseModel):
|
|
71
|
+
name: str
|
|
72
|
+
r"""The name of the tool to call."""
|
|
73
|
+
|
|
74
|
+
if_: Annotated[OptionalNullable[CallActionIf2], pydantic.Field(alias="if")] = UNSET
|
|
75
|
+
r"""An expression that must evaluate to true for the action to be applied."""
|
|
76
|
+
|
|
77
|
+
ACTION: Annotated[
|
|
78
|
+
Annotated[Optional[Literal["call"]], AfterValidator(validate_const("call"))],
|
|
79
|
+
pydantic.Field(alias="action"),
|
|
80
|
+
] = "call"
|
|
81
|
+
|
|
82
|
+
arguments: OptionalNullable[Dict[str, Any]] = UNSET
|
|
83
|
+
r"""Optional arguments to pass to the tool (supports template strings)"""
|
|
84
|
+
|
|
85
|
+
auto_populate: Optional[AutoPopulate] = None
|
|
86
|
+
r"""Auto-population strategy: True (hybrid - synthetic or LLM), False (always LLM), \"required\" (synthetic only if all required args available, else LLM)"""
|
|
87
|
+
|
|
88
|
+
@model_serializer(mode="wrap")
|
|
89
|
+
def serialize_model(self, handler):
|
|
90
|
+
optional_fields = ["if", "action", "arguments", "auto_populate"]
|
|
91
|
+
nullable_fields = ["if", "arguments"]
|
|
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,17 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from syllable_sdk.types import BaseModel
|
|
5
|
+
from typing import List, TYPE_CHECKING
|
|
6
|
+
from typing_extensions import TypedDict
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from .conditionalvalue import ConditionalValue, ConditionalValueTypedDict
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CaseExpressionTypedDict(TypedDict):
|
|
13
|
+
case: List["ConditionalValueTypedDict"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class CaseExpression(BaseModel):
|
|
17
|
+
case: List["ConditionalValue"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
import pydantic
|
|
5
|
+
from pydantic.functional_validators import AfterValidator
|
|
6
|
+
from syllable_sdk.types import BaseModel
|
|
7
|
+
from syllable_sdk.utils import validate_const
|
|
8
|
+
from typing import Literal, Optional
|
|
9
|
+
from typing_extensions import Annotated, TypedDict
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CelExpressionTypedDict(TypedDict):
|
|
13
|
+
r"""See https://github.com/google/cel-spec/blob/master/doc/langdef.md"""
|
|
14
|
+
|
|
15
|
+
expression: str
|
|
16
|
+
r"""The expression to evaluate."""
|
|
17
|
+
type: Literal["cel"]
|
|
18
|
+
r"""Google Common Expression Language."""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class CelExpression(BaseModel):
|
|
22
|
+
r"""See https://github.com/google/cel-spec/blob/master/doc/langdef.md"""
|
|
23
|
+
|
|
24
|
+
expression: str
|
|
25
|
+
r"""The expression to evaluate."""
|
|
26
|
+
|
|
27
|
+
TYPE: Annotated[
|
|
28
|
+
Annotated[Optional[Literal["cel"]], AfterValidator(validate_const("cel"))],
|
|
29
|
+
pydantic.Field(alias="type"),
|
|
30
|
+
] = "cel"
|
|
31
|
+
r"""Google Common Expression Language."""
|
|
@@ -0,0 +1,94 @@
|
|
|
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 Union
|
|
18
|
+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
ConditionalTextIf1TypedDict = TypeAliasType(
|
|
22
|
+
"ConditionalTextIf1TypedDict",
|
|
23
|
+
Union[CelExpressionTypedDict, JMESPathExpressionTypedDict],
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
ConditionalTextIf1 = 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
|
+
ConditionalTextIf2TypedDict = TypeAliasType(
|
|
38
|
+
"ConditionalTextIf2TypedDict",
|
|
39
|
+
Union[CaseExpressionTypedDict, ConditionalTextIf1TypedDict, str],
|
|
40
|
+
)
|
|
41
|
+
r"""An expression that must evaluate to true for the action to be applied."""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
ConditionalTextIf2 = TypeAliasType(
|
|
45
|
+
"ConditionalTextIf2", Union[CaseExpression, ConditionalTextIf1, str]
|
|
46
|
+
)
|
|
47
|
+
r"""An expression that must evaluate to true for the action to be applied."""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class ConditionalTextTypedDict(TypedDict):
|
|
51
|
+
text: str
|
|
52
|
+
r"""Text to apply if the condition is true."""
|
|
53
|
+
if_: NotRequired[Nullable[ConditionalTextIf2TypedDict]]
|
|
54
|
+
r"""An expression that must evaluate to true for the action to be applied."""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class ConditionalText(BaseModel):
|
|
58
|
+
text: str
|
|
59
|
+
r"""Text to apply if the condition is true."""
|
|
60
|
+
|
|
61
|
+
if_: Annotated[OptionalNullable[ConditionalTextIf2], pydantic.Field(alias="if")] = (
|
|
62
|
+
UNSET
|
|
63
|
+
)
|
|
64
|
+
r"""An expression that must evaluate to true for the action to be applied."""
|
|
65
|
+
|
|
66
|
+
@model_serializer(mode="wrap")
|
|
67
|
+
def serialize_model(self, handler):
|
|
68
|
+
optional_fields = ["if"]
|
|
69
|
+
nullable_fields = ["if"]
|
|
70
|
+
null_default_fields = []
|
|
71
|
+
|
|
72
|
+
serialized = handler(self)
|
|
73
|
+
|
|
74
|
+
m = {}
|
|
75
|
+
|
|
76
|
+
for n, f in type(self).model_fields.items():
|
|
77
|
+
k = f.alias or n
|
|
78
|
+
val = serialized.get(k)
|
|
79
|
+
serialized.pop(k, None)
|
|
80
|
+
|
|
81
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
82
|
+
is_set = (
|
|
83
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
84
|
+
or k in null_default_fields
|
|
85
|
+
) # pylint: disable=no-member
|
|
86
|
+
|
|
87
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
88
|
+
m[k] = val
|
|
89
|
+
elif val != UNSET_SENTINEL and (
|
|
90
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
91
|
+
):
|
|
92
|
+
m[k] = val
|
|
93
|
+
|
|
94
|
+
return m
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .celexpression import CelExpression, CelExpressionTypedDict
|
|
5
|
+
from .jmespathexpression import JMESPathExpression, JMESPathExpressionTypedDict
|
|
6
|
+
import pydantic
|
|
7
|
+
from pydantic import Discriminator, Tag, model_serializer
|
|
8
|
+
from syllable_sdk.types import (
|
|
9
|
+
BaseModel,
|
|
10
|
+
Nullable,
|
|
11
|
+
OptionalNullable,
|
|
12
|
+
UNSET,
|
|
13
|
+
UNSET_SENTINEL,
|
|
14
|
+
)
|
|
15
|
+
from syllable_sdk.utils import get_discriminator
|
|
16
|
+
from typing import Any, TYPE_CHECKING, Union
|
|
17
|
+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
18
|
+
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from .caseexpression import CaseExpression, CaseExpressionTypedDict
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
ConditionalValueValueFrom1TypedDict = TypeAliasType(
|
|
24
|
+
"ConditionalValueValueFrom1TypedDict",
|
|
25
|
+
Union[CelExpressionTypedDict, JMESPathExpressionTypedDict],
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
ConditionalValueValueFrom1 = Annotated[
|
|
30
|
+
Union[
|
|
31
|
+
Annotated[CelExpression, Tag("cel")],
|
|
32
|
+
Annotated[JMESPathExpression, Tag("jmespath")],
|
|
33
|
+
Annotated[JMESPathExpression, Tag("jp")],
|
|
34
|
+
],
|
|
35
|
+
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
ConditionalValueIf1TypedDict = TypeAliasType(
|
|
40
|
+
"ConditionalValueIf1TypedDict",
|
|
41
|
+
Union[CelExpressionTypedDict, JMESPathExpressionTypedDict],
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
ConditionalValueIf1 = Annotated[
|
|
46
|
+
Union[
|
|
47
|
+
Annotated[CelExpression, Tag("cel")],
|
|
48
|
+
Annotated[JMESPathExpression, Tag("jmespath")],
|
|
49
|
+
Annotated[JMESPathExpression, Tag("jp")],
|
|
50
|
+
],
|
|
51
|
+
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
ConditionalValueIf2TypedDict = TypeAliasType(
|
|
56
|
+
"ConditionalValueIf2TypedDict",
|
|
57
|
+
Union["CaseExpressionTypedDict", ConditionalValueIf1TypedDict, str],
|
|
58
|
+
)
|
|
59
|
+
r"""An expression that must evaluate to true for the action to be applied."""
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
ConditionalValueIf2 = TypeAliasType(
|
|
63
|
+
"ConditionalValueIf2", Union["CaseExpression", ConditionalValueIf1, str]
|
|
64
|
+
)
|
|
65
|
+
r"""An expression that must evaluate to true for the action to be applied."""
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class ConditionalValueTypedDict(TypedDict):
|
|
69
|
+
value: NotRequired[Nullable[Any]]
|
|
70
|
+
r"""Initial value of the variable."""
|
|
71
|
+
value_from: NotRequired[Nullable[ConditionalValueValueFrom2TypedDict]]
|
|
72
|
+
r"""Expression to compute initial value (mutually exclusive with value)."""
|
|
73
|
+
if_: NotRequired[Nullable[ConditionalValueIf2TypedDict]]
|
|
74
|
+
r"""An expression that must evaluate to true for the action to be applied."""
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class ConditionalValue(BaseModel):
|
|
78
|
+
value: OptionalNullable[Any] = UNSET
|
|
79
|
+
r"""Initial value of the variable."""
|
|
80
|
+
|
|
81
|
+
value_from: OptionalNullable[ConditionalValueValueFrom2] = UNSET
|
|
82
|
+
r"""Expression to compute initial value (mutually exclusive with value)."""
|
|
83
|
+
|
|
84
|
+
if_: Annotated[
|
|
85
|
+
OptionalNullable[ConditionalValueIf2], pydantic.Field(alias="if")
|
|
86
|
+
] = UNSET
|
|
87
|
+
r"""An expression that must evaluate to true for the action to be applied."""
|
|
88
|
+
|
|
89
|
+
@model_serializer(mode="wrap")
|
|
90
|
+
def serialize_model(self, handler):
|
|
91
|
+
optional_fields = ["value", "value_from", "if"]
|
|
92
|
+
nullable_fields = ["value", "value_from", "if"]
|
|
93
|
+
null_default_fields = []
|
|
94
|
+
|
|
95
|
+
serialized = handler(self)
|
|
96
|
+
|
|
97
|
+
m = {}
|
|
98
|
+
|
|
99
|
+
for n, f in type(self).model_fields.items():
|
|
100
|
+
k = f.alias or n
|
|
101
|
+
val = serialized.get(k)
|
|
102
|
+
serialized.pop(k, None)
|
|
103
|
+
|
|
104
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
105
|
+
is_set = (
|
|
106
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
107
|
+
or k in null_default_fields
|
|
108
|
+
) # pylint: disable=no-member
|
|
109
|
+
|
|
110
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
111
|
+
m[k] = val
|
|
112
|
+
elif val != UNSET_SENTINEL and (
|
|
113
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
114
|
+
):
|
|
115
|
+
m[k] = val
|
|
116
|
+
|
|
117
|
+
return m
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
ConditionalValueValueFrom2TypedDict = TypeAliasType(
|
|
121
|
+
"ConditionalValueValueFrom2TypedDict",
|
|
122
|
+
Union["CaseExpressionTypedDict", ConditionalValueValueFrom1TypedDict, str],
|
|
123
|
+
)
|
|
124
|
+
r"""Expression to compute initial value (mutually exclusive with value)."""
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
ConditionalValueValueFrom2 = TypeAliasType(
|
|
128
|
+
"ConditionalValueValueFrom2",
|
|
129
|
+
Union["CaseExpression", ConditionalValueValueFrom1, str],
|
|
130
|
+
)
|
|
131
|
+
r"""Expression to compute initial value (mutually exclusive with value)."""
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .eventtask import EventTask, EventTaskTypedDict
|
|
5
|
+
from .expressiontask import ExpressionTask, ExpressionTaskTypedDict
|
|
6
|
+
from .loadtoolfromfiletask import LoadToolFromFileTask, LoadToolFromFileTaskTypedDict
|
|
7
|
+
from .stepstask import StepsTask, StepsTaskTypedDict
|
|
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
|
+
Task2TypedDict = TypeAliasType(
|
|
22
|
+
"Task2TypedDict",
|
|
23
|
+
Union[
|
|
24
|
+
LoadToolFromFileTaskTypedDict,
|
|
25
|
+
EventTaskTypedDict,
|
|
26
|
+
StepsTaskTypedDict,
|
|
27
|
+
ExpressionTaskTypedDict,
|
|
28
|
+
],
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
Task2 = Annotated[
|
|
33
|
+
Union[
|
|
34
|
+
Annotated[EventTask, Tag("event")],
|
|
35
|
+
Annotated[ExpressionTask, Tag("expression")],
|
|
36
|
+
Annotated[LoadToolFromFileTask, Tag("import")],
|
|
37
|
+
Annotated[StepsTask, Tag("steps")],
|
|
38
|
+
],
|
|
39
|
+
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
Task1TypedDict = TypeAliasType(
|
|
44
|
+
"Task1TypedDict",
|
|
45
|
+
Union[
|
|
46
|
+
LoadToolFromFileTaskTypedDict,
|
|
47
|
+
EventTaskTypedDict,
|
|
48
|
+
StepsTaskTypedDict,
|
|
49
|
+
ExpressionTaskTypedDict,
|
|
50
|
+
],
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
Task1 = Annotated[
|
|
55
|
+
Union[
|
|
56
|
+
Annotated[EventTask, Tag("event")],
|
|
57
|
+
Annotated[ExpressionTask, Tag("expression")],
|
|
58
|
+
Annotated[LoadToolFromFileTask, Tag("import")],
|
|
59
|
+
Annotated[StepsTask, Tag("steps")],
|
|
60
|
+
],
|
|
61
|
+
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
Task3TypedDict = TypeAliasType(
|
|
66
|
+
"Task3TypedDict", Union[Task1TypedDict, List[Task2TypedDict]]
|
|
67
|
+
)
|
|
68
|
+
r"""Task implementation details"""
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
Task3 = TypeAliasType("Task3", Union[Task1, List[Task2]])
|
|
72
|
+
r"""Task implementation details"""
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class ContextTypedDict(TypedDict):
|
|
76
|
+
task: NotRequired[Nullable[Task3TypedDict]]
|
|
77
|
+
r"""Task implementation details"""
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class Context(BaseModel):
|
|
81
|
+
task: OptionalNullable[Task3] = UNSET
|
|
82
|
+
r"""Task implementation details"""
|
|
83
|
+
|
|
84
|
+
@model_serializer(mode="wrap")
|
|
85
|
+
def serialize_model(self, handler):
|
|
86
|
+
optional_fields = ["task"]
|
|
87
|
+
nullable_fields = ["task"]
|
|
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,55 @@
|
|
|
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_extensions import NotRequired, TypedDict
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ContextTaskMetadataTypedDict(TypedDict):
|
|
16
|
+
priority: NotRequired[Nullable[int]]
|
|
17
|
+
parent_tool_name: NotRequired[Nullable[str]]
|
|
18
|
+
r"""Name of the ToolDefinition that defined this task"""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ContextTaskMetadata(BaseModel):
|
|
22
|
+
priority: OptionalNullable[int] = UNSET
|
|
23
|
+
|
|
24
|
+
parent_tool_name: OptionalNullable[str] = UNSET
|
|
25
|
+
r"""Name of the ToolDefinition that defined this task"""
|
|
26
|
+
|
|
27
|
+
@model_serializer(mode="wrap")
|
|
28
|
+
def serialize_model(self, handler):
|
|
29
|
+
optional_fields = ["priority", "parent_tool_name"]
|
|
30
|
+
nullable_fields = ["priority", "parent_tool_name"]
|
|
31
|
+
null_default_fields = []
|
|
32
|
+
|
|
33
|
+
serialized = handler(self)
|
|
34
|
+
|
|
35
|
+
m = {}
|
|
36
|
+
|
|
37
|
+
for n, f in type(self).model_fields.items():
|
|
38
|
+
k = f.alias or n
|
|
39
|
+
val = serialized.get(k)
|
|
40
|
+
serialized.pop(k, None)
|
|
41
|
+
|
|
42
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
43
|
+
is_set = (
|
|
44
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
45
|
+
or k in null_default_fields
|
|
46
|
+
) # pylint: disable=no-member
|
|
47
|
+
|
|
48
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
49
|
+
m[k] = val
|
|
50
|
+
elif val != UNSET_SENTINEL and (
|
|
51
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
52
|
+
):
|
|
53
|
+
m[k] = val
|
|
54
|
+
|
|
55
|
+
return m
|
|
@@ -0,0 +1,57 @@
|
|
|
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_extensions import NotRequired, TypedDict
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ContextToolInfoTypedDict(TypedDict):
|
|
16
|
+
name: NotRequired[Nullable[str]]
|
|
17
|
+
r"""The name of the generated tool."""
|
|
18
|
+
description: NotRequired[Nullable[str]]
|
|
19
|
+
r"""The description of the tool."""
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ContextToolInfo(BaseModel):
|
|
23
|
+
name: OptionalNullable[str] = UNSET
|
|
24
|
+
r"""The name of the generated tool."""
|
|
25
|
+
|
|
26
|
+
description: OptionalNullable[str] = UNSET
|
|
27
|
+
r"""The description of the tool."""
|
|
28
|
+
|
|
29
|
+
@model_serializer(mode="wrap")
|
|
30
|
+
def serialize_model(self, handler):
|
|
31
|
+
optional_fields = ["name", "description"]
|
|
32
|
+
nullable_fields = ["name", "description"]
|
|
33
|
+
null_default_fields = []
|
|
34
|
+
|
|
35
|
+
serialized = handler(self)
|
|
36
|
+
|
|
37
|
+
m = {}
|
|
38
|
+
|
|
39
|
+
for n, f in type(self).model_fields.items():
|
|
40
|
+
k = f.alias or n
|
|
41
|
+
val = serialized.get(k)
|
|
42
|
+
serialized.pop(k, None)
|
|
43
|
+
|
|
44
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
45
|
+
is_set = (
|
|
46
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
47
|
+
or k in null_default_fields
|
|
48
|
+
) # pylint: disable=no-member
|
|
49
|
+
|
|
50
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
51
|
+
m[k] = val
|
|
52
|
+
elif val != UNSET_SENTINEL and (
|
|
53
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
54
|
+
):
|
|
55
|
+
m[k] = val
|
|
56
|
+
|
|
57
|
+
return m
|