Create a bot that reacts to user inputs
Prerequisites: Up and Running instance of EDDI (see: Getting started)
Let's get started
Follow these steps to create the configuration files you will need:
1. Creating a Regular Dictionary inside Parser
See also Semantic Parser
Create regular dictionaries in order to store custom words and phrases. A dictionary is there to map user input to expressions, which are later used in Behavior Rules
. A POST
to /regulardictionarystore/regulardictionaries
with a JSON in the body like this:
Example using CURL
:
Dictionary parameters
The returned URI is a reference for this specific resource. This resource will be referenced in the bot definition.
2. Creating Behavior Rules
See also Behavior Rules
Next, create a behaviorRule
resource to configure the decision making a. Make a POST
to /behaviorstore/behaviorsets
with a JSON in the body like this:
Behavior Rules parameters
You should again get a return code of 201
with a URI
in the location
header referencing the newly created Behavior Rules
:
eddi://ai.labs.behavior/behaviorstore/behaviorsets/
<UNIQUE_BEHAVIOR_ID>
?version=
<BEHAVIOR_VERSION>
Example:
eddi://ai.labs.behavior/behaviorstore/behaviorsets/5a26d8fd17312628b46119fb?version=1
3. Creating Output
You have guessed it correctly, another POST
to /outputstore/outputsets
creates the bot's Output
with a JSON in the body like this:
You should again get a return code of 201
with a URI
in the location
header referencing the newly created output :
eddi://ai.labs.output/outputstore/outputsets/
<UNIQUE_OUTPUTSET_ID>
?version=
<OUTPUTSET_VERSION>
Example :
eddi://ai.labs.output/outputstore/outputsets/5a26d97417312628b46119fc?version=1
4. Creating the Package
Now we will align the just created LifecycleTasks
in the Package
. Make a POST
to /packagestore/packages
with a JSON in the body like this:
Package parameters
Extension Types
New
Now you can use the new feature of defining properties in the package definition : This can be used by introducing an extension with type
eddi://ai.labs.property
which has the config
model as follows:
Description of eddi://ai.labs.property model
Example of eddi://ai.labs.property
You should again get a return code of 201
with an URI
in the location header referencing the newly created package format
eddi://ai.labs.package/packagestore/packages/<UNIQUE_PACKAGE_ID>?version=<PACKAGE_VERSION>
Example
eddi://ai.labs.package/packagestore/packages/5a2ae60f17312624f8b8a445?version=1
See also the API documentation at http://localhost:7070/view#!/configurations/createPackage
5. Creating a Bot
Make a POST
to /botstore/bots
with a JSON like this:
Bot parameters
b. You should again get a return code of 201
with a URI
in the location
header referencing the newly created bot :
eddi://ai.labs.bot/botstore/bots/
<UNIQUE_BOT_ID>
?version=
<BOT_VERSION>
Example:
eddi://ai.labs.bot/botstore/bots/5a2ae68a17312624f8b8a446?version=1
See also the API documentation at http://localhost:7070/view#!/configurations/createBot
6. Launching the Bot
Finally, we are ready to let the bot fly. From here on, you have the possibility to let an UI do it for you or you do it step by step.
The UI that automates these steps can be reached here: /chat/unrestricted/
<UNIQUE_BOT_ID>
Otherwise via REST:
Deploy the Bot:
Make a
POST
to/administration/unrestricted/deploy/
<UNIQUE_BOT_ID>
?version=
<BOT_VERSION>
You will receive a
202
http code.Since deployment could take a while it has been made asynchronous.
Make a
GET
to/administration/unrestricted/deploymentstatus/
<UNIQUE_BOT_ID>
?version=
<BOT_VERSION>
to find out the status of deployment.
NOT_FOUND
, IN_PROGRESS
, ERROR
and READY
is what you can expect to be returned in the body.
As soon as the Bot is deployed and has
READY
status, make aPOST
to/bots/unrestricted/
<UNIQUE_BOT_ID>
You will receive a
201
with theURI
for the newly created Conversation, like this:e.g.
eddi://ai.labs.conversation/conversationstore/conversations/
<UNIQUE_CONVERSATION_ID>
Now it's time to start talking to our Bot 1. Make a
POST
to/bots/unrestricted/
<UNIQUE_BOT_ID>
/
<UNIQUE_CONVERSATION_ID>
Option 1: is to hand over the input text as contentType text/plain
. Include the User Input in the body as text/plain
(e.g. Hello)
Option 2: is to hand over the input as contentType application/json
, which also allows you to handover context information that you can use with the eddi configurations 1. Include the User Input in the body as application/json (e.g. Hello)
You have two query params you can use to config the returned output 1.
returnDetailed
- default is false - will return all sub results of the entire conversation steps, otherwise only public ones such as input, action, output & quickreplies 2.returnCurrentStepOnly
- default is true - will return only the latest conversation step that has just been processed, otherwise returns all conversation steps since the beginning of this conversationThe output from the bot will be returned as JSON
If you are interested in fetching the
conversationmemory
at any given time, make aGET
to/bots/unrestricted/
<UNIQUE_BOT_ID>
/
<UNIQUE_CONVERSATION_ID>
?returnDetailed=true
(the query param is optional, default is false)
If you made it till here, CONGRATULATIONS, you have created your first Chatbot with EDDI !
By the way you can use the attached postman collection below to do all of the steps mentioned above by clicking send on each request in postman.
Create dictionary (greetings)
Create behaviourSet
Create outputSet
Creating package
Creating bot
Deploy the bot
Create conversation
Say Hello to the bot
External Links
Last updated