neon-data-models 0.0.0a1__tar.gz

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 (27) hide show
  1. neon-data-models-0.0.0a1/LICENSE.md +21 -0
  2. neon-data-models-0.0.0a1/PKG-INFO +45 -0
  3. neon-data-models-0.0.0a1/README.md +31 -0
  4. neon-data-models-0.0.0a1/neon_data_models/__init__.py +25 -0
  5. neon-data-models-0.0.0a1/neon_data_models/enum.py +83 -0
  6. neon-data-models-0.0.0a1/neon_data_models/models/__init__.py +25 -0
  7. neon-data-models-0.0.0a1/neon_data_models/models/api/__init__.py +28 -0
  8. neon-data-models-0.0.0a1/neon_data_models/models/api/mq.py +40 -0
  9. neon-data-models-0.0.0a1/neon_data_models/models/api/node_v1/__init__.py +155 -0
  10. neon-data-models-0.0.0a1/neon_data_models/models/base/__init__.py +33 -0
  11. neon-data-models-0.0.0a1/neon_data_models/models/base/contexts.py +98 -0
  12. neon-data-models-0.0.0a1/neon_data_models/models/base/messagebus.py +65 -0
  13. neon-data-models-0.0.0a1/neon_data_models/models/client/__init__.py +27 -0
  14. neon-data-models-0.0.0a1/neon_data_models/models/client/node.py +69 -0
  15. neon-data-models-0.0.0a1/neon_data_models/models/user/__init__.py +28 -0
  16. neon-data-models-0.0.0a1/neon_data_models/models/user/database.py +162 -0
  17. neon-data-models-0.0.0a1/neon_data_models/models/user/neon_profile.py +167 -0
  18. neon-data-models-0.0.0a1/neon_data_models/util.py +52 -0
  19. neon-data-models-0.0.0a1/neon_data_models/version.py +29 -0
  20. neon-data-models-0.0.0a1/neon_data_models.egg-info/PKG-INFO +45 -0
  21. neon-data-models-0.0.0a1/neon_data_models.egg-info/SOURCES.txt +25 -0
  22. neon-data-models-0.0.0a1/neon_data_models.egg-info/dependency_links.txt +1 -0
  23. neon-data-models-0.0.0a1/neon_data_models.egg-info/requires.txt +5 -0
  24. neon-data-models-0.0.0a1/neon_data_models.egg-info/top_level.txt +1 -0
  25. neon-data-models-0.0.0a1/neon_data_models.egg-info/zip-safe +1 -0
  26. neon-data-models-0.0.0a1/setup.cfg +4 -0
  27. neon-data-models-0.0.0a1/setup.py +85 -0
