https://github.com/deeppavlov/convai_router_bot_poller
https://github.com/deeppavlov/convai_router_bot_poller
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/deeppavlov/convai_router_bot_poller
- Owner: deeppavlov
- Created: 2018-11-01T08:45:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-06-21T22:51:45.000Z (about 4 years ago)
- Last Synced: 2025-02-23T23:28:13.659Z (over 1 year ago)
- Language: Python
- Size: 80.1 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ConvAI Router Bot Poller (CRBP)
Integration tool which makes DeepPavlov agents accessible via ConvAI Router Bot
## Installation
1. Clone CRBP and `cd` to repository folder:
```
git clone https://github.com/deepmipt/convai_router_bot_poller.git
cd convai_router_bot_poller
```
2. Create and activate Python 3.6 virtual environment:
```
virtualenv env -p python3.6
source env/bin/activate
```
3. Install dependencies:
```
pip install -r requirements.txt
```
4. To start CRBP run:
```
python poller.py [--model_url ] \
[--host ] \
[--port ] \
[--token ] \
[--state] \
[--convai] \
[--agent]
```
* `--model_url `: where to send POST-requests from the
[ConvAI Router Bot](https://github.com/deepmipt/convai_router_bot) for processing. Overrides default settings from `config.json`.
* `--host `: `ConvAI Router Bot` host address. Overrides default settings from `config.json`.
* `--port `: `ConvAI Router Bot` port. Overrides default settings from `config.json`.
* `--token `: `ConvAI Router Bot` token. Overrides default settings from `config.json`.
* `--state`: add this argument to send dialogue state besides utterance to model. Overrides default settings from `config.json`.
* `--convai`: add this argument to send full payload to model instead of plain text. Overrides default settings from `config.json`.
* `--agent`: add this argument to send utterances from router bot to web interface of `dp-agent`. Overrides default settings from `config.json`.
## ConvAI Router Bot Poller modes
One can use 4 combinations of `convai` and `state` states while `agent` is set to `False`. `agent` mode could be
set to `True` only when `convai` and `state` are set to `False`.
In `state` mode `CRBP` sends two argument batches: utterances batch and state batch. State could be `None` or any JSON structure.
Argument names are stored at `config.json`.
In `convai` mode `CRBP` sends as utterance data received from [ConvAI Router Bot](https://github.com/deepmipt/convai_router_bot) as is.
Payload structure could be seen in `_get_message_dict` function from
[conversation_getaways](https://github.com/deepmipt/convai_router_bot/blob/master/convai/conversation_gateways.py) module.
In not `convai` mode `CRBP` sends only `text` field.
| CRBP mode | request payload |
|:---:|:---:|
| `convai=False`, `state=False`, `agent=False` | `{'x': ['a', 'b']}` |
| `convai=True`, `state=False`, `agent=False` | `{'x': [, ]}` |
| `convai=False`, `state=True`, `agent=False` | `{'x': ['a', 'b'], 'state': [, ]}` |
| `convai=True`, `state=True`, `agent=False` | `{'x': [, ], 'state': [, ]}` |
| `convai=False`, `state=False`, `agent=True` | `{'user_id': 74455, 'payload': 'Hello, Agent!'}` |