-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Organize existing user and node-related models into modules.
Move existing unit tests to this repository
- Loading branch information
1 parent
ccd1aff
commit 9fccdba
Showing
21 changed files
with
980 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Run License Tests | ||
on: | ||
push: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
license_tests: | ||
uses: neongeckocom/.github/.github/workflows/license_tests.yml@master | ||
with: | ||
packages-exclude: '^(neon-data-models|dnspython).*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Propose Stable Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_type: | ||
type: choice | ||
description: Release Type | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
jobs: | ||
update_version: | ||
uses: neongeckocom/.github/.github/workflows/propose_semver_release.yml@master | ||
with: | ||
branch: dev | ||
release_type: ${{ inputs.release_type }} | ||
update_changelog: True | ||
version_file: "neon_data_models/version.py" | ||
pull_changes: | ||
uses: neongeckocom/.github/.github/workflows/pull_master.yml@master | ||
needs: update_version | ||
with: | ||
pr_reviewer: neonreviewers | ||
pr_assignee: ${{ github.actor }} | ||
pr_draft: false | ||
pr_title: ${{ needs.update_version.outputs.version }} | ||
pr_body: ${{ needs.update_version.outputs.changelog }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# This workflow will generate a release distribution and upload it to PyPI | ||
|
||
name: Publish Build and GitHub Release | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
tag_release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Get Version | ||
run: | | ||
VERSION=$(python setup.py --version) | ||
echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
token: ${{secrets.GITHUB_TOKEN}} | ||
tag: ${{env.VERSION}} | ||
generateReleaseNotes: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# This workflow will generate a distribution and upload it to PyPI | ||
|
||
name: Publish Alpha Build | ||
on: | ||
push: | ||
branches: | ||
- dev | ||
paths-ignore: | ||
- 'neon_data_models/version.py' | ||
|
||
jobs: | ||
publish_alpha_release: | ||
uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@master | ||
secrets: inherit | ||
with: | ||
version_file: "neon_data_models/version.py" | ||
publish_prerelease: true | ||
publish_pypi: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Run Unit Tests | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
py_build_tests: | ||
uses: neongeckocom/.github/.github/workflows/python_build_tests.yml@master | ||
with: | ||
python_version: "3.9" | ||
unit_tests: | ||
strategy: | ||
matrix: | ||
python-version: [ 3.9, "3.10", "3.11" ] | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install system dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install -y swig gcc libpulse-dev portaudio19-dev | ||
- name: Install package | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install .[streaming] -r requirements/test_requirements.txt | ||
- name: Run Tests | ||
run: | | ||
pytest tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System | ||
# All trademark and other rights reserved by their respective owners | ||
# Copyright 2008-2024 Neongecko.com Inc. | ||
# BSD-3 | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the | ||
following conditions are met: | ||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following | ||
disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials provided with the distribution. | ||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products | ||
derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## Neon Data Models | ||
This repository contains Pydantic models and JSON schemas for common data | ||
structures. The `models` module contains Pydantic models, organized by application. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
from enum import IntEnum | ||
|
||
|
||
class AccessRoles(IntEnum): | ||
""" | ||
Defines access roles such that a larger value always corresponds to more | ||
permissions. `0` equates to no permission, negative numbers correspond to | ||
non-user roles. In this way, an activity can require, for example, | ||
`permission > AccessRoles.GUEST` to grant access to all registered users, | ||
admins, and owners. | ||
""" | ||
NONE = 0 | ||
GUEST = 1 | ||
USER = 2 | ||
ADMIN = 3 | ||
OWNER = 4 | ||
|
||
NODE = -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from neon_data_models.models.api import * | ||
from neon_data_models.models.client import * | ||
from neon_data_models.models.user import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from neon_data_models.models.api.node_v1 import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System | ||
# All trademark and other rights reserved by their respective owners | ||
# Copyright 2008-2024 Neongecko.com Inc. | ||
# BSD-3 | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# 1. Redistributions of source code must retain the above copyright notice, | ||
# this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright notice, | ||
# this list of conditions and the following disclaimer in the documentation | ||
# and/or other materials provided with the distribution. | ||
# 3. Neither the name of the copyright holder nor the names of its | ||
# contributors may be used to endorse or promote products derived from this | ||
# software without specific prior written permission. | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
from pydantic import BaseModel, Field | ||
from typing import Optional, Dict, List, Literal | ||
from neon_hana.schema.node_model import NodeData | ||
|
||
|
||
class NodeInputContext(BaseModel): | ||
node_data: Optional[NodeData] = Field(description="Node Data") | ||
|
||
|
||
class AudioInputData(BaseModel): | ||
audio_data: str = Field(description="base64-encoded audio") | ||
lang: str = Field(description="BCP-47 language code") | ||
|
||
|
||
class TextInputData(BaseModel): | ||
text: str = Field(description="String text input") | ||
lang: str = Field(description="BCP-47 language code") | ||
|
||
|
||
class UtteranceInputData(BaseModel): | ||
utterances: List[str] = Field(description="List of input utterance(s)") | ||
lang: str = Field(description="BCP-47 language") | ||
|
||
|
||
class KlatResponse(BaseModel): | ||
sentence: str = Field(description="Text response") | ||
audio: dict = {Field(description="Audio Gender", | ||
type=Literal["male", "female"]): | ||
Field(description="b64-encoded audio", type=str)} | ||
|
||
|
||
class TtsResponse(KlatResponse): | ||
translated: bool = Field(description="True if sentence was translated") | ||
phonemes: List[str] = Field(description="List of phonemes") | ||
genders: List[str] = Field(description="List of audio genders") | ||
|
||
|
||
class KlatResponseData(BaseModel): | ||
responses: dict = {Field(type=str, | ||
description="BCP-47 language"): KlatResponse} | ||
|
||
|
||
class NodeAudioInput(BaseModel): | ||
msg_type: str = "neon.audio_input" | ||
data: AudioInputData | ||
context: NodeInputContext | ||
|
||
|
||
class NodeTextInput(BaseModel): | ||
msg_type: str = "recognizer_loop:utterance" | ||
data: UtteranceInputData | ||
context: NodeInputContext | ||
|
||
|
||
class NodeGetStt(BaseModel): | ||
msg_type: str = "neon.get_stt" | ||
data: AudioInputData | ||
context: NodeInputContext | ||
|
||
|
||
class NodeGetTts(BaseModel): | ||
msg_type: str = "neon.get_tts" | ||
data: TextInputData | ||
context: NodeInputContext | ||
|
||
|
||
class NodeKlatResponse(BaseModel): | ||
msg_type: str = "klat.response" | ||
data: dict = {Field(type=str, description="BCP-47 language"): KlatResponse} | ||
context: dict | ||
|
||
|
||
class NodeAudioInputResponse(BaseModel): | ||
msg_type: str = "neon.audio_input.response" | ||
data: dict = {"parser_data": Field(description="Dict audio parser data", | ||
type=dict), | ||
"transcripts": Field(description="Transcribed text", | ||
type=List[str]), | ||
"skills_recv": Field(description="Skills service acknowledge", | ||
type=bool)} | ||
context: dict | ||
|
||
|
||
class NodeGetSttResponse(BaseModel): | ||
msg_type: str = "neon.get_stt.response" | ||
data: dict = {"parser_data": Field(description="Dict audio parser data", | ||
type=dict), | ||
"transcripts": Field(description="Transcribed text", | ||
type=List[str]), | ||
"skills_recv": Field(description="Skills service acknowledge", | ||
type=bool)} | ||
context: dict | ||
|
||
|
||
class NodeGetTtsResponse(BaseModel): | ||
msg_type: str = "neon.get_tts.response" | ||
data: KlatResponseData | ||
context: dict | ||
|
||
|
||
class CoreWWDetected(BaseModel): | ||
msg_type: str = "neon.ww_detected" | ||
data: dict | ||
context: dict | ||
|
||
|
||
class CoreIntentFailure(BaseModel): | ||
msg_type: str = "complete.intent.failure" | ||
data: dict | ||
context: dict | ||
|
||
|
||
class CoreErrorResponse(BaseModel): | ||
msg_type: str = "klat.error" | ||
data: dict | ||
context: dict | ||
|
||
|
||
class CoreClearData(BaseModel): | ||
msg_type: str = "neon.clear_data" | ||
data: dict | ||
context: dict | ||
|
||
|
||
class CoreAlertExpired(BaseModel): | ||
msg_type: str = "neon.alert_expired" | ||
data: dict | ||
context: dict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System | ||
# All trademark and other rights reserved by their respective owners | ||
# Copyright 2008-2024 Neongecko.com Inc. | ||
# BSD-3 | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# 1. Redistributions of source code must retain the above copyright notice, | ||
# this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright notice, | ||
# this list of conditions and the following disclaimer in the documentation | ||
# and/or other materials provided with the distribution. | ||
# 3. Neither the name of the copyright holder nor the names of its | ||
# contributors may be used to endorse or promote products derived from this | ||
# software without specific prior written permission. | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
from neon_data_models.models.client.node import * |
Oops, something went wrong.