Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for MQ-based Chatbots #158

Draft
wants to merge 123 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
ee5e72c
Support for MQ-based Chatbots (#149)
NeonKirill Nov 24, 2021
a77b3c6
Increment Version
NeonDaniel Nov 24, 2021
a635a2b
Restructured version handling to be reusable
kirgrim Dec 9, 2021
e4b66e4
Fixed issues with ParlAI base bot
kirgrim Dec 13, 2021
31a99ed
Imported missing dependencies
kirgrim Dec 13, 2021
fa1f668
#0
kirgrim Dec 20, 2021
eeac254
Small refactoring
kirgrim Dec 20, 2021
6ae94a4
discuss response refactor
kirgrim Dec 20, 2021
9272f60
Merge pull request #162 from NeonKirill/generic-version-utility
NeonKirill Dec 21, 2021
0070b8c
Increment Version
NeonKirill Dec 21, 2021
554e355
Fixed imports
kirgrim Dec 28, 2021
cfe6f11
Merge pull request #164 from NeonKirill/FEAT_generic_parlai
NeonKirill Dec 28, 2021
60d42b8
Increment Version
NeonKirill Dec 28, 2021
a4aa59b
Updated message queue flow
kirgrim Jan 13, 2022
f7cd603
Added conversation cycle
kirgrim Jan 17, 2022
b176480
Refactored make_response() to return dict
kirgrim Jan 17, 2022
e5a1a6b
Merge branch 'dev' into FEAT_v2_proctored_conversations
kirgrim Jan 17, 2022
92a5a4f
listen to proctor messages on exchange
kirgrim Jan 17, 2022
74bdaf4
Fixed cycle order
kirgrim Jan 19, 2022
3b8ff7c
Added ping handler
kirgrim Jan 20, 2022
4eb0e4b
refactored connection/disconnection
kirgrim Feb 7, 2022
c1af616
Another small fix
kirgrim Feb 7, 2022
15bee7a
Fixed module usage issues
kirgrim Feb 7, 2022
766fb4a
Using repeating timer for shouts queue reader
kirgrim Feb 10, 2022
290e902
removed redundant todo
kirgrim Feb 10, 2022
0be9516
annotated cid as optional
kirgrim Feb 10, 2022
f1fe6ba
simplified expression
kirgrim Feb 10, 2022
cbe2111
Moved shout_queue to base class
kirgrim Feb 10, 2022
80a017b
updated docstring
kirgrim Feb 10, 2022
13ae90a
make_response -> get_chatbot_response()
kirgrim Feb 10, 2022
e802085
Removed redundant log
kirgrim Feb 10, 2022
a5c36d9
import fix
kirgrim Feb 10, 2022
369ed4b
refactored super call
kirgrim Feb 10, 2022
489d460
refactored super call
kirgrim Feb 10, 2022
ad9f034
Explicitly declaring inits
kirgrim Feb 10, 2022
941f2e4
Troubleshooting shout resolving
kirgrim Feb 16, 2022
1093e55
Fixed unresolved reference issues
kirgrim Feb 16, 2022
be84036
Added conversation announcements and bugfixes
kirgrim Feb 21, 2022
3356676
Fixed conversation state resolving
kirgrim Feb 21, 2022
4b6505a
Fixed chatbot v2 core methods
kirgrim Feb 23, 2022
27d1e34
Support for MQ-based Proctored Conversations (Subminds Implementation…
NeonKirill Feb 28, 2022
36c3656
Increment Version
NeonDaniel Feb 28, 2022
0219a6b
added prompt id resolving
kirgrim Mar 21, 2022
7939eba
added prompt id resolving
kirgrim Mar 21, 2022
ffe268a
simplified mechanism for sending shouts and naming reorganisation
kirgrim Mar 27, 2022
dae6a49
Merge branch 'dev' into FEAT_v2_proctored_conversations
NeonKirill Mar 28, 2022
22adfbd
Merge pull request #167 from NeonGeckoCom/FEAT_v2_proctored_conversat…
NeonKirill Apr 4, 2022
7ce6c05
Increment Version
NeonKirill Apr 4, 2022
db05af1
updated dependency on klat connector
kirgrim Apr 13, 2022
6ae196b
small fix
kirgrim Apr 13, 2022
ef7dfe4
Merge pull request #168 from NeonGeckoCom/update_dependencies_13042022
NeonKirill Apr 14, 2022
a1b0f07
Increment Version
NeonKirill Apr 14, 2022
e2de10a
small fix
kirgrim May 5, 2022
25b70ac
rollback
kirgrim May 6, 2022
a5216c0
Increment Version
NeonKirill May 6, 2022
67a1ea0
moved logger to be a mutual property among chatbots version
kirgrim May 20, 2022
0dc646c
updated log references in v2
kirgrim May 20, 2022
512774f
Merge pull request #169 from NeonGeckoCom/support_for_logger_as_property
NeonKirill May 21, 2022
14d4efc
Increment Version
NeonKirill May 21, 2022
26bf812
Updated requirements
kirgrim May 21, 2022
077b90f
Increment Version
NeonKirill May 21, 2022
49cf9be
Updated requirements
kirgrim May 21, 2022
e4cee37
Merge remote-tracking branch 'base/dev' into dev
kirgrim May 21, 2022
f22f02d
Increment Version
NeonKirill May 21, 2022
78bde63
Incremented dependencies and announcements support
kirgrim Aug 23, 2022
fd83d63
incremented klat connector dependency
kirgrim Aug 24, 2022
3799376
Merge pull request #170 from NeonGeckoCom/announcements_support
NeonKirill Aug 24, 2022
e00f6f3
Increment Version
NeonKirill Aug 24, 2022
461902f
fixed "vote while abstain" issue
kirgrim Aug 26, 2022
05bc702
setting message sender to the generic proctor on prompts
kirgrim Aug 26, 2022
bab4f85
when late response - shout is a blank string
kirgrim Aug 26, 2022
f3aafdb
Merge pull request #171 from NeonGeckoCom/fixed_abstain_detection
NeonKirill Aug 27, 2022
518e7fd
Increment Version
NeonKirill Aug 27, 2022
ba28d9c
added callback to the send_shout() - generated shout id
kirgrim Aug 27, 2022
7e20ecb
incremented klat-connector dependency
kirgrim Aug 27, 2022
092b059
Merge pull request #172 from NeonGeckoCom/callback_shout_id
NeonKirill Aug 27, 2022
5d83d3d
Increment Version
NeonKirill Aug 27, 2022
6142598
changed ip address for new test server
GuyDaniels Aug 30, 2022
f0a7bfe
changed ip address for new test server
GuyDaniels Sep 6, 2022
a5c336a
python 3.9 has logging available; no need to import.
GuyDaniels Sep 22, 2022
6aa60d6
python 3.9 has logging available; no need to import.
GuyDaniels Sep 22, 2022
8156892
Merge remote-tracking branch 'base/dev' into dev
kirgrim Nov 28, 2022
500ec7f
Fixed by Guy
kirgrim Nov 28, 2022
3679a86
Incremented MQ dependency to support mq callbacks
kirgrim Nov 28, 2022
0b5b486
dropped support for python 3.6
kirgrim Nov 28, 2022
af6e517
Merge pull request #173 from NeonGeckoCom/incrementing_mq_dependency_…
NeonKirill Nov 28, 2022
57fc388
Increment Version
NeonKirill Nov 28, 2022
9aa0437
Added support for attaching request context to submind API (#174)
NeonKirill Jul 22, 2023
e4ae79f
Increment Version
NeonKirill Jul 22, 2023
aa66f9a
Added context data on chatbot connection (#175)
NeonKirill Oct 1, 2023
d50dafb
Increment Version
NeonKirill Oct 1, 2023
bfaffd9
Update automation and cleanup for release (#176)
NeonDaniel Nov 29, 2023
bf2508c
Increment Version to
NeonDaniel Nov 29, 2023
b760d92
Update setup.py to resolve PyPI publication failure (#177)
NeonDaniel Nov 29, 2023
17e98ac
Increment Version to 2.3.1a17
NeonDaniel Nov 29, 2023
f67b7a8
Add CLI entrypoint to init an MQ bot (#178)
NeonDaniel Nov 30, 2023
0d121a4
Increment Version to 2.3.1a18
NeonDaniel Nov 30, 2023
51dac68
Replace missing imports in `bot_utils.py` (#179)
NeonDaniel Nov 30, 2023
508f574
Increment Version to 2.3.1a19
NeonDaniel Nov 30, 2023
2c04041
ParlAI Base class fix (#180)
NeonDaniel Dec 1, 2023
88638cf
Increment Version to 2.3.1a20
NeonDaniel Dec 1, 2023
5065049
Refactoring and Unit Tests (#182)
NeonDaniel Dec 7, 2023
5858658
Increment Version to 2.3.1a21
NeonDaniel Dec 7, 2023
bd57bca
Add `bot_config` param with `Configuration` handling (#181)
NeonDaniel Dec 8, 2023
c5f6c8f
Increment Version to 2.3.1a22
NeonDaniel Dec 8, 2023
093e722
Port utils from Chatbots project (#183)
NeonDaniel Dec 9, 2023
3dcef02
Increment Version to 2.3.1a23
NeonDaniel Dec 9, 2023
9d7e3f4
Update `LOG` to `self.log` (#184)
NeonDaniel Dec 11, 2023
38b1a91
Increment Version to 2.3.1a24
NeonDaniel Dec 11, 2023
da291ee
Update neon-mq-connector dependency to stable version (#185)
NeonDaniel Dec 11, 2023
b0eaf60
Increment Version to 2.3.1a25
NeonDaniel Dec 11, 2023
d0e79bc
Chatbot base class tests (#186)
NeonDaniel Dec 14, 2023
ed6085c
Increment Version to 2.3.1a26
NeonDaniel Dec 14, 2023
b948664
Init logs per-bot (#187)
NeonDaniel Dec 15, 2023
681da74
Increment Version to 2.3.1a27
NeonDaniel Dec 15, 2023
e1c3d21
Async consumers support (#188)
NeonKirill Dec 4, 2024
efce5f9
Increment Version to 2.3.1a28
NeonKirill Dec 4, 2024
7150613
Incremented dependencies versions (#189)
NeonKirill Dec 13, 2024
d2912d9
Increment Version to 2.3.1a29
NeonKirill Dec 13, 2024
a4836c0
Added handling of skip_announcement and incremented MQ version (#190)
NeonKirill Jan 3, 2025
5c9d5da
Increment Version to 2.3.1a30
NeonKirill Jan 3, 2025
6d3b9af
Ad-hoc Fixes (#191)
NeonKirill Jan 5, 2025
09efff5
Increment Version to 2.3.1a31
NeonKirill Jan 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/license_tests.yml
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: '^(bs4|nvidia|bitstruct|audioread|klat-connector|neon-chatbot-core|tqdm|dnspython).*'
28 changes: 28 additions & 0 deletions .github/workflows/propose_release.yml
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: "chatbot_core/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 }}
17 changes: 4 additions & 13 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
# This workflow will generate a release distribution and upload it to PyPI

name: Publish GitHub Release
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_pypi_and_release:
uses: neongeckocom/.github/.github/workflows/publish_stable_release.yml@master
secrets: inherit
26 changes: 7 additions & 19 deletions .github/workflows/publish_test_build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow will generate a distribution and upload it to PyPI

name: Increment Alpha Version
name: Publish Alpha Build
on:
push:
branches:
Expand All @@ -9,21 +9,9 @@ on:
- 'version.py'

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Increment Version
run: |
VER=$(python setup.py --version)
python version_bump.py
- name: Push Version Change
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Increment Version
publish_alpha_release:
uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@master
secrets: inherit
with:
version_file: "chatbot_core/version.py"
publish_prerelease: true
21 changes: 0 additions & 21 deletions .github/workflows/pull_master.yml

This file was deleted.

49 changes: 39 additions & 10 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,58 @@ jobs:
unit_tests:
strategy:
matrix:
python-version: [ 3.6, 3.7, 3.8, 3.9 ]
python-version: [ 3.8, 3.9]
# TODO: 3.10 and 3.11 need support in klat-connector
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[lang] -r requirements/test_requirements.txt
python -m nltk.downloader punkt_tab
env:
GITHUB_TOKEN: ${{secrets.neon_token}}
- name: Test with pytest
run: |
pip install pytest pytest-timeout pytest-cov
pytest tests/units --doctest-modules --junitxml=tests/unit-test-results.xml
- name: Upload pytest unit test results
uses: actions/upload-artifact@v4
with:
name: unit-test-results-${{ matrix.python-version }}
path: tests/unit-test-results.xml
integration_tests:
strategy:
matrix:
python-version: [ 3.8, 3.9 ]
# TODO: 3.10 and 3.11 need support in klat-connector
max-parallel: 1
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/test_requirements.txt
pip install .
pip install . -r requirements/test_requirements.txt
env:
GITHUB_TOKEN: ${{secrets.neon_token}}
- name: Test with pytest
run: |
pip install pytest pytest-timeout pytest-cov
pytest tests/chatbot_core_tests.py --doctest-modules --junitxml=tests/test-results.xml
- name: Upload pytest test results
uses: actions/upload-artifact@v2
pytest tests/integration --doctest-modules --junitxml=tests/integration-test-results.xml
- name: Upload integration test results
uses: actions/upload-artifact@v4
with:
name: test-results
path: tests/test-results.xml
name: integration-test-results-${{ matrix.python-version }}
path: tests/integration-test-results.xml
44 changes: 40 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Chatbot Core
![Unit Tests](https://github.com/NeonGeckoCom/chatbot-core/workflows/Run%20Unit%20Tests/badge.svg)

Bots using this framework connect to the Klat server and respond to user shouts. Bots will respond individually,
like any other user in the conversation.

Expand All @@ -17,11 +15,49 @@ To utilize this repository for creating your own chat bots, install this package

You can install this package with the following command:

`pip install git+https://github.com/neongeckocom/chatbot-core`
`pip install neon-chatbot-core`

*Note*: It is recommended to install this to a virtual environment to avoid conflicts with package versions and commandline
entry points. Most IDE's (i.e. [PyCharm](https://www.jetbrains.com/pycharm/)) handle this for individual projects.

### Configuration

#### Bot-specific configuration
Configuration for chatbots should be defined in `~/.config/neon/chatbots.yaml`
by default. Chatbots may be configured as:
```yaml
chatbots:
<bot_id>: {}
```
> For Klat v1, `bot_id` is the `username` the bot connects as, for MQ connected
> bots, `bot_id` is the MQ `service_name`.

Any bot-specific configuration will be accessible as `self.bot_config`. For Klat
v1 connections, `password` should be specified in the `chatbots`
config section.

#### MQ Connection configuration
For v2 bots, MQ connections must also be configured. This should be completed in
the same `~/.config/neon/chatbots.yaml` file as the bot-specific config.

```yaml
MQ:
server: mq.neonaiservices.com
port: 5672
users:
<bot_id>:
user: neon_bot_submind
password: <MQ user `neon_bot_submind`'s password>
```

#### SocketIO Connection configuration
For v1 bots, SIO connections may be configured in `~/.config/neon/chatbots.yaml`:
```yaml
socket_io:
server: 2222.us
port: 8888
```

### Organizing your bots
It is recommended to create a module for each of your bots. You should use subdirectories, each containing `__init__.py`
that includes your `ChatBot` as well as any supporting configuration files, etc. You may also organize this as a
Expand Down Expand Up @@ -49,7 +85,7 @@ my_bots
└--my_bot.py
```

### Klat.com Credentials
### Legacy Klat.com Credentials
Bots should be able to login to [klat.com](https://klat.com); a YAML file containing credentials for each bot can be used
to save usernames and passwords for each bot. Each bot module should have a key matching the module name, a `username`,
and a `password`.
Expand Down
Loading