@@ -0,0 +1,21 @@
1
+ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
2
+ # All trademark and other rights reserved by their respective owners
3
+ # Copyright 2008-2024 Neongecko.com Inc.
4
+ # BSD-3
5
+
6
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
7
+ following conditions are met:
8
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
9
+ disclaimer.
10
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
11
+ disclaimer in the documentation and/or other materials provided with the distribution.
12
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
13
+ derived from this software without specific prior written permission.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
16
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,45 @@
1
+ Metadata-Version: 2.1
2
+ Name: neon-data-models
3
+ Version: 0.0.0a1
4
+ Summary: Pydantic models and associated JSON schema definitions
5
+ Home-page: https://github.com/NeonGeckoCom/neon-data-models
6
+ Author: NeonGecko
7
+ Author-email: developers@neon.ai
8
+ License: BSD-3-Clause
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Description-Content-Type: text/markdown
12
+ Provides-Extra: test
13
+ License-File: LICENSE.md
14
+
15
+ ## Neon Data Models
16
+ This repository contains Pydantic models and JSON schemas for common data
17
+ structures. The `models` module contains Pydantic models, organized by application.
18
+
19
+ ## Configuration
20
+ To allow passing or handling parameters that are not explicitly defined in the
21
+ models provided by this package, the `NEON_DATA_MODELS_ALLOW_EXTRA` envvar may
22
+ be set to `true`. This is generally not necessary and helps to prevent sending
23
+ extraneous data, but may help in cases where the server and client are using
24
+ different revisions of this package.
25
+
26
+ ## Organization
27
+ Models are broadly organized into the following categories.
28
+
29
+ ### API
30
+ These schemas are used in API requests and responses. They are grouped by the
31
+ applicable API (node, HANA, mq). Use these schemas for sending requests and
32
+ parsing responses.
33
+
34
+ ### Client
35
+ These schemas are specific to client applications (i.e. Nodes). Use these
36
+ schemas for client-specific configuration.
37
+
38
+ ### User
39
+ These schemas define user-specific data structures. Use these schemas for
40
+ user-specific configuration.
41
+
42
+ ### Messagebus
43
+ These schemas define messages sent on the messagebus. Historically, messagebus
44
+ events have not used any validation, so there is greater risk of Message objects
45
+ failing validation than other schemas defined here.
@@ -0,0 +1,31 @@
1
+ ## Neon Data Models
2
+ This repository contains Pydantic models and JSON schemas for common data
3
+ structures. The `models` module contains Pydantic models, organized by application.
4
+
5
+ ## Configuration
6
+ To allow passing or handling parameters that are not explicitly defined in the
7
+ models provided by this package, the `NEON_DATA_MODELS_ALLOW_EXTRA` envvar may
8
+ be set to `true`. This is generally not necessary and helps to prevent sending
9
+ extraneous data, but may help in cases where the server and client are using
10
+ different revisions of this package.
11
+
12
+ ## Organization
13
+ Models are broadly organized into the following categories.
14
+
15
+ ### API
16
+ These schemas are used in API requests and responses. They are grouped by the
17
+ applicable API (node, HANA, mq). Use these schemas for sending requests and
18
+ parsing responses.
19
+
20
+ ### Client
21
+ These schemas are specific to client applications (i.e. Nodes). Use these
22
+ schemas for client-specific configuration.
23
+
24
+ ### User
25
+ These schemas define user-specific data structures. Use these schemas for
26
+ user-specific configuration.
27
+
28
+ ### Messagebus
29
+ These schemas define messages sent on the messagebus. Historically, messagebus
30
+ events have not used any validation, so there is greater risk of Message objects
31
+ failing validation than other schemas defined here.
@@ -0,0 +1,25 @@
1
+ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
2
+ # All trademark and other rights reserved by their respective owners
3
+ # Copyright 2008-2024 Neongecko.com Inc.
4
+ # BSD-3
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ # 1. Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ # 3. Neither the name of the copyright holder nor the names of its
13
+ # contributors may be used to endorse or promote products derived from this
14
+ # software without specific prior written permission.
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22
+ # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,83 @@
1
+ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
2
+ # All trademark and other rights reserved by their respective owners
3
+ # Copyright 2008-2024 Neongecko.com Inc.
4
+ # BSD-3
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ # 1. Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ # 3. Neither the name of the copyright holder nor the names of its
13
+ # contributors may be used to endorse or promote products derived from this
14
+ # software without specific prior written permission.
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22
+ # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+
27
+ from enum import IntEnum
28
+
29
+
30
+ class AccessRoles(IntEnum):
31
+ """
32
+ Defines access roles such that a larger value always corresponds to more
33
+ permissions. `0` equates to no permission, negative numbers correspond to
34
+ non-user roles. In this way, an activity can require, for example,
35
+ `permission > AccessRoles.GUEST` to grant access to all registered users,
36
+ admins, and owners.
37
+ """
38
+ NONE = 0
39
+ GUEST = 1
40
+ USER = 2
41
+ ADMIN = 3
42
+ OWNER = 4
43
+
44
+ NODE = -1
45
+
46
+
47
+ class UserData(IntEnum):
48
+ """
49
+ Defines types of user data.
50
+ """
51
+ CACHES = 0
52
+ PROFILE = 1
53
+ TRANSCRIPTS = 2
54
+ LIKED_BRANDS = 3
55
+ DISLIKED_BRANDS = 4
56
+ ALL_DATA = 5
57
+ ALL_MEDIA = 6
58
+ UNITS_CONFIG = 7
59
+ LANGUAGE_CONFIG = 8
60
+
61
+
62
+ class AlertType(IntEnum):
63
+ """
64
+ Defines kinds of alerts.
65
+ """
66
+ ALL = -1
67
+ ALARM = 0
68
+ TIMER = 1
69
+ REMINDER = 2
70
+ UNKNOWN = 99
71
+
72
+
73
+ class Weekdays(IntEnum):
74
+ """
75
+ Defines weekdays as used in the Alerts skill.
76
+ """
77
+ MON = 0
78
+ TUE = 1
79
+ WED = 2
80
+ THU = 3
81
+ FRI = 4
82
+ SAT = 5
83
+ SUN = 6
@@ -0,0 +1,25 @@
1
+ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
2
+ # All trademark and other rights reserved by their respective owners
3
+ # Copyright 2008-2024 Neongecko.com Inc.
4
+ # BSD-3
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ # 1. Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ # 3. Neither the name of the copyright holder nor the names of its
13
+ # contributors may be used to endorse or promote products derived from this
14
+ # software without specific prior written permission.
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22
+ # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,28 @@
1
+ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
2
+ # All trademark and other rights reserved by their respective owners
3
+ # Copyright 2008-2024 Neongecko.com Inc.
4
+ # BSD-3
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ # 1. Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ # 3. Neither the name of the copyright holder nor the names of its
13
+ # contributors may be used to endorse or promote products derived from this
14
+ # software without specific prior written permission.
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22
+ # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+
27
+ from neon_data_models.models.api.node_v1 import *
28
+ from neon_data_models.models.api.mq import *
@@ -0,0 +1,40 @@
1
+ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
2
+ # All trademark and other rights reserved by their respective owners
3
+ # Copyright 2008-2024 Neongecko.com Inc.
4
+ # BSD-3
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ # 1. Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ # 3. Neither the name of the copyright holder nor the names of its
13
+ # contributors may be used to endorse or promote products derived from this
14
+ # software without specific prior written permission.
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22
+ # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+
27
+ from typing import Literal, Optional
28
+ from neon_data_models.models.base.contexts import MQContext
29
+ from neon_data_models.models.user.database import User
30
+
31
+
32
+ class UserDbRequest(MQContext):
33
+ operation: Literal["create", "read", "update", "delete"]
34
+ username: str
35
+ password: Optional[str] = None
36
+ access_token: Optional[str] = None
37
+ user: Optional[User] = None
38
+
39
+
40
+ __all__ = [UserDbRequest.__name__]
@@ -0,0 +1,155 @@
1
+ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
2
+ # All trademark and other rights reserved by their respective owners
3
+ # Copyright 2008-2024 Neongecko.com Inc.
4
+ # BSD-3
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ # 1. Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ # 3. Neither the name of the copyright holder nor the names of its
13
+ # contributors may be used to endorse or promote products derived from this
14
+ # software without specific prior written permission.
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22
+ # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+
27
+ from datetime import datetime, timedelta
28
+ from pydantic import Field
29
+ from typing import List, Literal, Optional, Annotated, Dict
30
+
31
+ from neon_data_models.enum import UserData, AlertType, Weekdays
32
+ from neon_data_models.models.base import BaseModel
33
+ from neon_data_models.models.base.messagebus import BaseMessage, MessageContext
34
+
35
+
36
+ class AudioInputData(BaseModel):
37
+ audio_data: str = Field(description="base64-encoded audio")
38
+ lang: str = Field(description="BCP-47 language code")
39
+
40
+
41
+ class KlatResponse(BaseModel):
42
+ sentence: str = Field(description="Text response")
43
+ audio: Dict[Literal["male", "female"], Optional[str]] = Field(
44
+ description="Mapping of gender to b64-encoded audio")
45
+
46
+
47
+ class AudioInputResponseData(BaseModel):
48
+ parser_data: dict
49
+ transcripts: List[str]
50
+ skills_recv: bool
51
+
52
+
53
+ class NodeAudioInput(BaseMessage):
54
+ msg_type: Literal["neon.audio_input"] = "neon.audio_input"
55
+ data: AudioInputData
56
+
57
+
58
+ class NodeTextInput(BaseMessage):
59
+ class UtteranceInputData(BaseModel):
60
+ utterances: List[str] = Field(description="List of input utterance(s)")
61
+ lang: str = Field(description="BCP-47 language")
62
+
63
+ msg_type: Literal["recognizer_loop:utterance"] = "recognizer_loop:utterance"
64
+ data: UtteranceInputData
65
+
66
+
67
+ class NodeGetStt(BaseMessage):
68
+ msg_type: Literal["neon.get_stt"] = "neon.get_stt"
69
+ data: AudioInputData
70
+
71
+
72
+ class NodeGetTts(BaseMessage):
73
+ class TextInputData(BaseModel):
74
+ text: str = Field(description="String text input")
75
+ lang: str = Field(description="BCP-47 language code")
76
+
77
+ msg_type: Literal["neon.get_tts"] = "neon.get_tts"
78
+ data: TextInputData
79
+
80
+
81
+ class NodeKlatResponse(BaseMessage):
82
+ msg_type: Literal["klat.response"] = "klat.response"
83
+ data: Dict[str, KlatResponse] = Field(type=Dict[str, KlatResponse],
84
+ description="dict of BCP-47 language: KlatResponse")
85
+
86
+
87
+ class NodeAudioInputResponse(BaseMessage):
88
+ msg_type: Literal["neon.audio_input.response"] = "neon.audio_input.response"
89
+ data: AudioInputResponseData
90
+
91
+
92
+ class NodeGetSttResponse(BaseMessage):
93
+ msg_type: Literal["neon.get_stt.response"] = "neon.get_stt.response"
94
+ data: AudioInputResponseData
95
+
96
+
97
+ class NodeGetTtsResponse(BaseMessage):
98
+ msg_type: Literal["neon.get_tts.response"] = "neon.get_tts.response"
99
+ data: Dict[str, KlatResponse] = (
100
+ Field(type=Dict[str, KlatResponse],
101
+ description="dict of BCP-47 language: KlatResponse"))
102
+
103
+
104
+ class CoreWWDetected(BaseMessage):
105
+ msg_type: Literal["neon.ww_detected"] = "neon.ww_detected"
106
+ # TODO: Define/implement schema in neon-speech service
107
+ data: dict
108
+
109
+
110
+ class CoreIntentFailure(BaseMessage):
111
+ msg_type: Literal["complete_intent_failure"] = "complete_intent_failure"
112
+ data: dict # Empty dict
113
+
114
+
115
+ class CoreErrorResponse(BaseMessage):
116
+ class KlatErrorData(BaseModel):
117
+ error: str = "unknown error"
118
+ data: dict = {}
119
+
120
+ msg_type: Literal["klat.error"] = "klat.error"
121
+ data: KlatErrorData
122
+
123
+
124
+ class CoreClearData(BaseMessage):
125
+ class ClearDataData(BaseModel):
126
+ username: str
127
+ data_to_remove: List[UserData]
128
+
129
+ msg_type: Literal["neon.clear_data"] = "neon.clear_data"
130
+ data: ClearDataData
131
+
132
+
133
+ class CoreAlertExpired(BaseMessage):
134
+ class AlertData(BaseModel):
135
+ alert_type: AlertType
136
+ priority: Annotated[int, Field(gt=1, lt=10)]
137
+ alert_name: str
138
+ context: MessageContext
139
+ next_expiration_time: Optional[datetime]
140
+ repeat_frequency: Optional[timedelta]
141
+ repeat_days: Optional[List[Weekdays]]
142
+ end_repeat: Optional[datetime]
143
+ audio_file: Optional[str] = None
144
+ script_filename: Optional[str] = None
145
+
146
+ msg_type: Literal["neon.alert_expired"] = "neon.alert_expired"
147
+ data: AlertData
148
+
149
+
150
+ __all__ = [NodeAudioInput.__name__, NodeTextInput.__name__, NodeGetStt.__name__,
151
+ NodeGetTts.__name__, NodeKlatResponse.__name__,
152
+ NodeAudioInputResponse.__name__, NodeGetSttResponse.__name__,
153
+ NodeGetTtsResponse.__name__, CoreWWDetected.__name__,
154
+ CoreIntentFailure.__name__, CoreErrorResponse.__name__,
155
+ CoreClearData.__name__, CoreAlertExpired.__name__]
@@ -0,0 +1,33 @@
1
+ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
2
+ # All trademark and other rights reserved by their respective owners
3
+ # Copyright 2008-2024 Neongecko.com Inc.
4
+ # BSD-3
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ # 1. Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ # 3. Neither the name of the copyright holder nor the names of its
13
+ # contributors may be used to endorse or promote products derived from this
14
+ # software without specific prior written permission.
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22
+ # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+
27
+ from os import environ
28
+ from pydantic import ConfigDict, BaseModel as _BaseModel
29
+
30
+
31
+ class BaseModel(_BaseModel):
32
+ model_config = ConfigDict(extra="allow" if environ.get(
33
+ "NEON_DATA_MODELS_ALLOW_EXTRA", "false") != "false" else "ignore")
@@ -0,0 +1,98 @@
1
+ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
2
+ # All trademark and other rights reserved by their respective owners
3
+ # Copyright 2008-2024 Neongecko.com Inc.
4
+ # BSD-3
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ # 1. Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ # 3. Neither the name of the copyright holder nor the names of its
13
+ # contributors may be used to endorse or promote products derived from this
14
+ # software without specific prior written permission.
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22
+ # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+ from datetime import datetime, timedelta
27
+ from typing import Literal, List, Optional
28
+
29
+ from pydantic import Field
30
+
31
+ from neon_data_models.models.base import BaseModel
32
+
33
+
34
+ class SessionContext(BaseModel):
35
+ session_id: str = "default"
36
+ active_skills: List[str] = []
37
+ utterance_states: dict = {}
38
+ lang: Optional[str] = None
39
+ context: dict = {}
40
+ site_id: str = "unknown"
41
+ pipeline: List[str] = []
42
+ location: dict = {}
43
+ system_unit: Optional[Literal["imperial", "metric"]] = None
44
+ date_format: Optional[Literal["MDY", "YMD", "YDM", "DMY"]] = None
45
+ time: Optional[Literal[12, 24]] = None
46
+ is_recording: bool = False
47
+ is_speaking: bool = False
48
+ blacklisted_skills: List[str] = []
49
+ blacklisted_intents: List[str] = []
50
+
51
+ def model_dump(self, *args, **kwargs) -> dict:
52
+ # Override to explicitly exclude default `None` values so that upstream
53
+ # logic works to read values from global config
54
+ kwargs["exclude_none"] = True
55
+ return BaseModel.model_dump(self, *args, **kwargs)
56
+
57
+
58
+ class TimingContext(BaseModel):
59
+ def __init__(self, **kwargs):
60
+ # Enables backwards-compat. with old context values
61
+ if transcribed := kwargs.pop("transcribed", None):
62
+ kwargs.setdefault("handle_utterance", transcribed)
63
+ if text_parsers := kwargs.pop("text_parsers", None):
64
+ kwargs.setdefault("transform_utterance", text_parsers)
65
+ BaseModel.__init__(self, **kwargs)
66
+
67
+ audio_begin: Optional[datetime] = None
68
+ audio_end: Optional[datetime] = None
69
+ client_sent: Optional[datetime] = None
70
+ gradio_sent: Optional[datetime] = None
71
+ handle_utterance: Optional[datetime] = None
72
+ response_sent: Optional[datetime] = None
73
+ speech_start: Optional[datetime] = None
74
+
75
+ get_stt: Optional[timedelta] = None
76
+ get_tts: Optional[timedelta] = None
77
+ iris_input_handling: Optional[timedelta] = None
78
+ mq_response_handler: Optional[timedelta] = None
79
+ mq_from_core: Optional[timedelta] = None
80
+ mq_from_client: Optional[timedelta] = None
81
+ mq_input_handler: Optional[timedelta] = None
82
+ client_to_core: Optional[timedelta] = None
83
+ client_from_core: Optional[timedelta] = None
84
+ save_transcript: Optional[timedelta] = None
85
+ transform_audio: Optional[timedelta] = None
86
+ transform_utterance: Optional[timedelta] = None
87
+ wait_in_queue: Optional[timedelta] = None
88
+
89
+
90
+ class KlatContext(BaseModel):
91
+ sid: str
92
+ cid: str
93
+ title: Optional[str] = ""
94
+
95
+
96
+ class MQContext(BaseModel):
97
+ routing_key: Optional[str] = None
98
+ message_id: str
@@ -0,0 +1,65 @@
1
+ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
2
+ # All trademark and other rights reserved by their respective owners
3
+ # Copyright 2008-2024 Neongecko.com Inc.
4
+ # BSD-3
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ # 1. Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ # 3. Neither the name of the copyright holder nor the names of its
13
+ # contributors may be used to endorse or promote products derived from this
14
+ # software without specific prior written permission.
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22
+ # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+
27
+ from typing import Optional, List, Union
28
+ from pydantic import ConfigDict, Field
29
+
30
+ from neon_data_models.models.base import BaseModel
31
+ from neon_data_models.models.base.contexts import (SessionContext, KlatContext,
32
+ TimingContext, MQContext)
33
+ from neon_data_models.models.client import NodeData
34
+ from neon_data_models.models.user import NeonUserConfig
35
+
36
+
37
+ class MessageContext(BaseModel):
38
+ model_config = ConfigDict(extra="allow")
39
+ session: Optional[SessionContext] = Field(description="Session Data",
40
+ default=None)
41
+ node_data: Optional[NodeData] = Field(description="Node Data", default=None)
42
+ timing: Optional[TimingContext] = Field(
43
+ description="User Interaction Timing Information", default=None)
44
+ user_profiles: Optional[List[NeonUserConfig]] = (
45
+ Field(description="List of relevant user profiles", default=None))
46
+ klat_data: Optional[KlatContext] = Field(
47
+ description="Klat context for Klat-generated messages", default=None)
48
+ mq: Optional[MQContext] = Field(
49
+ description="MQ context for messages traversing a RabbitMQ broker",
50
+ default=None)
51
+
52
+ username: str = "local"
53
+ # TODO: Consider refactoring client/client_name into a single dict
54
+ # or merging with `node_data`
55
+ client_name: str = "unknown"
56
+ client: str = "unknown"
57
+ source: Union[str, List[str]] = "unknown"
58
+ destination: List[str] = ["skills"]
59
+ neon_should_respond: bool = True
60
+
61
+
62
+ class BaseMessage(BaseModel):
63
+ msg_type: str
64
+ data: dict
65
+ context: MessageContext