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
@@ -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."""
@@ -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
@@ -1,8 +1,11 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from .dictionarymetadata import DictionaryMetadata, DictionaryMetadataTypedDict
5
4
  from .pronunciationoverride import PronunciationOverride, PronunciationOverrideTypedDict
5
+ from .schemas_tts_v1_pronunciations_dictionarymetadata import (
6
+ SchemasTtsV1PronunciationsDictionaryMetadata,
7
+ SchemasTtsV1PronunciationsDictionaryMetadataTypedDict,
8
+ )
6
9
  from .voicedisplayinfo import VoiceDisplayInfo, VoiceDisplayInfoTypedDict
7
10
  from syllable_sdk.types import BaseModel
8
11
  from typing import Dict, List, Optional
@@ -32,7 +35,7 @@ class PronunciationOverridesDictionaryTypedDict(TypedDict):
32
35
  """
33
36
 
34
37
  pronunciations: List[PronunciationOverrideTypedDict]
35
- metadata: DictionaryMetadataTypedDict
38
+ metadata: SchemasTtsV1PronunciationsDictionaryMetadataTypedDict
36
39
  r"""Audit metadata associated with a dictionary."""
37
40
  type: NotRequired[str]
38
41
  voices: NotRequired[Dict[str, VoiceDisplayInfoTypedDict]]
@@ -62,7 +65,7 @@ class PronunciationOverridesDictionary(BaseModel):
62
65
 
63
66
  pronunciations: List[PronunciationOverride]
64
67
 
65
- metadata: DictionaryMetadata
68
+ metadata: SchemasTtsV1PronunciationsDictionaryMetadata
66
69
  r"""Audit metadata associated with a dictionary."""
67
70
 
68
71
  type: Optional[str] = "pronunciations_v1"
@@ -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
@@ -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 Optional
13
+ from typing_extensions import NotRequired, TypedDict
14
+
15
+
16
+ class SchemasCortexV1BridgePhrasesDictionaryMetadataTypedDict(TypedDict):
17
+ r"""Metadata for the bridge phrases dictionary."""
18
+
19
+ hash: NotRequired[Nullable[str]]
20
+ r"""Hash of the dictionary content."""
21
+ source: NotRequired[Nullable[str]]
22
+ r"""Source of the dictionary (e.g. filename)."""
23
+ entries: NotRequired[int]
24
+ r"""Number of entries in the dictionary."""
25
+
26
+
27
+ class SchemasCortexV1BridgePhrasesDictionaryMetadata(BaseModel):
28
+ r"""Metadata for the bridge phrases dictionary."""
29
+
30
+ hash: OptionalNullable[str] = UNSET
31
+ r"""Hash of the dictionary content."""
32
+
33
+ source: OptionalNullable[str] = UNSET
34
+ r"""Source of the dictionary (e.g. filename)."""
35
+
36
+ entries: Optional[int] = 0
37
+ r"""Number of entries in the dictionary."""
38
+
39
+ @model_serializer(mode="wrap")
40
+ def serialize_model(self, handler):
41
+ optional_fields = ["hash", "source", "entries"]
42
+ nullable_fields = ["hash", "source"]
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
@@ -6,7 +6,7 @@ from typing import Optional
6
6
  from typing_extensions import NotRequired, TypedDict
7
7
 
8
8
 
9
- class DictionaryMetadataTypedDict(TypedDict):
9
+ class SchemasTtsV1PronunciationsDictionaryMetadataTypedDict(TypedDict):
10
10
  r"""Audit metadata associated with a dictionary."""
11
11
 
12
12
  entries: int
@@ -14,7 +14,7 @@ class DictionaryMetadataTypedDict(TypedDict):
14
14
  source: NotRequired[str]
15
15
 
16
16
 
17
- class DictionaryMetadata(BaseModel):
17
+ class SchemasTtsV1PronunciationsDictionaryMetadata(BaseModel):
18
18
  r"""Audit metadata associated with a dictionary."""
19
19
 
20
20
  entries: int