-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update for packaging and deployment (#3)
* Refactor code into Python package with setup.py Update config handling to use `ovos-config` and match other Diana services Update README.md Add GitHub automation * Add license including setup.py and file headers Update relative imports to use absolute paths
- Loading branch information
1 parent
8862195
commit 601bd54
Showing
25 changed files
with
592 additions
and
144 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-llm-chatgpt|tqdm).*' |
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 @@ | ||
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 | ||
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,25 @@ | ||
# 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}} | ||
|
||
build_and_publish_docker: | ||
uses: neongeckocom/.github/.github/workflows/publish_docker.yml@master | ||
secrets: inherit |
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 distribution and upload it to PyPI | ||
|
||
name: Publish Alpha Build | ||
on: | ||
push: | ||
branches: | ||
- dev | ||
paths-ignore: | ||
- 'version.py' | ||
|
||
jobs: | ||
publish_alpha_release: | ||
uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@master | ||
secrets: inherit | ||
with: | ||
version_file: "version.py" | ||
publish_prerelease: true | ||
publish_pypi: false | ||
build_and_publish_docker: | ||
needs: publish_alpha_release | ||
uses: neongeckocom/.github/.github/workflows/publish_docker.yml@master | ||
secrets: inherit |
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 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.8" | ||
docker_build_tests: | ||
uses: neongeckocom/.github/.github/workflows/docker_build_tests.yml@master |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
FROM python:3.9-slim | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
ENV XDG_CONFIG_HOME /config | ||
COPY docker_overlay/ / | ||
|
||
RUN pip install -r requirements.txt | ||
WORKDIR /app | ||
COPY . /app | ||
RUN pip install /app | ||
|
||
CMD [ "python3", "app/main.py" ] | ||
CMD [ "neon-llm-chatgpt" ] |
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-2021 Neongecko.com Inc. | ||
# BSD-3 License | ||
|
||
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 |
---|---|---|
@@ -1,6 +1,44 @@ | ||
## Run with Neon | ||
# NeonAI LLM ChatGPT | ||
Proxies API calls to ChatGPT. | ||
|
||
## Request Format | ||
API requests should include `history`, a list of tuples of strings, and the current | ||
`query` | ||
|
||
>Example Request: | ||
>```json | ||
>{ | ||
> "history": [["user", "hello"], ["llm", "hi"]], | ||
> "query": "how are you?" | ||
>} | ||
>``` | ||
## Response Format | ||
Responses will be returned as dictionaries. Responses should contain the following: | ||
- `response` - String LLM response to the query | ||
## Docker Configuration | ||
When running this as a docker container, the `XDG_CONFIG_HOME` envvar is set to `/config`. | ||
A configuration file at `/config/neon/diana.yaml` is required and should look like: | ||
```yaml | ||
MQ: | ||
port: <MQ Port> | ||
server: <MQ Hostname or IP> | ||
users: | ||
mq-chatgpt-api: | ||
password: <neon_chatgpt user's password> | ||
user: neon_chatgpt | ||
ChatGPT: | ||
key: "" | ||
model: "gpt-3.5-turbo" | ||
role: "You are trying to give a short answer in less than 40 words." | ||
context_depth: 3 | ||
max_tokens: 100 | ||
``` | ||
docker run -it -v <config_path>:/app/app/config.json:ro chatgpt-api-server | ||
For example, if your configuration resides in `~/.config`: | ||
```shell | ||
export CONFIG_PATH="/home/${USER}/.config" | ||
docker run -v ${CONFIG_PATH}:/config neon_llm_chatgpt | ||
``` | ||
where `<config_path>` - absolute path to MQ config | ||
> Note: If connecting to a local MQ server, you may need to specify `--network host` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
{ | ||
"module_overrides": { | ||
"diana": { | ||
"base_folder": "neon", | ||
"config_filename": "diana.yaml" | ||
} | ||
}, | ||
"submodule_mappings": { | ||
"neon_llm_chatgpt": "diana" | ||
} | ||
} |
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 @@ | ||
log_level: INFO | ||
logs: | ||
level_overrides: | ||
error: | ||
- pika | ||
warning: | ||
- filelock | ||
info: [] | ||
debug: [] | ||
MQ: | ||
server: api.neon.ai | ||
port: 5672 | ||
users: | ||
mq_handler: | ||
user: neon_api_utils | ||
password: Klatchat2021 | ||
ChatGPT: | ||
model: "gpt-3.5-turbo" | ||
role: "You are trying to give a short answer in less than 40 words." | ||
context_depth: 3 | ||
max_tokens: 100 |
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,25 @@ | ||
# NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System | ||
# All trademark and other rights reserved by their respective owners | ||
# Copyright 2008-2021 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. |
Oops, something went wrong.