WEBVTT

00:00.680 --> 00:01.920
Hello everyone!

00:01.920 --> 00:05.120
In today's video we will learn about programming language.

00:05.440 --> 00:10.000
What is a modeling language enabling guardrails for a conversational system.

00:10.520 --> 00:12.640
Why was there a need for a new language?

00:12.960 --> 00:19.520
Creating guardrails for a conversational system requires some form of understanding of how the dialogue

00:19.560 --> 00:22.320
between the user and the bot unfolds.

00:23.120 --> 00:30.800
Existing dialogue management technique such as flowcharts, state machine frame based systems are not

00:30.840 --> 00:37.720
well suited for modeling highly flexible conversational flows like the one we expect while interacting

00:37.720 --> 00:40.880
with an LLM based system like ChatGPT.

00:41.440 --> 00:47.920
However, since learning a new language is not an easy task, colon was designed as a mix of natural

00:47.920 --> 00:49.800
language and Python.

00:50.440 --> 00:55.080
If you are familiar with Python, you should feel confident using colon.

00:55.200 --> 01:00.530
After seeing a few examples, let's learn about some of the concept behind the language.

01:00.930 --> 01:05.850
You'd see this term or hear this term a lot while we go through the other videos.

01:06.130 --> 01:07.370
Canonical form.

01:07.370 --> 01:12.090
User utterance flows, variables, actions, and rails.

01:12.770 --> 01:16.250
Let's go into the details of each term that we just saw.

01:16.650 --> 01:18.930
The very first one is a canonical form.

01:19.250 --> 01:22.250
It is an intent of a user or bot utterance.

01:22.290 --> 01:25.130
Let's take an example on the right side.

01:25.170 --> 01:27.370
When a user says hi or hello.

01:27.730 --> 01:33.930
That is an intent from the user that is categorized as user is expressing greeting here.

01:34.330 --> 01:35.730
I need help with something.

01:35.930 --> 01:36.930
I need your help.

01:37.490 --> 01:44.010
These are the user inputs that are categorized as an intent from the user as user requests help.

01:44.410 --> 01:47.730
Let's move on to the next terminology utterances.

01:47.850 --> 01:50.930
It's a raw text coming from the user or the bot.

01:51.930 --> 01:55.410
So in the scenario that we had just described above.

01:55.690 --> 02:03.850
Hello and hi are the raw texts that are coming from the user or the bot, and those are the utterances.

02:04.250 --> 02:06.970
The third term that will be used a lot is a flow.

02:07.370 --> 02:14.130
It's a sequence of messages and events, potentially while adding branching logic, which is optional.

02:14.530 --> 02:17.210
So in this case here define flow.

02:17.210 --> 02:23.450
Greeting is a flow when user expressed greeting is identified as one of the canonical form.

02:23.770 --> 02:25.250
It invokes the flow here.

02:25.570 --> 02:26.690
Bot name.

02:26.850 --> 02:28.650
Bot express greeting.

02:29.090 --> 02:31.410
That's how the flow would work for the colon.

02:31.650 --> 02:33.890
Let's move on to the next terminology.

02:34.170 --> 02:35.050
Rails.

02:35.450 --> 02:40.690
Specific rails is a specific way of controlling the behavior of a conversational system.

02:40.810 --> 02:43.810
Example not talk about politics.

02:43.810 --> 02:48.690
Respond in a specific way to a certain user request, etc..

02:49.490 --> 02:52.490
This is how a typical rails configuration would look like.

02:52.570 --> 02:55.570
Here we have canonical forms user utterances.

02:55.850 --> 02:59.540
It also has bot canonical form and bot utterances.

02:59.900 --> 03:06.580
So here when define flow greeting is identified, user express greeting is the first flow that gets

03:06.580 --> 03:08.620
invoked that was invoked by the user.

03:08.980 --> 03:13.460
It bot express greeting is the other flow that gets identified here.

03:14.340 --> 03:18.140
So Herbert express greeting is hello there and bot ask.

03:18.140 --> 03:23.820
Welfare is other flow that gets invoked in this stack of flows that are defined here.

03:24.340 --> 03:31.060
The very last one here well in these slides is the event something that has happened and is relevant

03:31.060 --> 03:37.500
to the conversation example user clicked something, user made a gesture, etc..

03:38.340 --> 03:41.540
Nemo guardrails is an event based architecture.

03:41.860 --> 03:48.300
So everything that you that you see or experience in the framework is going to be all event driven.

03:48.540 --> 03:53.180
Well, there is one more topic that I missed actually that's that's a variable.

03:53.540 --> 03:56.060
Let's see how variables in colon works.

03:56.340 --> 04:03.740
So colon allows to use logical flows if else in the variable insert variables into our rails.

04:04.500 --> 04:07.260
There are several ways to add variables in a flow.

04:07.540 --> 04:11.540
References to context variables always starts with a dollar sign.

04:11.860 --> 04:14.740
Example A dollar name is a variable.

04:15.060 --> 04:18.740
All variables are global and accessible in all flows.

04:19.340 --> 04:19.780
This.

04:19.780 --> 04:23.060
This is very important while you are writing the colon file.

04:23.940 --> 04:30.740
Context variables are typical, are dynamically typed and they can be booleans, integer floats, and

04:30.740 --> 04:31.540
strings.

04:31.780 --> 04:39.060
Variables can also hold complex types such as list and dictionary, but they can't be initialized directly

04:39.060 --> 04:40.540
to this type of values.

04:40.980 --> 04:45.260
That is, the value would come from the return value of an action.

04:45.500 --> 04:48.940
So here is an example of a typical variable.

04:49.380 --> 04:50.140
In this case.

04:50.140 --> 04:54.100
Here, when this flow is invoked, define flow greeting.

04:54.820 --> 04:59.270
If the name is part of the request, the bot would express greeting with the name.

04:59.550 --> 05:02.070
Let's see how this would work in by an example.

05:02.430 --> 05:08.950
So in our example here, I added a context rule and added a content with a dictionary that says Name

05:08.950 --> 05:09.750
is John.

05:10.110 --> 05:13.790
In here in our colon file I'll have to specify the name.

05:14.670 --> 05:19.670
So if there is a name then invoke this flow which is bot express greeting.

05:19.790 --> 05:22.310
It will go up here and say hello there.

05:22.590 --> 05:25.670
And then it would ask about how are you feeling today.

05:25.910 --> 05:27.110
So let's do this.

05:27.230 --> 05:27.950
Here you go.

05:28.150 --> 05:28.790
Hello there.

05:28.790 --> 05:30.070
How are you feeling today?

05:30.270 --> 05:36.750
But now we want to be very specific and want to ask the user, how are you feeling?

05:37.590 --> 05:40.390
So in this case here, I added a name.

05:40.430 --> 05:40.950
Okay.

05:41.110 --> 05:41.910
There you go.

05:42.350 --> 05:42.870
Hello there.

05:42.870 --> 05:44.630
John, how are you feeling today?

05:45.070 --> 05:47.630
So this context variable is global.

05:47.630 --> 05:50.790
And you can access this across the whole colon file.

05:51.270 --> 05:55.870
These are the variables you can use if else statements as well for the flows.

05:56.070 --> 05:56.710
Thank you.
