Skip to content

Commit abc5fa8

Browse files
committed
Added basic instructions for flowbot
1 parent de15d78 commit abc5fa8

File tree

3 files changed

+93
-6
lines changed

3 files changed

+93
-6
lines changed

bots/botflow/aiml/flightbookctrl.aiml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
<pattern>EXECUTE FLIGHTBOOK</pattern>
1313
<template>
1414
Ok, I'll book a flight matching the following:
15-
<get name="City" />,
15+
flying from <get name="City" />,
1616
<get name="London" />,
17-
<get name="Destination" />,
18-
<get name="Date" />,
19-
<get name="Passengers" />,
20-
<get name="Class" />,
17+
to <get name="Destination" />,
18+
on <get name="Date" />,
19+
with <get name="Passengers" /> passengers,
20+
in <get name="Class" /> Class,
2121
</template>
2222
</category>
2323

bots/botflow/flow/flightbook.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Step,Prompt,Variable,Type,Next,ConditionSOURCE,Where would you like to fly from,City,"Select(London, Edinburgh, Glasgow, Manchester)", DEST, =*, LONDON, =LondonLONDON,Where from in London are you flying from,London,"Select(Stanstead, Heathrow, Gatwick)", DEST, =*DEST,Where would you like to fly to,Destination,"Select(New York, Washington, San Francisco)",DATE, =*DATE,When would you like to fly,Date,Date(DD/MM/YYYY),PASSENGERS, =*PASSENGERS,How many people are flying,Passengers,"Int(1,5)", CLASS, =*CLASS,What class do you want to fly,Class,"Select(Economy, Premium Economy, Business, First)",
1+
Step,Prompt,Variable,Type, Next, ConditionSOURCE,Where would you like to fly from,City,"Select(London, Edinburgh, Glasgow, Manchester)", DEST, =*, LONDON, =LondonLONDON,Where from in London are you flying from,London,"Select(Stanstead, Heathrow, Gatwick)", DEST, =*DEST,Where would you like to fly to,Destination,"Select(New York, Washington, San Francisco)",DATE, =*DATE,When would you like to fly,Date,Date(DD/MM/YYYY),PASSENGERS, =*PASSENGERS,How many people are flying,Passengers,"Int(1,5)", CLASS, =*CLASS,What class do you want to fly,Class,"Select(Economy, Premium Economy, Business, First)",

src/utils/botflow/README.txt

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,91 @@ Dialog Flow Generate
44

55
Given a simple set of steps and basic instructions generates a flow based conversational dialog
66

7+
The first line of the csv should have the follow headers
8+
```csv
9+
Step,Prompt,Variable,Type,Next,Condition
10+
```
11+
12+
Each preceeding line should then match these columns headers as follows
13+
14+
> Step - The name of the step, used to direct the flow
15+
> Prompt - Text to display as the question ( template )
16+
> Variable - The name of the variable capturing the user input
17+
> Type - The type of the variable ( see below )
18+
> Next - Next Step ( repeats see below )
19+
> Condition - The condition that would move the flow to the Next Step ( repeats see below )
20+
21+
Type
22+
----
23+
BotFlow currenty supports the follow types of variable
24+
25+
> Int. A integer value that can have optional min and max restrictors
26+
Int - Int no min or max value
27+
Int(m) - Int with a max value
28+
Int(n,m) - Int with a min n, and max m value
29+
If the validation fails then the same question is asked for again
30+
31+
> Select. A list of items for the user to select from.
32+
Select(Item1, Item2, ... Itemn)
33+
If the validation fails then the same question is asked for again
34+
35+
> Date. A date value in the format dd/mm/yyyy
36+
A future release will allow the developer to set the date validation format
37+
If the validation fails then the same question is asked for again
38+
39+
Entry/Exit
40+
----------
41+
Flowbot creates a single entry step called START 'FLOWNAME', which you can call from outside of the flowbot grammar.
42+
Typically you would include in your grammar the following
43+
44+
<category>
45+
<pattern>I WANT TO BOOK A FLIGHT</pattern>
46+
<template>
47+
<srai>START FLIGHTBOOK</srai>
48+
</template>
49+
</category>
50+
51+
When the conversation finishes, the bot calls EXECUTE 'FLOWNAME', This grammar is not included and you should create
52+
your own static grammar to pick up the variables and process them. An example would be
53+
54+
<category>
55+
<pattern>EXECUTE FLIGHTBOOK</pattern>
56+
<template>
57+
Ok, I'll book a flight matching the following:
58+
flying from <get name="City" />,
59+
<get name="London" />,
60+
to <get name="Destination" />,
61+
on <get name="Date" />,
62+
with <get name="Passengers" /> passengers,
63+
in <get name="Class" /> Class,
64+
</template>
65+
</category>
66+
67+
Next/Condition
68+
--------------
69+
A list of pairs consisting of a Destination tag which should be a valid step in a subsequent item and a condition
70+
for which the step should be moved to. Typically this is one of the items from a Select statement. The first
71+
of the pairs should be =* which is the default Step if no other validation succeeds or exists.
72+
73+
74+
Example
75+
-------
76+
The example below shows all the currently available formats for a BotFlow csv file
77+
It demonstrates a basic flow for booking a flight.
78+
```csv
79+
Step,Prompt,Variable,Type, Next, Condition
80+
SOURCE,Where would you like to fly from,City,"Select(London, Edinburgh, Glasgow, Manchester)", DEST, =*, LONDON, =London
81+
LONDON,Where from in London are you flying from,London,"Select(Stanstead, Heathrow, Gatwick)", DEST, =*
82+
DEST,Where would you like to fly to,Destination,"Select(New York, Washington, San Francisco)",DATE, =*
83+
DATE,When would you like to fly,Date,Date(DD/MM/YYYY),PASSENGERS, =*
84+
PASSENGERS,How many people are flying,Passengers,"Int(1,5)", CLASS, =*
85+
CLASS,What class do you want to fly,Class,"Select(Economy, Premium Economy, Business, First)",
86+
```
87+
The steps are as follows
88+
SOURCE - Ask the user which city they want to fly from
89+
LONDON - If the user says London, an optional additional step that asks which airport in London to fly from
90+
DEST - Where do they want to fly to
91+
DATE - When do they want to fly
92+
PASSENGERS - How many are flying ( between 1 and 5 allowed )
93+
CLASS - Which class do they want to fly
794

0 commit comments

Comments
 (0)