[00:00.000 --> 00:15.560] Thank you. Thank you for having us. We are really happy to be there with the Kotlin community [00:15.560 --> 00:21.480] and the open source community today. It's really, really great. Welcome to the intermission [00:21.480 --> 00:29.120] between the great talks today. I'm François Nolen. I'm with Julien Buré. We both work [00:29.120 --> 00:37.120] at SNCF Connect and Tech, SNCF being the French railway company. At first, we wanted [00:37.120 --> 00:44.760] to introduce TOC, TOC, the open conversation kit. So TOC, it's an open platform. Maybe [00:44.760 --> 00:55.280] we can score a bit. In case you don't understand me, everything is written there. It's an [00:55.280 --> 01:03.200] open platform written in Kotlin to build chatbots, voicebots, callbots, conversational agents, [01:03.200 --> 01:12.000] and natural language processing applications. We started building TOC in 2016 when we started [01:12.440 --> 01:17.840] building production-ready business to customer chatbots for SNCF, which means for millions [01:17.840 --> 01:30.440] of French people, or millions of people in France, I should say. It builds on open source [01:30.440 --> 01:41.440] libraries, such as, at this time it was Apache, OpenNLP, and Stanford CoreNLP. To build chatbots [01:41.480 --> 01:48.160] and be able to build these conversational services without having only data scientists [01:48.160 --> 01:55.160] and experts and developers, we wanted not only to have something wrapping and encapsulating [01:55.160 --> 02:03.080] the NLP libraries with user interfaces, but also a conversational framework, Kotlin DSL, [02:03.080 --> 02:11.760] to be able to build the answers, a bunch of connectors to be able to integrate with our [02:11.760 --> 02:19.120] websites, our mobile applications, the messaging platforms such as Messenger, WhatsApp, Twitter, [02:19.120 --> 02:27.400] Slack, and smart speakers such as Google Home, Alexa, and more. So the solution we've built [02:27.400 --> 02:34.400] from open source foundations, we've shared it with the community on GitHub the year after, [02:36.240 --> 02:42.840] and now it's used by several companies and universities in the field of energy, banking, [02:42.840 --> 02:49.840] transport, and even healthcare. But I say the initial idea was to introduce TOC to you, [02:50.840 --> 02:59.840] and as you know, recently everything has changed in the field of conversational AI. That's why we [02:59.840 --> 03:05.840] won't do the initial presentation, and if you're disappointed, please go to the TOC AI website, [03:05.840 --> 03:12.840] and this link, this presentation is the demo we wanted to make initially, and you'll see [03:12.840 --> 03:18.840] the multi-channel capabilities and the analytics and everything that is in TOC. Now today, we'll [03:18.840 --> 03:25.840] try to do something a little more interesting and fun, focusing on code, because most time when [03:25.840 --> 03:30.840] people come and see me to know about TOC, they want to know how to build chatbots without having [03:30.840 --> 03:39.840] to code, with no code, and I assume you're more interested in Kotlin. So let's stop talking [03:40.840 --> 03:50.840] about TOC. Julien, could you run a new stack and create a chatbot running Kotlin from scratch, please? [03:58.840 --> 04:07.840] We'll use OpenNLP or Stanford. It's possible to integrate with other NLP models using their API [04:07.840 --> 04:14.840] integrating them through their APIs. Initially, it was OpenNLP and CoreNLP from Stanford because [04:14.840 --> 04:24.840] Java implementations are available, so it was really convenient to embed that in Kotlin. After [04:24.840 --> 04:30.840] creating an application, we will add a connector. The simplest connector is a web connector. It just [04:31.840 --> 04:38.840] exposes an API and we'll use it to have a web page and talk to the chatbot. And that's already [04:38.840 --> 04:46.840] done. You have a chatbot. We can talk to him. Okay, that's interesting. So we have a chatbot [04:47.840 --> 04:55.840] up on your name, but like Jon Snow, he knows nothing. So can you do something about it, please? I'd [04:55.840 --> 05:05.840] like to be able to say hello to the newborn. So we're in the language understanding section of TOC [05:05.840 --> 05:13.840] Studio, the graphical user interface, and you've just created an intent, so you create intents and [05:14.840 --> 05:22.840] entities inside the sentences sometimes. We'll see that a bit later. So we are training a new [05:22.840 --> 05:32.840] model to understand a greetings intent, and I'd like to have an answer. So as we said, we'll use [05:32.840 --> 05:39.840] only Kotlin to build the answers. Obviously, you can go inside the user interface, TOC Studio, and [05:39.840 --> 05:55.840] build answers, configure answers graphically. But it's really fun to code everything. Oh, really nice. [05:55.840 --> 06:06.840] And okay, we've got a chatbot. And yes, I like it. I had this question. I wanted to ask the chatbot. [06:06.840 --> 06:14.840] Okay, so you did something. You actually did something, and the answer is always different, but I'm [06:14.840 --> 06:23.840] quite disappointed by the answer. So we could do something else. I'm sure chatGPT could answer. [06:23.840 --> 06:42.840] Okay. So you decided to code nothing, in fact, and delegate everything to chatGPT. So you're using [06:42.840 --> 06:52.840] a Kotlin client, which is available in GitHub, just to perform the request. And so as I ask you to [06:52.840 --> 07:02.840] have answers to anything, actually, you just code something to delegate everything to chatGPT. That's it. [07:02.840 --> 07:21.840] Exactly. Okay, great. Exactly what I was expecting. So it's a GPT 3.5 model, this one. [07:21.840 --> 07:36.840] I hope you can read. It's not too small. Okay. Nothing really interesting in terms of Kotlin code there. [07:36.840 --> 07:48.840] So it's just a client to the chatGPT API, and you wrap it into a talk story so that the chatbot, when it triggers the [07:48.840 --> 08:03.840] right intent, it runs the client, calls chatGPT, and will have a chatbot answering anything in minutes. [08:06.840 --> 08:14.840] So let's try it. [08:36.840 --> 09:00.840] Okay. You've just tried it programmatically before trying with the chatbot interface. And we've got an answer from chatGPT. [09:00.840 --> 09:11.840] That's Matt. Instead of defining a new story for chatGPT and having our model to be trained to detect some intent, then [09:11.840 --> 09:23.840] trigger this story, you are using the new story, the chatGPT delegation, as a fallback story, which means every time the chatbot doesn't [09:23.840 --> 09:28.840] detect any intent, we'll have the chatGPT answer. [09:37.840 --> 09:47.840] Next time. I can't wait. Okay. That's the answer for chatGPT. Thank you. Congrats. [09:47.840 --> 10:00.840] No, we have a chatbot capable of answering about anything because the chatGPT does. I have to, I have to, sorry, you have to [10:00.840 --> 10:09.840] remember that tomorrow we go back to Paris. So could you please find something to get back? Yes, the train schedules from [10:09.840 --> 10:27.840] Brussels to Paris. I'm sure chatGPT will have the answer. Okay. Links to websites. Actually, there is our website. [10:27.840 --> 10:30.840] Okay. We've got another answer out there. [10:38.840 --> 10:48.840] Okay. So chatGPT definitely has the answer. But the problem is every time it's a different answer. [10:49.840 --> 11:02.840] We've got a real timetable there. But are we sure that's for tomorrow morning? Maybe. Actually, we did a test yesterday. Two days [11:02.840 --> 11:11.840] ago, we had no answers, no departure dates. Yesterday, we started having departure dates. But we also had answers for [11:11.840 --> 11:20.840] June, for September. And it wasn't always for tomorrow morning. So as we can see, every time we ask chatGPT, we [11:20.840 --> 11:30.840] apparently get a different answer, which could be a problem because we have to go back to Paris tomorrow. And we would like to [11:30.840 --> 11:45.840] have some predictability. You can find the real departure date maybe on our website. Obviously, that's really [11:45.840 --> 11:53.840] impressive and interesting to have a chatbot capable of answering about any question. But sometimes, in [11:54.840 --> 12:02.840] particular, when you're a big company and you provide a conversational service to answer your customers, sometimes for some [12:02.840 --> 12:10.840] use cases, you would like to control the answer to be able to guarantee it's always the same answer. It's the answer [12:10.840 --> 12:22.840] from your database or your API. So differently, we would like sometimes to have some predictability. It depends on [12:22.840 --> 12:32.840] maybe. But there, for the train schedule, it would be useful. So what did you do? You just created a new intent, [12:32.840 --> 12:43.840] train travel. You added the notion of entities, which is you train the model to tell them this sentence is train [12:43.840 --> 12:54.840] travel search. And the terms Brussels, Paris, and tomorrow morning have to be detected as entities, the origin, the [12:54.840 --> 13:04.840] destination, and the departure date. So you've just trained a new intent. And now we should have a custom story, [13:04.840 --> 13:16.840] not chat GPT this time, using these entities and these variables to perform a real search. Using, for instance, the [13:16.840 --> 13:32.840] SNCF OpenData API. And get a precise data always the same answer to the customer. So using the talk DSL, it looks [13:32.840 --> 13:43.840] like this. We add a new story. I didn't precise. When you run the program, there's a small WebSocket client which connects to the [13:43.840 --> 13:54.840] chatbot you've just started at the beginning. And it adds stories to the chatbot. So there you are defining a new [13:54.840 --> 14:10.840] story. And what does it do? It takes from the original sentence the origin entity, the destination entity, the departure date [14:10.840 --> 14:23.840] entity, and hopefully it's not text, it's already a date time. So it's been recognized, detected by the model we train. And it was [14:23.840 --> 14:33.840] openNLP, if I remember. And then you just have to call your favorite API, get the data, do things, implement business rules or [14:33.840 --> 14:48.840] anything, and put the result in traditional conversational widgets like buttons, cards. So we'll see what you choose to answer. [14:48.840 --> 15:07.840] A carousel, yes, for the departure dates. It would be great. So it's a generic DSL and model of widgets. But you also have [15:07.840 --> 15:17.840] specific widgets. When you integrate to specific channels like WhatsApp or Messenger, you might want to use a specific [15:17.840 --> 15:32.840] widget for your answers on these channels. So you are building a carousel with cards, a card for each proposal, and you take the... [15:32.840 --> 15:43.840] Yes, you've used the entities to perform the request to the open data client. And from the return proposals, you just have to build [15:44.840 --> 15:52.840] cards. I can't wait to see the results. There seems to be a nice image. [15:52.840 --> 16:13.840] We've got a natural language detection issue, because we had a chat GPT answer there. [16:13.840 --> 16:28.840] As you may know, it takes time to train a model. Obviously, it's not... With two, three, four sentences, you get a [16:29.840 --> 16:47.840] performance model. Okay, here is our custom story with the real proposals to get back to Paris tomorrow. That's great. And what about going by airplane? [16:47.840 --> 17:11.840] So in minutes, we've created a chatbot who is mixing chat GPT answers. And still some training to do. And several custom stories when we want to [17:11.840 --> 17:34.840] control the results. Okay, I'd like, as a company in railway, I'd like to have a custom answer for these questions and point out it's not so good for the [17:34.840 --> 18:00.840] planet to take airplane when I can take train. So you can configure something really quickly. Okay, that should do it. Maybe you've got a [18:00.840 --> 18:14.840] nice graph to show that. So that's the part for people who don't like to code. So for all the static contents and it's possible to build [18:15.840 --> 18:39.840] static stories and decision trees without having to code. Okay, and maybe we... Last question to ask why it's not so good. Maybe to go back to chat GPT answers. If we have time, not so much. So that's absolutely not the [18:40.840 --> 19:01.840] demonstration we proposed to do at the beginning. And we haven't seen much of the talk features or even the Kotlin DSL. But it's something a bit different, a bit new. And obviously, as you know, the chat GPT progress and [19:02.840 --> 19:17.840] everything they do at OpenAPI, it's really impressive. And every one of you knows about it. And for the moment, for companies like us, it's still... It may be difficult to integrate question answering like [19:18.840 --> 19:43.840] chat GPT because depending on the use case, we might want to control, supervise having a supervised model and control the results. Nevertheless, it can be interesting to integrate with chat GPT and other similar models to be able to answer many, many things with, in fact, really few code and training and [19:43.840 --> 20:06.840] efforts. And that's what we wanted to show you and to demonstrate today. You can, in minutes, create a chatbot in Kotlin, running Kotlin for other developers. It's also possible to write stories in JavaScript or Python. But let's stick with the best language in [20:06.840 --> 20:29.840] the world. So in minutes, you can have a chatbot Kotlin. You can integrate with very powerful solutions like chat GPT for question answering and choose to program your own custom stories when it's required to control the results and have a kind of guarantee of predictability. Thank you. [20:36.840 --> 20:37.840] Thank you.