Hello everyone!
In today's video we will learn about programming language.
What is a modeling language enabling guardrails for a conversational system.
Why was there a need for a new language?
Creating guardrails for a conversational system requires some form of understanding of how the dialogue
between the user and the bot unfolds.
Existing dialogue management technique such as flowcharts, state machine frame based systems are not
well suited for modeling highly flexible conversational flows like the one we expect while interacting
with an LLM based system like ChatGPT.
However, since learning a new language is not an easy task, colon was designed as a mix of natural
language and Python.
If you are familiar with Python, you should feel confident using colon.
After seeing a few examples, let's learn about some of the concept behind the language.
You'd see this term or hear this term a lot while we go through the other videos.
Canonical form.
User utterance flows, variables, actions, and rails.
Let's go into the details of each term that we just saw.
The very first one is a canonical form.
It is an intent of a user or bot utterance.
Let's take an example on the right side.
When a user says hi or hello.
That is an intent from the user that is categorized as user is expressing greeting here.
I need help with something.
I need your help.
These are the user inputs that are categorized as an intent from the user as user requests help.
Let's move on to the next terminology utterances.
It's a raw text coming from the user or the bot.
So in the scenario that we had just described above.
Hello and hi are the raw texts that are coming from the user or the bot, and those are the utterances.
The third term that will be used a lot is a flow.
It's a sequence of messages and events, potentially while adding branching logic, which is optional.
So in this case here define flow.
Greeting is a flow when user expressed greeting is identified as one of the canonical form.
It invokes the flow here.
Bot name.
Bot express greeting.
That's how the flow would work for the colon.
Let's move on to the next terminology.
Rails.
Specific rails is a specific way of controlling the behavior of a conversational system.
Example not talk about politics.
Respond in a specific way to a certain user request, etc..
This is how a typical rails configuration would look like.
Here we have canonical forms user utterances.
It also has bot canonical form and bot utterances.
So here when define flow greeting is identified, user express greeting is the first flow that gets
invoked that was invoked by the user.
It bot express greeting is the other flow that gets identified here.
So Herbert express greeting is hello there and bot ask.
Welfare is other flow that gets invoked in this stack of flows that are defined here.
The very last one here well in these slides is the event something that has happened and is relevant
to the conversation example user clicked something, user made a gesture, etc..
Nemo guardrails is an event based architecture.
So everything that you that you see or experience in the framework is going to be all event driven.
Well, there is one more topic that I missed actually that's that's a variable.
Let's see how variables in colon works.
So colon allows to use logical flows if else in the variable insert variables into our rails.
There are several ways to add variables in a flow.
References to context variables always starts with a dollar sign.
Example A dollar name is a variable.
All variables are global and accessible in all flows.
This.
This is very important while you are writing the colon file.
Context variables are typical, are dynamically typed and they can be booleans, integer floats, and
strings.
Variables can also hold complex types such as list and dictionary, but they can't be initialized directly
to this type of values.
That is, the value would come from the return value of an action.
So here is an example of a typical variable.
In this case.
Here, when this flow is invoked, define flow greeting.
If the name is part of the request, the bot would express greeting with the name.
Let's see how this would work in by an example.
So in our example here, I added a context rule and added a content with a dictionary that says Name
is John.
In here in our colon file I'll have to specify the name.
So if there is a name then invoke this flow which is bot express greeting.
It will go up here and say hello there.
And then it would ask about how are you feeling today.
So let's do this.
Here you go.
Hello there.
How are you feeling today?
But now we want to be very specific and want to ask the user, how are you feeling?
So in this case here, I added a name.
Okay.
There you go.
Hello there.
John, how are you feeling today?
So this context variable is global.
And you can access this across the whole colon file.
These are the variables you can use if else statements as well for the flows.
Thank you.