syllable-sdk 0.41.23__py3-none-any.whl → 0.44.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 (81) hide show
  1. syllable_sdk/_version.py +3 -3
  2. syllable_sdk/agents.py +12 -0
  3. syllable_sdk/basesdk.py +6 -0
  4. syllable_sdk/batches.py +18 -0
  5. syllable_sdk/campaigns.py +10 -0
  6. syllable_sdk/channels.py +8 -0
  7. syllable_sdk/conversation_config.py +411 -0
  8. syllable_sdk/conversations.py +2 -0
  9. syllable_sdk/custom_messages.py +10 -0
  10. syllable_sdk/dashboards.py +12 -0
  11. syllable_sdk/data_sources.py +10 -0
  12. syllable_sdk/directory.py +16 -0
  13. syllable_sdk/events.py +2 -0
  14. syllable_sdk/folders.py +16 -0
  15. syllable_sdk/full_summary.py +2 -0
  16. syllable_sdk/incidents.py +12 -0
  17. syllable_sdk/insights_sdk.py +2 -0
  18. syllable_sdk/insights_tools.py +14 -0
  19. syllable_sdk/language_groups.py +12 -0
  20. syllable_sdk/latency.py +2 -0
  21. syllable_sdk/models/__init__.py +449 -8
  22. syllable_sdk/models/bridgephrasesconfig.py +39 -0
  23. syllable_sdk/models/callaction.py +116 -0
  24. syllable_sdk/models/caseexpression.py +17 -0
  25. syllable_sdk/models/celexpression.py +31 -0
  26. syllable_sdk/models/conditionaltext.py +94 -0
  27. syllable_sdk/models/conditionalvalue.py +131 -0
  28. syllable_sdk/models/context.py +112 -0
  29. syllable_sdk/models/contexttaskmetadata.py +55 -0
  30. syllable_sdk/models/contexttoolinfo.py +57 -0
  31. syllable_sdk/models/eventtask.py +98 -0
  32. syllable_sdk/models/eventtaskevents.py +83 -0
  33. syllable_sdk/models/expressiontask.py +150 -0
  34. syllable_sdk/models/expressiontaskevents.py +116 -0
  35. syllable_sdk/models/get_bridge_phrases_configop.py +64 -0
  36. syllable_sdk/models/incrementaction.py +106 -0
  37. syllable_sdk/models/inputparameter.py +106 -0
  38. syllable_sdk/models/jmespathexpression.py +33 -0
  39. syllable_sdk/models/loadtoolfromfiletask.py +112 -0
  40. syllable_sdk/models/nextstep.py +97 -0
  41. syllable_sdk/models/pronunciationoverridesdictionary.py +6 -3
  42. syllable_sdk/models/saveaction.py +103 -0
  43. syllable_sdk/models/sayaction.py +108 -0
  44. syllable_sdk/models/schemas_cortex_v1_bridge_phrases_dictionarymetadata.py +67 -0
  45. syllable_sdk/models/{dictionarymetadata.py → schemas_tts_v1_pronunciations_dictionarymetadata.py} +2 -2
  46. syllable_sdk/models/session.py +7 -0
  47. syllable_sdk/models/setvalueaction.py +140 -0
  48. syllable_sdk/models/step.py +65 -0
  49. syllable_sdk/models/stepeventactions.py +166 -0
  50. syllable_sdk/models/stepstask.py +98 -0
  51. syllable_sdk/models/steptools.py +67 -0
  52. syllable_sdk/models/tooldefinition.py +11 -3
  53. syllable_sdk/models/update_bridge_phrases_configop.py +71 -0
  54. syllable_sdk/models/variable.py +149 -0
  55. syllable_sdk/numbers.py +6 -0
  56. syllable_sdk/organizations.py +8 -0
  57. syllable_sdk/permissions.py +2 -0
  58. syllable_sdk/prompts.py +14 -0
  59. syllable_sdk/pronunciations.py +18 -4
  60. syllable_sdk/roles.py +10 -0
  61. syllable_sdk/sdk.py +6 -0
  62. syllable_sdk/services.py +10 -0
  63. syllable_sdk/session_debug.py +6 -0
  64. syllable_sdk/session_labels.py +6 -0
  65. syllable_sdk/sessions.py +8 -0
  66. syllable_sdk/takeouts.py +6 -0
  67. syllable_sdk/targets.py +10 -0
  68. syllable_sdk/test.py +2 -0
  69. syllable_sdk/tools.py +10 -0
  70. syllable_sdk/transcript.py +2 -0
  71. syllable_sdk/twilio.py +6 -0
  72. syllable_sdk/users.py +14 -0
  73. syllable_sdk/utils/forms.py +21 -10
  74. syllable_sdk/utils/queryparams.py +14 -2
  75. syllable_sdk/utils/retries.py +69 -5
  76. syllable_sdk/v1.py +14 -0
  77. syllable_sdk/voice_groups.py +12 -0
  78. syllable_sdk/workflows.py +16 -0
  79. {syllable_sdk-0.41.23.dist-info → syllable_sdk-0.44.1.dist-info}/METADATA +6 -1
  80. {syllable_sdk-0.41.23.dist-info → syllable_sdk-0.44.1.dist-info}/RECORD +81 -51
  81. {syllable_sdk-0.41.23.dist-info → syllable_sdk-0.44.1.dist-info}/WHEEL +0 -0
