---
# System prepended metadata

title: AWS Lex in abc123 Instruction
tags: [Dragon Cloud AI]

---

AWS Lex in abc123 Instruction
===
**Author: Po-Wen (Steven) Fang**

###### tags: `Dragon Cloud AI`
---

[toc]

## Recent Updates
```
Time Zone: Taipei Time UTC+8
Reverse Chronological Order
```

2020-07-03 13:10 :point_right: Published version 3 of abc_Vtuber (Steven)
2020-07-02 16:30 :point_right: Modified intents (Jeff)


## Introduction
Lex is a chatbot service provided by AWS, which allows us to define intents, utterances, responses  according to our business logics. We can configure it easily via its [console](https://us-east-1.console.aws.amazon.com/lex/home?region=us-east-1#bots:) or via AWS CLI.

Currently our product is using [abc_Vtuber](https://us-east-1.console.aws.amazon.com/lex/home?region=us-east-1#bot-editor:bot=abc_Vtuber) to provide dialogues for users.

### How Unity interact with Lex
![](https://i.imgur.com/8pDXKrz.png)

**Lambda 1** ([abc123_From-Unity-To-Lex](https://console.aws.amazon.com/lambda/home?region=us-east-1#/functions/abc123_From-Unity-To-Lex?tab=configuration)) 
Handles the interaction between Unity and Lex, we configure parameters in this Lambda function to decide which alias of chatbot that we are calling.

```py 
post_content(botName, botAlias, userId, contentType, accept, inputStream)
```
check out official documents for detail methods.
* [Lex API](https://docs.aws.amazon.com/lex/latest/dg/API_runtime_PostContent.html)
* [boto3 LexRuntimeService](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lex-runtime.html)

**Lambda 2** ([abc123_lexBot_test](https://console.aws.amazon.com/lambda/home?region=us-east-1#/functions/abc123_lexBot_test?tab=configuration))
Advanced configuration for Lex, we can add more complicated conversations and logic here.


---

### Aliases of Chatbot
We assign different versions of the chatbot to an alias, which enable us to have 2 different voice in 1 chatbot. Moreover, this could avoid interrupting current product when we are making updates to the chatbot.

Currently we have 2 aliases with identical content but different voice:
* Ivy_June: using Bot version 3
* Justin_June: using Bot version 2





## Work Flow of Making Updates

**This process will push updates directly to abc123, therefore we should be very cautious.**
![](https://i.imgur.com/soljXUp.png)

1. Modify the chatbot according to current needs
2. Check the modified contents again
3. Set output voice to Ivy and build the chatbot in Lex console
4. Publish this version and assign it to alias Ivy
5. Set output voice to Justin and build the chatbot in Lex console
6. Publish this version and assign it to alias Justin





## Useful Resources
https://chatbotslife.com/aws-lex-insights-after-building-my-shakira-chatbot-663f71967902