- Refs
save user-bot conversation on database dialogflow-> will match text with intent -> logic query -> matched with intent -> then provide answers
steps:
- google dialogflow & NLU
- flask/python, api, mongodb..
- testing & deployment
https://dialogflow.cloud.google.com/
- create agent
- create intents, entity, training, pharses, action, response
-
Default welcome intent
-
Default Fallback intent -> whenever bot doesn't understand
-
welcome intent ->
-
training phrases
-
need to create multiple intents
-
Responses : text / quick replies (boutons)
-
recognize pattern -> via entities -> action
- create knowledge base
- as csv, or html -> has question/answers
- to store ex: FAQ
- create
- fullfilment & integration
- fullfilment -> connect with Flask (backend)
- integration -> deploy..
-
create account
-
find suitable free api with less latency
- choose latency as 100ms
-
test copy token
-
used in flask webApp
=========Webhook======== https://cloud.google.com/dialogflow/docs/fulfillment-webhook
-
It must handle HTTPS requests https://cloud.google.com/serverless https://cloud.google.com/products/compute
-
must handle POST requests with a JSON WebhookRequest body.
-
must respond to WebhookRequest requests with a JSON WebhookResponse body.
https://www.youtube.com/watch?v=vRQ9RrGjQis
-
teaching chatbot state
-
using context -> to trigger chatbot intent
-
output context (intent1) -> awaiting_name
-
input context (intent2) -> awaiting_name
-
actions -> in value -> use $name
-
thanks $name
-
what's your email, #awaiting_name.name?
https://www.youtube.com/watch?v=8g3aVYPY7d4&list=PLJLSPq0cTRma_kxRrNSAxcQKUxARMf2Vf
- getting user's contact data
============
- id -> RE2 (google regex) https://github.com/google/re2/wiki/Syntax
.
[xyz]
[^xyz]
xy -> x followed by y
x|y -> x or y
x* -> zero or more x
x+ -> 1 or more x
x? -> zero or 1 x
x{n,m} -> repition
x{n,} -> n or more
x{n} -> exactly repeated x n times.
x*? -> zero or more x
grouping :
(re) -> capturing group
i -> case insensitive
^ -> beginning string
$ 0> end text
[\d] digits (≡ \d)
[^\d] not digits (≡ \D)
\d digits (≡ [0-9])
[[:digit:]] digits (≡ [0-9])
https://cloud.google.com/dialogflow/docs/entities-overview
Entity type: Defines the type of information you want to extract from user input.
https://cloud.google.com/dialogflow/docs/integrations/telegram
custom payload:
{
"telegram": {
"text": "You can read about *entities* [here](/docs/concept-entities).",
"parse_mode": "Markdown"
}
}