@@ -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, presubmit, 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, presubmit, submit)."""
63
+
64
+ next: Optional[List[Next]] = None
65
+ r"""The next steps to execute."""
@@ -0,0 +1,166 @@
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
+ PresubmitTypedDict = TypeAliasType(
71
+ "PresubmitTypedDict",
72
+ Union[IncrementActionTypedDict, SaveActionTypedDict, SetValueActionTypedDict],
73
+ )
74
+
75
+
76
+ Presubmit = Annotated[
77
+ Union[
78
+ Annotated[IncrementAction, Tag("inc")],
79
+ Annotated[SaveAction, Tag("save")],
80
+ Annotated[SetValueAction, Tag("set")],
81
+ ],
82
+ Discriminator(lambda m: get_discriminator(m, "action", "action")),
83
+ ]
84
+
85
+
86
+ StepEventActionsSubmitTypedDict = TypeAliasType(
87
+ "StepEventActionsSubmitTypedDict",
88
+ Union[
89
+ IncrementActionTypedDict,
90
+ SayActionTypedDict,
91
+ SaveActionTypedDict,
92
+ SetValueActionTypedDict,
93
+ CallActionTypedDict,
94
+ ],
95
+ )
96
+
97
+
98
+ StepEventActionsSubmit = Annotated[
99
+ Union[
100
+ Annotated[CallAction, Tag("call")],
101
+ Annotated[IncrementAction, Tag("inc")],
102
+ Annotated[SaveAction, Tag("save")],
103
+ Annotated[SayAction, Tag("say")],
104
+ Annotated[SetValueAction, Tag("set")],
105
+ ],
106
+ Discriminator(lambda m: get_discriminator(m, "action", "action")),
107
+ ]
108
+
109
+
110
+ class StepEventActionsTypedDict(TypedDict):
111
+ r"""Actions to perform when events occur (enter, presubmit, submit)."""
112
+
113
+ start: NotRequired[Nullable[List[StepEventActionsStartTypedDict]]]
114
+ r"""Actions to execute on the first input from the user."""
115
+ enter: NotRequired[Nullable[List[EnterTypedDict]]]
116
+ r"""Actions to execute when entering a step (before collecting inputs)."""
117
+ presubmit: NotRequired[Nullable[List[PresubmitTypedDict]]]
118
+ r"""Actions to execute before validation (data-mutation only: set, inc, save). Use this to set default values for required fields that would otherwise fail validation."""
119
+ submit: NotRequired[Nullable[List[StepEventActionsSubmitTypedDict]]]
120
+ r"""Actions to execute when the tool/step is submitted by the LLM."""
121
+
122
+
123
+ class StepEventActions(BaseModel):
124
+ r"""Actions to perform when events occur (enter, presubmit, submit)."""
125
+
126
+ start: OptionalNullable[List[StepEventActionsStart]] = UNSET
127
+ r"""Actions to execute on the first input from the user."""
128
+
129
+ enter: OptionalNullable[List[Enter]] = UNSET
130
+ r"""Actions to execute when entering a step (before collecting inputs)."""
131
+
132
+ presubmit: OptionalNullable[List[Presubmit]] = UNSET
133
+ r"""Actions to execute before validation (data-mutation only: set, inc, save). Use this to set default values for required fields that would otherwise fail validation."""
134
+
135
+ submit: OptionalNullable[List[StepEventActionsSubmit]] = UNSET
136
+ r"""Actions to execute when the tool/step is submitted by the LLM."""
137
+
138
+ @model_serializer(mode="wrap")
139
+ def serialize_model(self, handler):
140
+ optional_fields = ["start", "enter", "presubmit", "submit"]
141
+ nullable_fields = ["start", "enter", "presubmit", "submit"]
142
+ null_default_fields = []
143
+
144
+ serialized = handler(self)
145
+
146
+ m = {}
147
+
148
+ for n, f in type(self).model_fields.items():
149
+ k = f.alias or n
150
+ val = serialized.get(k)
151
+ serialized.pop(k, None)
152
+
153
+ optional_nullable = k in optional_fields and k in nullable_fields
154
+ is_set = (
155
+ self.__pydantic_fields_set__.intersection({n})
156
+ or k in null_default_fields
157
+ ) # pylint: disable=no-member
158
+
159
+ if val is not None and val != UNSET_SENTINEL:
160
+ m[k] = val
161
+ elif val != UNSET_SENTINEL and (
162
+ not k in optional_fields or (optional_nullable and is_set)
163
+ ):
164
+ m[k] = val
165
+
166
+ 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 Type(str, Enum):
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[Type]]
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[Type] = UNSET
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",