0:00
This video is sponsored very freely give. If you need help with Drupal and AI, get in contact with us. So, Drupal AI 1.20 alpha 1 is out. It's ready to be tested.
0:12
You can try it out. There's a lot of new features uh in it. It's not feature complete yet.
0:18
There's going to be bugs in it, but uh it's there so you can start testing it. And I'm going to showcase uh maybe the most important feature uh at least that you see and at least for
0:33
agencies that works with uh heavy editorial workflows and that's a module called form um form widget actions that comes with the AI module now. And what this does is I have a movie overview
0:48
content type here. I've just copied something uh and say that I want to add a subtitle to my movie review. Now then there's a button here. So what this is doing it's uh contacting an automator
1:03
where we have a business specific uh uh workflow where you could in theory when you click on this button go out on the internet uh uh Google you know scrape websites get PDFs do a
1:18
lot of this cool stuff that you can do with the automator in this case we're just asking it to create a subtitle and this has like I think it has around 100 plugins of things it can do now. So,
1:31
I'm just going to showcase something completely else. Maybe you get, you know, the images like this from a photographer. This doesn't mean anything. It's really bad SEO. We
1:43
just click our rewrite file name. The uh the what's going to happen now is that the AI goes and looks at this image, reads this review, and thinks of a actual good file name for this. This is
1:57
also added in 1.2. to O. So this is a automator as well, which means if you have thousands of images on your website that has really bad file names, you can run the automator through them and it
2:09
actually creates better file names for it. On the actual review, there is a edit summary. Well, there's a summary field here, right? No one ever fills it in. It
2:19
just takes the first paragraphs. Well, no one I never fill it in. Now I can click summarize. It's going to look at this and create a summary for it.
2:30
Um, and here we go. We have a summary. And if I don't like it, can just click again. It's going to create another one.
2:42
Uh, and these are based on my very specific prompts. Once again, I can go look at all the other content that I have on the website. While I'm doing this, I can set up a really complex
2:53
process happening in the background here. Last thing we want to do is generate or pick tags. So in this case, it says that it's science fiction and it's a dinosaur
3:05
reboot and it's basing this on this review. So how do we set this up? So let's get started. So the important thing is you get the alpha module. Uh sorry 1.2 alpha 1. Uh I will show you
3:21
that I have gotten that. You can see it here. Uh I also have gotten token module and admin toolbar. Token is for the automator admin toolbar. It's just to make it easier.
3:35
So we're just going to go ahead and uh create those. I will also say I have created a key already for OpenAI. I'm going to use OpenAI in this case to showcase everything. So we install
3:48
OpenAI Automators admin toolbar and admin toolbar extra tools and then the form widget actions which is the new module that we have that can trigger the automators.
4:07
Uh, and when we have this done, the first thing we're going to do is just turn on the OpenAI key here under OpenAI settings. And that makes OpenAI available for everything. And what I
4:29
thought we would do in this case, we're going to create a content type called uh movie review.
4:38
And we're going to yeah we get a body field from the start. I guess that's fine but we should rename it. We call it review in this case. So we have a review.
4:56
Uh the next thing we want is uh a tagging field. So we're going to take references taxonomy term tags uh and all right this is available already. We're on a standard
5:14
installation so we can just reuse existing field tags and same thing with image. We might want to have a image that describes uh some scene of the movie.
5:33
So uh and then we're going to create a field that is also uh uh let's see should we take a optional let's take a number field in this case.
5:50
uh no let's take a selection list integer rating so I mean there is the rating field there is a automator for it we don't have yet though uh a form widget action for this which
6:08
is something that we would have to create then uh and we do five. I think that should be fine.
6:24
And so actually I'm um I just realized I can't use the list here. The reason for that is that uh what we're doing here is that when you're exposing something uh to the form
6:43
um to the form widget action uh and you're creating some kind of processor for it. So basically a processor what should happen when you click on this button here on the entity
6:58
form field any module can go in and say hey I want to be a processor here I want to change something but this then has to define which fields you're doing this on
7:11
uh so this is a plug-in system where you create one of these where you can say you know like this that I am for the widget type text text area with summary and the field type text with summary and
7:23
we don't have one for list integer by the time 1.2.0 always out. I hope we have one for every automator field that exists.
7:33
Uh and I can also mention that since it's a plug-in system, anyone can then uh connect to this uh where they can um where they can create a processor and this exists already for AI agents. it
7:55
exists for the core module AI content suggestion and also ECA has an integration in well so far 3.0 but I think it's going to come to 2.0 Z as well where you can actually create uh a
8:08
field widget action process using ECA that is completely custom. This means that you can set up really custom things without actually coding. If you want to code, you can also create a plug-in. Say
8:22
that you have a dam or a API for instance you could have that when you add a ID from this dam and click on a button it up gets this image something like that. uh and this works on any
8:34
complex field. It can get addresses, full address fields and stuff like that. So anyway, now we have then set up our uh entity uh with the fields and in theory. Now we
8:47
could then go in and like uh save a movie review. So, I'm just going to for the fun of it here, start creating a movie review.
9:04
So, uh oh, there's one thing I want to do. So, I'm going to upload an image without all things. So, I'm not going to set it required because I'm going to showcase
9:16
what we can do. Uh, and what now we can do is then create the movie review. Superman 2020. Oh, no. Let's do something else first. Let's just order this because this makes no sense to order it.
9:40
Subtitle should come under then. Yeah, the review is under the image. Rating and text comes last.
9:51
Um, so we will now save uh the review field. We could maybe have made uh uh required. I guess I'm going to take something here. IGN.
10:12
Sorry I will copy and paste your review here. So some uh I have to copy and paste it in pieces because there's a lot of advertisement there. Let's just add the verdict because that will be interesting
10:42
for the rating of course. So um let's just set a heading four there. So we save this.
10:54
So we have our uh oops the whole thing there became a heading which is not great.
11:04
should be like this and this should be a paragraph. No, that will not work. So then, so um so we have this. Now we're going to start setting up things for the editor.
11:24
So let's go to our manage fields and we're going to say, oh, there's one more thing I want to do.
11:33
I want to already upload an image. So, let me just find some image here. Uh, there we go.
11:46
Put it home. So, I just downloaded some image there and I don't fill out the old text now because that's what we want to add, right?
11:59
So, what I'm going to do now is go to manage fields on the image. We want to have a button that creates all text in this case. And you might have seen the image uh the AI alt text. The AI image
12:17
all text the module is called. I I'm part uh co-maintainer there. It's cool and all. The problem with this it it can't actually take uh any um context from what's happening around it.
12:35
Right? So that's what we're going to do now. So we're going to say that we want to use advanced mode which can use tokens then because then we can put in stuff like uh the title here for
12:48
instance. Wait, let me see here. Um, so we're going to say, uh, look at this image and create an alt text that is under 100 characters long so it doesn't get cut off by screen readers. And then
13:10
we also say uh you will be given uh a title and a movie review as context. This is for a movie uh review website.
13:31
Please make it quirky because I know like uh that is what Total Film does at least. Uh they make like this quirky uh uh quirky things where they write something
13:50
funny around the image. Right? Maybe that doesn't belong in all text. I just want to try it out now so you can see that it is based on the actual title in the body because what you will see
14:03
otherwise is that we're using OpenAI in this case. So I'm just going to say here uh wait right I will explain this. So I've created the prompt that creates this
14:15
right I'm going to set field widget here. So what field widget as a automator worker does it means it doesn't save it and this means that you have to create a button that uh
14:27
dynamically generates this. We're going to take the default vision module in this case and use the image field and uh we're going to use a image wide 190. And what I want to test here, I was going to
14:41
say this because our image model now is OpenAI is that OpenAI is not allowed to actually uh tell which persons it sees. So if you try to ask it what persons are on an
14:53
image in the API, uh it often refuses that. There are ways you can try to like get it to do it, but by default it doesn't do it.
15:03
Uh so now we have added the all text on the image. So I forgot to say that you have the different automated uh types. So you can actually create the image. Uh you can
15:17
also this is something we added in 1.2. You can rewrite the image file name. So in this case the file name was like superman something. But say that the file name is DSC000025.jpeg.
15:30
This is bad for SEO and you might have hundreds of this. So this is a place where you can use the automator to actually look at the image and rewrite the file name of the image.
15:41
Uh rating you should not use LMS for this. I will just showcase it as example. Uh we use base mode in this case. We will just look at the review and say uh on a scale of one to five where one is
16:00
bad and five is good please set a a rating for this review uh review and then well I can show you there's these placeholder so there's a lot this is a lot simpler than token
16:20
once again we're going to set field widget. So the automator weight that's for automation that doesn't matter in this case but it's important that you always say field widget if you don't
16:30
want automation in this case. Uh then we're actually going to use the body as well. We have filled in the body right but there is one thing we didn't fill in the the body and that's the summary. So
16:42
there is actually now a new uh automator in 1.2 to again protect summary where we're going to look at the review and say write a summary for this review that is
16:58
two to three sentences long. Can write movie review to give it some more context. Right?
17:08
view context again just use field widget um and we have the review subtitle. Same thing here that we use and text simple paste it on the review.
17:27
Write a subtitle that is not the name of the movie that is under 250 characters and in one sentence that explains their movie review.
17:51
movie review. Um, so, oh, I think you hear my Slack messages now. Let me just turn that off.
18:05
Uh, we said field widget there as well. We don't want to extract anything. Oh, that's a bug fix we should do. Actually, it should be null by default.
18:15
And then the last thing is tags. And here we have create reference entities if they do not already exist. And because of that, we can actually tell it to create stuff. So I'm just going to
18:28
actually copy this. So this is the default prompt for uh choosing category. Uh based on the context, create up to two categories from the category that fits the uh
18:47
create two tags that fits the text. That is a movie review. Make sure that one of them is genre context context. And now you might wonder like if it's just going to make
19:12
up stuff, it's going to like say action and adventure and then maybe create a tag that's called action adventure. So what you can do then? Oh, field widget again. We can also say we all want them
19:24
to be lowercase. But we can add this find similar tags. Then it's also after it's trying to generate them, it's looking do we have something that's similar? So it doesn't recreate them. So
19:37
now we have created all that. So next thing I will say is um maybe we don't need this UX. Maybe this should actually already be set up because you show field widget actions. But this is
19:51
two steps right now. So you have to go to manage form display and then on everything that you want to fill out you have to click uh the cog wheel and there will be field widget actions where you
20:04
can say you want to add an action. Uh you can uh create the button label or you have to enable it as well. Uh add subtitle we call this button uh and which automator to use because
20:21
you could have multiple automators. We don't really have a good UI for that. That's a issue we have. But uh the example where you want to add all text but also change the file name for
20:31
instance is uh uh is possible. So you could add multiple field widget actions uh to any any field. So you can have multiple buttons in there. So now we're going to use the automator image. No,
20:47
we're going to use the automator all text. That's what we added. enable uh generate alt text we call this and we pick the image default uh do the same for the review then we
21:03
say generate summary is that what we're going to do here called the button summarize you don't have to fill in that there is a default value there but it's nice to have personalized buttons I
21:16
guess uh number generator enable guess uh rating and you can probably think of a actual useful use case for the uh integer field. I hope I just took something you
21:38
should not really do. So we're enabling uh generate pickax and Click update and we're going to save this. And um actually change your heart. I'm not going to have it to wait. That's that's
22:03
h that's not a good thing. You can probably think of better ways of doing that. Uh what you can do with the numeric field. I mean you can extract numbers or something. Anyway, when we go
22:15
to the Superman review now, then there are all these buttons all of a sudden. So, we can just click them. Add subtitle.
22:25
And you see it actually creates some subtitle. Can click the generate all text. And it's hopefully going to say Superman.
22:34
It does. That's not how Total Film would write it, but uh yeah, you get the idea.
22:41
You can base it on other context. So you can create your perfect alt text in this case. So if we click edit summary here, you see there's nothing there. So if I
22:51
click summarize, it's going to be something there. And you see it has added a summary for you. And the thing also here then as compared to automators, automators
23:04
does not run if the um if the value is filled out. So I will just show something. Now if I click save, you see the tags is not filled out. If I had a normal automator
23:17
that's not a field widget, this would have been filled out when I save. But because we choose field widget action, it doesn't run. But the other cool thing is here then if I'm not happy with this,
23:28
this is maybe a bad example. You might be happy with part of it and you start rewriting it. Typical human in the loop.
23:34
But if it's really bad or if it's failing, you can just click again. And it doesn't care that there is actually something in there. It's going to add something new again.
23:45
And last thing we're going to do then is generate P tags. And you will see it's a new site. It created these tags. They didn't actually exist. So there's a superhero and cinematic universe. And
23:59
we're going to save this. uh they were lowerase because I set it to be lower case. I guess superhero is the journey in this case. I can show you also if I uh click here again it might
24:11
yeah you see choose a superhero again because it should search for either superhero or something similar to superhero. So it doesn't generate stuff every time you do it. And then when
24:22
you're happy you can just save. And that is it. That is form widget actions.