Skip to content

Commit

Permalink
Merge pull request #363 from kalliope-project/dev
Browse files Browse the repository at this point in the history
Kalliope Release 4.6
  • Loading branch information
Sispheor authored Oct 3, 2017
2 parents b1e58f2 + 5969d19 commit be55bea
Show file tree
Hide file tree
Showing 108 changed files with 3,967 additions and 1,545 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ before_install:
- sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse"
- sudo apt-get update
- sudo apt-get install $(cat install/files/deb-packages_requirements.txt)
- sudo apt-get install libstdc++6
- sudo apt-get install libstdc++6 libpython3.4-dev
- wget https://bootstrap.pypa.io/get-pip.py
- sudo python get-pip.py

Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
v0.4.6 / 2017-10-03
===================
- add core neuron: neurotimer
- add core neuron: mqtt
- add core signal: mqtt
- new feature: community signal now supported
- dict can be used in global variables
- bug fix: python 3 execution with snowboy lib
- new feature: kalliope memory
- add espeak tts to core
- add stt options. manual or dynamic threshold
- Fix: neurotransmitter bracket in answer

v0.4.5 / 2017-07-23
===================
- add keyword_entries attribute to CMU Sphinx
Expand Down
3 changes: 3 additions & 0 deletions Docs/brain.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Brain is composed by synapses: a synapse is the link between input and output ac
An input action, called a "[signal](signals.md)" can be:
- **an order:** Something that has been spoke out loud by the user.
- **an event:** A date or a frequency (E.G: repeat each morning at 8:30)
- **a mqtt message** A message received on a MQTT topic
- A signal made the community
- **No signal**. Then the synapse can be only called from another synapse or by the API

An output action is
- **a list of neurons:** A [neuron](neurons.md) is a module or plugin that will perform some actions like simply talking, run a script, run a command or call a web service.
Expand Down
4 changes: 2 additions & 2 deletions Docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
## Prerequisites

Please follow the right link bellow to install requirements depending on your target environment:
- [Raspbian (Raspberry Pi 2 & 3)](installation/raspbian_jessie.md)
- [Raspbian (Raspberry Pi 2 & 3)](installation/raspbian.md)
- [Ubuntu 14.04](installation/ubuntu_14.04.md)
- [Ubuntu 16.04](installation/ubuntu_16.04.md)
- [Debian Jessie](installation/debian_jessie.md)
- [Debian Jessie/Strech](installation/debian.md)

## Installation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# Kalliope requirements for Debian Jessie
# Kalliope requirements for Debian Jessie/Strech

## Debian packages requirements

Edit `/etc/apt/sources.list` and check that you have `contrib` and `non-free` are enabled:

On Debian Jessie:
```bash
deb http://httpredir.debian.org/debian jessie main contrib non-free
deb-src http://httpredir.debian.org/debian jessie main contrib non-free
```

On Debian Strech:
```bash
deb http://httpredir.debian.org/debian strech main contrib non-free
deb-src http://httpredir.debian.org/debian strech main contrib non-free
```

Install some required system libraries and softwares:

