---
title: "Automize Fact Checking"
video_id: cphthkIzVDQ
url: https://www.youtube.com/watch?v=cphthkIzVDQ
workflow_page: https://workflows-of-ai.com/workflow/automize-fact-checking
language: en
captions: generated
---

0:01 hi guys Marcus here uh today's workflow
0:03 is very uh Drupal connected uh so you
0:06 have a workflow where you have jior
0:09 editor senior editors and maybe uni jior
0:12 editors are just allowed to add a
0:14 article but a senior editor has to check
0:17 check it and like uh actually check so
0:22 everything that's written inside it is
0:24 true so we're going to automate this I
0:26 will just show you in this case I'm
0:28 going to create two article here the
0:30 first one both are named who started
0:32 World War II and the article just says
0:34 in this case it's just one assumption
0:37 but it can check multiple assumptions of
0:39 course but in this case jingis Khan
0:41 started World War II I just save this
0:44 the other one says Hitler started World
0:46 War I maybe I should write a Hitler uh
0:51 and we save
0:52 this uh this is doing fact checks in the
0:55 background and if you take the jingus
0:58 Khan example you see oh it's not
1:00 published our senior editor stopped it
1:02 from being published because it's not
1:04 true and then we go to the other one and
1:07 it's published because it is true so
1:09 we're going to do this with a service
1:12 called tavali and I will show you now
1:15 how to set this
1:17 up oh actually uh one thing I will also
1:20 mention why Tav is important because you
1:23 might think why can't I just do this
1:25 with uh open AIG GPT just ask it via
1:28 open AI GPT right so one thing that's
1:32 important with GPT or any large language
1:34 model is to know that they are text
1:37 generators in their core they are not
1:41 chatbots they are not fact machines they
1:44 want to generate
1:47 text uh and this is important to have in
1:49 mind so even if you use chpt and you ask
1:54 it
1:55 something it might be that the question
1:57 it creates so the text it creates in the
2:01 end doesn't have the token space for the
2:05 facts that you need so it might not know
2:07 about the
2:08 effects uh or in uh when it's generating
2:14 things it has a certain amount of
2:17 creativity and this is something you can
2:19 use temperature and some other variables
2:21 to set up where it might actually be
2:24 creative enough to make up a fact even
2:27 if it has the facts so because of this
2:31 it uh sometimes writes an answer like it
2:35 actually
2:36 knows that is completely wrong and this
2:38 is called hallucinations right and
2:41 because of this it's important to know
2:44 that you should never use a large
2:46 language models or at least the ones we
2:48 have today to do this kind of shore so
2:54 what you want to do instead is there's
2:56 two steps of doing this so either you
2:59 take the large language model and you
3:01 ask it for something and then you have
3:03 some service after that actually
3:05 verifies this so for instance you can
3:08 this is something you can do when you're
3:10 looking for uh uh geographical addresses
3:14 using uh uh the address field with the
3:17 AI interpolator this will then ask open
3:20 AI to give me something uh give me a
3:23 places that you see and then it actually
3:25 uses Google Places to verify this uh but
3:30 in this case we want to do the opposite
3:32 then we want to have facts ready and put
3:35 them as context into the question where
3:38 we're asking uh GPT so it knows it's
3:42 going to base it on the facts it's not
3:44 going to base it on uh the things that
3:47 it's generating via its text and this is
3:51 where tavali comes in then because
3:53 tavali is actually searching the web for
3:56 your question and giving back some
3:58 context that you can use in open AI so
4:01 that's why it's important so with that
4:04 being said now starts the video on how
4:06 to set this
4:09 up so before I start showing you how to
4:12 set this up uh I would just remind your
4:14 workflows of AI exist you can check all
4:16 the old videos there if you're
4:17 interested um and you can also filter
4:20 and search by them so it's a little bit
4:22 better than YouTube uh but of course if
4:24 you're really interested in all videos
4:26 just subscribe to YouTube and you will
4:27 see them there there there is also so
4:30 you know AI interpolator is completely
4:32 documented nowadays so uh it's on
4:35 drupal.org you can find all the rules
4:37 all the different plugins uh kind of a
4:40 base idea at least what you can do with
4:42 the different rules and so
4:44 on uh what I am going to use in this
4:48 case and I have already installed this
4:50 so I'm going to use ECA because
4:54 ECA
4:55 uh I can't go through it now but I will
4:59 say as much as it's the most powerful
5:01 third-party module that
5:03 exists by far it's it's it's it helps
5:08 you uh get away from writing a lot of
5:12 code and it also creates a way where you
5:14 can visualize it for your in client so
5:17 if you don't know it go down the rabbit
5:19 hole of looking at videos and learning
5:22 this also uh their slack channel is
5:26 extremely helpful so you can ask
5:28 questions there and they are super nice
5:30 there and answering question so top
5:32 notch mod uh
5:34 module use it for stuff like what I'm
5:37 going to show now uh and so for the a AI
5:41 inator I have built in a a processor
5:44 plugin where you can basically say that
5:47 uh you want
5:49 to instead of using the normal AI
5:52 interpolator processors like queuing or
5:54 batching or direct saving API saving you
5:57 can say ECA takes care of it because
5:59 this will make sense in this case where
6:01 we want to make sure that that we don't
6:04 publish stuff that's false so that's the
6:07 inator ECA that will install the ECA
6:10 module so I have already done this I
6:13 have also then installed one of the GUI
6:15 component so if you start looking at
6:17 videos you know what it is which is the
6:19 BPM and uh doio in this case we're going
6:22 to need open AI uh so AI interat open AI
6:26 to make the uh uh step where we're
6:29 asking questions and also validating
6:31 from these questions and we're going to
6:33 need uh Tav then Tav is what I'm going
6:36 to introduce in this case um so if
6:40 you're going to do real research you
6:42 should not be using tavali tavali is
6:44 good for being it could be one of the
6:47 steps but I would say if you're going to
6:49 do real research use the Ser plugin
6:52 instead so that's the thing that
6:54 actually Googles for you and then use
6:56 one of the scraper modules to actually
6:58 get all the content
7:00 but if you're going to do simple uh
7:03 facts checks or simple searches where
7:06 you just want the small part from a
7:09 website that answers a question so you
7:12 can think of it as the widget you might
7:14 see on Google sometimes where you Google
7:16 something and it actually answers before
7:18 you can click a link which is a horrible
7:21 practice by the way it's useful but it
7:23 takes away so much traffic from the end
7:25 users anyway this does this then right
7:30 where it gives you back a little bit of
7:32 context and this is what we're going to
7:33 use here to to get this uh working so
7:37 what I have done is I have gotten all
7:39 these I have installed them then also
7:42 under configuration open AI I have added
7:44 the open AI key and another workflows uh
7:47 sorry web services Tav config I have
7:51 added uh the Tav config I will by the
7:55 way uh remove I already test ran this
7:58 one time so I'm I'm I had a ea model
8:01 model there I just remove that so I
8:02 create that from scratch so we're going
8:04 to start by creating a content type now
8:07 that is uh oh one more thing Tav gives
8:10 you 1,000 credits for free so if you
8:12 have open AI account but you're not sure
8:14 if you want to pay another service you
8:17 can test Tav at least uh we're going to
8:20 call this truthful
8:22 article uh the important thing is it's
8:24 going to be unpublished by default so
8:26 it's just going to get published if our
8:29 AI senior editor says that okay
8:32 everything in this thing is true right
8:35 going to create a remove the article
8:38 body I want to create my own Fields here
8:40 and we're going to do uh call this
8:43 article uh uh oh article body let's call
8:47 it that text formatted long so this is
8:49 where we put in the uh article this
8:52 doesn't need any AI connected to
8:54 it then comes the AI Fields then so what
8:57 we're going to start with is a plain
8:59 text takes plain long uh questions to
9:02 ask so this is basically the questions
9:05 it's going to ask the search engine for
9:09 uh to get context to see if the article
9:11 is truthful right so this has to be
9:14 unlimited because it might need to ask
9:16 more than one
9:17 questions uh it's open AI string long we
9:22 base it on the article body and then we
9:24 just write based on the context text
9:29 generate as many questions as you see
9:34 fit to test the
9:38 truthfulness of uh the assumptions in
9:42 the
9:44 article do not overdo it
9:49 usually one question per
9:53 assumption is
9:56 enough uh and
9:59 context and context so that context is
10:03 then the the actual article body that's
10:05 going to be paste in here when we send
10:07 this to open AI you can see that here in
10:09 the play Source holders available so
10:12 what's important here under advanced
10:13 settings our normal workers are not
10:15 important we just set the ECA we don't
10:17 care about weight this ECA will take
10:19 care of We Set uh I'm going to do GPT
10:23 for Turbo as the model save the settings
10:26 then we're going to do the next step
10:28 which is basically checking in Tav then
10:32 so we do Tav
10:35 lookup uh which will
10:38 be also
10:42 unlimited let me think yes because we
10:44 need one per question we enable Ai
10:47 interpolator and then there is this rule
10:49 Tav search word to
10:51 string and we're going to just use the
10:54 questions to ask as the context here and
10:58 that's it basically uh we don't need to
11:00 add anything there so we just set this
11:02 to ECA and here's important I'm going to
11:04 set it to concatenate because then it's
11:06 just going to create one big long
11:09 context field per question instead of
11:11 creating multiple per
11:13 question
11:15 um there are use cases where this makes
11:18 sense as well but in this case I will
11:19 just do that and the last thing I will
11:22 create is in this case uh you could
11:25 think that a Boolean is good here
11:27 because if it's true or not but is very
11:29 hard to write prompts for so there is AI
11:32 interpolator open AI Boolean rule but in
11:35 this case I'm going to use selection
11:37 list and do list
11:40 text and we're going to call this
11:43 truthful so is this truthful or not uh
11:48 and uh the allowed value is going to be
11:52 truthful right this is human readable
11:57 and uh
11:59 so not
12:02 truthful and in this case we can
12:04 actually limit it to one question uh
12:06 limit it to one value because we can ask
12:08 basically open AI to answer everything
12:12 at once and here's another
12:14 thing now I'm just showing the simplest
12:17 path to this there is a custom Fields
12:19 module where you can basically have
12:22 multiple uh types uh of field type
12:27 values inside one field
12:30 and this would be super useful if you
12:32 want to do this but you also want to
12:33 answer why it reacted something for
12:36 instance because that might be
12:38 interesting because you might read the
12:39 article and think no everything is
12:41 truthful why did you actually react this
12:43 right and then it will answer this I'm
12:45 not going to Showcase this there are
12:47 other videos where I work with the
12:49 custom uh field module if you want to
12:52 figure out how this works right um going
12:56 to enable the interpolator we're going
12:58 to use
12:59 oh happened there uh we're going to uh
13:03 use the open AI list string but in this
13:05 case we're going to use advanced mode oh
13:07 so I have token module installed by the
13:09 way here as well you need that for the
13:11 advanced mode so then I'm going to write
13:14 here based on the article
13:18 text would you say that all
13:24 assumptions in the text
13:27 is uh
13:31 truthful when
13:33 compared to the uh uh fact
13:39 context uh under here if it is
13:46 truthful
13:48 answer
13:50 truthful so these are the two options we
13:53 have otherwise answer
13:56 not truthful
14:01 right uh in theory we just need a uh
14:05 truthful actually because that's the
14:07 only thing that makes a change because
14:08 it is unpublished by default right but
14:11 anyway uh then we do article
14:16 text and I just do some uh
14:21 natural uh start and end here so the AI
14:24 understands that take
14:27 notes take the Artic
14:29 body we take the value I think because
14:32 that will have I'm not sure if it strips
14:35 the HML tags it's not so important you
14:38 can have HTML Texs the open AI can
14:42 understand that and then we do uh what
14:45 did I call it fact
14:47 context fact
14:49 [Music]
14:50 context oh I'm going to do another thing
14:53 here just for uh
14:56 verbosity going to do cap capitalize
14:59 those two and do it here as well so it
15:03 really does that
15:06 connection fact context and the fact
15:10 context is the answers we got back here
15:13 now then so that's what we call what do
15:16 we call that Fields question to ask it's
15:19 not heavily look up uh and we don't need
15:21 the Deltas in this case let me see so
15:25 this is marked here
15:27 [Music]
15:29 so uh we just need the uh whole field
15:33 everything
15:35 right
15:37 uh and that's it same thing here
15:41 connected to ECA we want gbd4 because
15:44 it's better at understanding stuff
15:47 reading stuff and then we're going to go
15:50 and create our ECA mod model
15:53 then uh so we create a new model we're
15:56 going to do this on
15:59 [Music]
16:00 um
16:02 on on truthful article pre- save so and
16:09 we're looking for the pre- event here of
16:16 content Truth for
16:18 article we're going to have the first
16:21 event which was questions to ask and
16:25 under here now then there is a AI
16:27 interpolator rule so this basically has
16:30 all the rules that you have set up
16:31 previously available here so we're going
16:34 to use questions to ask uh we don't need
16:37 to save in between there we can save at
16:41 the end possibly I'm not sure if that's
16:44 super
16:45 important
16:48 um I think it keeps the context there so
16:51 the second thing we want to do is Tav
16:53 look up
16:54 [Applause]
16:56 right uh and then
17:00 then we are also going to add the last
17:04 one which is
17:06 truthful
17:08 is
17:12 truthful
17:15 uh let me uh check think here if we need
17:18 to forward that value there no it should
17:23 be a aware now that this will work so
17:27 then uh the last task we need
17:30 is publish and I'm going to add a rule
17:34 in between there but I'm just going to
17:36 do this uh publish content item right uh
17:41 but in between there now we want to have
17:43 a rule that says Fe compare field
17:49 value is truthful so this last step
17:52 should only happen if it's
17:54 truthful uh the field name I of course
17:57 forgot the name of it
17:59 uh let me just open in a new tab field
18:02 truthful so if field truthful equals
18:07 truthful then it should go to this step
18:10 right so we save this I'm not sure if I
18:12 need to save there we're going to see
18:14 this now actually so I'm going just
18:16 going to add content and I'm going to
18:18 start with something truthful to see if
18:21 that works uh uh
18:24 Hitler started World War
18:31 uh I'm just oh that's the title I'm just
18:32 going to copy this to article body so
18:35 this should be true
18:36 right uh well had a hand in
18:42 starting World War II in I I think it
18:46 would understand that he was the main
18:49 reason but who knows uh we're going to
18:52 save this and now this ECA rule is
18:55 running
18:57 then uh
19:00 uh oh updating let me see just did I
19:04 actually do save
19:09 there where are we
19:11 here or is it that I need to save it
19:14 maybe uh I didn't do save entity
19:23 no let's just try to save this see if it
19:26 works
19:35 update existing node entity while
19:38 changing the ID is not
19:45 supported let me just see if this is the
19:48 problem
20:05 did I do something wrong here template
20:08 applied pre
20:15 save yeah in this should run only on
20:18 content
20:21 truthful questions to ask let me see so
20:25 I set all the fields here maybe I need
20:29 to actually create the error State
20:32 better here questions to ask is using
20:37 ECA t look up is using EA
20:43 truthful is using
20:49 EA
20:52 so I just turn this off
20:59 I we try
21:00 now it might be that I'm not allowed to
21:03 set that publish on creation but that
21:06 would be weird Okay so that could be it
21:10 so we I'm just going to add this now and
21:12 see if it works on update to start with
21:15 oh oh this is in the way uh publish
21:18 content item
21:21 so so this is I'm I'm testing this
21:24 actually for the first time I was
21:26 testing the other thing before but I
21:28 haven't tested this
21:30 publishing uh so uh uh uh this should be
21:35 compare field values field truthful it
21:40 was equals
21:43 truthful
21:45 and we
21:47 save see if it works now so here you can
21:50 see by the way we can just go through
21:52 what happened so far it asked the
21:54 question did Hitler's action directly
21:56 contribute to the onset of World War II
21:58 so I took this and as this question tely
22:01 looked up this and got a lot of context
22:04 here and based on this it says yes it's
22:08 true so I'm just going to try to save
22:11 now to see if uh no okay so this is
22:14 making it fail why is this making it
22:18 fail uh I want to publish the
22:29 maybe if I set
22:33 uh maybe this is not allowed on
22:37 pre-save I maybe need to change the
22:40 actual value let's see here let's use
22:42 another thing then uh value token set
22:47 value no entity set field
22:51 value uh uh yeah strip tags no no no
22:55 field name status
22:59 uh save entity yeah we save it f well no
23:03 we don't need to do field value should
23:05 be one let's see if this works better so
23:08 we try to publish this way
23:10 instead uh
23:13 and yeah you can maybe write in the
23:16 comments why this didn't work for me if
23:19 someone knows uh anyway
23:23 compare uh and compare field value was
23:27 what we wanted to do
23:29 check if
23:32 truthful so field
23:36 truthful equals truthful it should only
23:39 pass then right save this and we try
23:43 again yay this worked and it published
23:46 right so let's try this from uh start to
23:50 finish again I'm just going to copy this
23:53 delete this one content add content
23:57 Truth for article res set this and this
24:01 and hopefully it should now become a
24:03 published article of course by the way
24:05 you should not show the TBL up look up
24:08 and the questions to ask and all this
24:09 stuff that's just for the editorial
24:11 process right so you need to hide that
24:13 from the end user uh because what you're
24:16 trying to do here wait let let me just
24:19 do that so we have done that uh uh you
24:23 want to do this
24:25 right manage display you still want to
24:28 be able to see them in the back in the
24:30 form so we're just going to do this
24:33 because then this is all you see uh and
24:37 then we're just going to create
24:38 something that's not true uh
24:43 e edible
24:45 foods
24:48 uh
24:50 eating uh lead paint is
24:55 recommended like this is not a good
24:57 statement to put in article
24:59 right
25:01 um of course with the by the way with a
25:03 prompt you have to also add so it can be
25:06 sarcastic and figure out stuff like this
25:09 because this might be just be a a a
25:11 statement in the middle of a
25:13 sarcastic uh uh text right so you have
25:16 to engineer your prompt but here you can
25:18 see it's not actually published so in
25:22 this case our senior publisher stopped
25:25 it uh and what you will see here it's
25:29 not truthful it gets some context why
25:32 it's actually
25:33 dangerous uh uh and yeah it stops
25:38 it um yeah so that is it basically so uh
25:44 as you can see I I set up these
25:46 workflows while I'm testing them myself
25:49 just to see how stuff works so because
25:51 of this
25:53 um um there was some steps that failed
25:57 but that's good to see that it's not
25:59 always perfect I'm not it's open source
26:02 free I'm not trying to sell you a a
26:05 product here I'm just doing this for fun
26:07 and yeah uh trying to Showcase how you
26:10 can use this so thank you for watching