```bash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Kalliope requirements for Raspbian

## Install the pre-compiled disk image
## Install via the pre-compiled disk image

Download the last image [from the release page](https://github.com/kalliope-project/kalliope/releases) of Kalliope and load it as usual onto an SD card.

Expand All @@ -14,10 +14,12 @@ The two starter config files are located in `/home/pi` for [French](https://gith
## Manual installation

Supported Raspbian images:
[raspbian-2016-09-28](http://downloads.raspberrypi.org/raspbian/images/raspbian-2016-09-28/)
[raspbian-2016-11-29](http://downloads.raspberrypi.org/raspbian/images/raspbian-2016-11-29/)
[raspbian-2017-01-10](http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-01-10/)
[raspbian-2017-04-10](http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-04-10/)
- [raspbian-2016-09-28](http://downloads.raspberrypi.org/raspbian/images/raspbian-2016-09-28/) (Jessie based)
- [raspbian-2016-11-29](http://downloads.raspberrypi.org/raspbian/images/raspbian-2016-11-29/) (Jessie based)
- [raspbian-2017-01-10](http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-01-10/) (Jessie based)
- [raspbian-2017-04-10](http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-04-10/) (Jessie based)
- [raspbian-2017-08-16](http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-04-10/) (Strech based)


> **Note:** It is recommended to use a **lite** installation of Raspbian without any graphical interface for a better experience.
Expand Down
155 changes: 154 additions & 1 deletion Docs/neurons.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,160 @@ As this is multi-lines, we can put the content in a file and use a `file_templat
file_template: /path/to/file/template.j2
```
## kalliope_memory: Store in memory a variable from an order or generated from a neuron
Kalliope can store in a short term memory:
- output parameters from a neuron
- variable parameters captured from an order.
Stored parameters can then be used in other synapses during a future call.
Please not that this memory is not preserved after a restart of Kalliope.
### Store parameters generated by a neuron
Syntax with output parameters from a neuron
```yml
- name: "synapse-name"
signals:
- order: "my order"
neurons:
- neuron_name:
kalliope_memory:
key_name_in_memory: "{{ output_variable_from_neuron }}"
other_key_name_in_memory: "{{ other_output_variable_from_neuron }}"
```
Syntax to reuse memorized parameters in another synapse
```yml
- name: "synapse-name"
signals:
- order: "an order"
neurons:
- neuron_name:
parameter1: "{{ kalliope_memory['key_name_in_memory'] }}"
parameter2: "{{ kalliope_memory['other_key_name_in_memory'] }}"
```
>**Note:** The key name need to be placed into simple quotes
Example with a core neuron like `systemdate`
```yml
- name: "synapse-name"
signals:
- order: "my order"
neurons:
- systemdate:
say_template:
- "It' {{ hours }} hours and {{ minutes }} minutes"
kalliope_memory:
hours_when_asked: "{{ hours }}"
minutes_when_asked: "{{ minutes }}"
```

Here, the `systemdate` neuron generates variables that haven been passed to the template like described in the previous section and to the memory of Kalliope.

Those parameters can now be used in a next call
```yml
- name: "synapse-name-2"
signals:
- order: "a what time I've asked the time?"
neurons:
- say:
message:
- "at {{ kalliope_memory['hours_when_asked']}} hours and {{ kalliope_memory['minutes_when_asked']}} minutes"
```

As it's based on a template, the value can be modified by adding a string
```yml
kalliope_memory:
my_saved_key: "{{ neuron_parameter_name }} with a word"
```

Multiple parameters can be used and concatenated in the same memorized key
```yml
kalliope_memory:
my_saved_key: "{{ neuron_parameter_name1 }} and {{ neuron_parameter_name2 }}"
```

### Store parameters captured from orders

Syntax
```yml
- name: "synapse-name"
signals:
- order: "my order with {{ variable }}"
neurons:
- neuron_name:
kalliope_memory:
key_name_in_memory: "{{ variable }}"
```

The syntax to reuse memorized parameters in another synapse is the same as the one used with neuron parameters
```yml
- name: "synapse-name"
signals:
- order: "an order"
neurons:
- neuron_name:
parameter1: {{ kalliope_memory['key_name_in_memory']}}
```

Example
```yml
- name: "synapse-id"
signals:
- order: "say hello to {{ name }}"
neurons:
- say:
message:
- "Hello {{ name }}"
kalliope_memory:
friend: "{{ name }}"
```

Here, the variable "name" has been used directly into the template and also saved in memory behind the key "friend".
The value can now be used in a next call like the following
```yml
- name: "synapse-id"
signals:
- order: "what is the name of my friend?"
neurons:
- say:
message:
- "It's {{ kalliope_memory['friend'] }}
```

Here is another example brain whit use the `neurotimer` neuron. In this scenario, you want to remember to do something

> **You:** remind me to call mom in 15 minutes<br>
**Kalliope:** I'll notify you in 15 minutes<br>
15 minutes later..<br>
**Kalliope:** You asked me to remind you to call mom 15 minutes ago

```yml
- name: "remember-synapse"
signals:
- order: "remind me to {{ remember }} in {{ time }} minutes"
neurons:
- neurotimer:
seconds: "{{ time }}"
synapse: "remember-todo"
kalliope_memory:
remember: "{{ remember }}"
seconds: "{{ time }}"
- say:
message:
- "I'll remind you in {{ time }} minutes"
- name: "remember-todo"
signals: {}
neurons:
- say:
message:
- "You asked me to remind you to {{ kalliope_memory['remember'] }} {{ kalliope_memory['time'] }} minutes ago"
```


## Overridable parameters

Expand Down Expand Up @@ -172,4 +326,3 @@ You can override all parameter for each neurons like in the example bellow
```

>**Note:** The TTS must has been configured with its required parameters in the settings.yml file to be overridden. See [TTS documentation](tts.md).

35 changes: 35 additions & 0 deletions Docs/rest_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Kalliope provides the REST API to manage the synapses. For configuring the API r
| POST | /synapses/start/id/<synapse_name> | Run a synapse by its name |
| POST | /synapses/start/order | Run a synapse from a text order |
| POST | /synapses/start/audio | Run a synapse from an audio sample |
| GET | /mute | Get the current mute status |
| POST | /mute | Switch the mute status |

## Curl examples

Expand Down Expand Up @@ -306,6 +308,39 @@ Curl command:
curl -i --user admin:secret -X POST http://localhost:5000/synapses/start/audio -F "file=@path/to/file.wav" -F no_voice="true"
```

### Get mute status

Normal response codes: 200
Error response codes: unauthorized(401), Bad request(400)

Curl command:
```bash
curl -i --user admin:secret -X GET http://127.0.0.1:5000/mute
```

Output example:
```JSON
{
"mute": true
}
```

### Switch mute status

Normal response codes: 200
Error response codes: unauthorized(401), Bad request(400)

Curl command:
```bash
curl -i -H "Content-Type: application/json" --user admin:secret -X POST -d '{"mute": "True"}' http://127.0.0.1:5000/mute
```

Output example:
```JSON
{
"mute": true
}
```

## No voice flag

Expand Down
Loading

0 comments on commit be55bea

Please sign in to comment.