Using Document Intelligence Classifier in Flow (AI Academy)
good morning good afternoon good evening everybody Welcome to AI Academy as everybody is joining us I'm just going to go through our introduction slides to get us started today as always in this Academy session we tend to cover everything that's available in the product today but if you have questions about the road map or if we mention items or products that are not available yet please look at the safe h on notice and check back with your account team before making any purchasing decision if you are new to Academy what is that so it's content that we bring for you to bring you fresh ideas to provide a better understanding and practical guidance on our AI products this include AI search now assist gen virtual agent task intelligence document intelligence Etc this session is recorded and the recording will be be available publicly on our YouTube channel later but if you are here with us today it's a great opportunity for you to ask your questions so for that please you please use the Q&A panel in zoom and we'll get your questions answered as always I want to share that we have a few additional resources available for you we have a general generative Ai and intelligence Community Forum that you can access with a simple link sn. works slai on this community Forum we have a lot of resources articles that is written by experts as well as questions that can be asked by the whole community and everybody can ask can be helped and participate as I mentioned the recording will be available on our now Community YouTube after the session and specifically for the session today there are two preview sessions that could be very helpful to get you started the first one is when we introduced the document classifier which is a capability that came in Vancouver so I put the link here and the second one was a video around get started with document intelligence for data extraction today we're going to start with a quick overview and then we'll jump into most of the session will be an exercise on an real instance and then we'll save some time at the end for questions today we're going to talk about using document intelligence classifier in flow and in fact we'll be building an end to end classifier to extraction flow to cover the step of searching through documents with AI and then routing that to a data extraction to extract the data so when we add these two capabilities together in a flow we can save a lot of time for document based processes and increase agent productivity as well as automate repetitive cases now as I mentioned we're going to be building a flow so I would say that today uh if you are an intermediate level service administrator or developer it's probably better because we all get pretty deep into a flow so if you are not that's fine you can follow along but just a quick warning so let's talk about what we'll be building today so in this exercise I'm going to be receiving three different documents from any incoming Channel that I can have on the now platform so it could be a record producer it could be an email it could be my virtual agent conversation but I don't know what type of documents I just know it could be one of three types so I'm going to use document CL classifier to classify those documents so it's going to give me the category or the class of the document and then based on that information I'm going to be able to route that document to the right workflow if it's a US person form I can extract the form by using my document intelligence extraction for my form and then do some additional steps in the flow if it's a stock transfer request I can extract data from that request and put that on the record so that I can later call an integration same if it's a bank authorization I can use the right document extraction use case to extract the form and then update some record on the platform and if no category is found uh I just want to Route the case to an agent to be manually reviewed so before we get started uh we're going to be building that flow so what we need is a trained use case for document classifier so that was covered in a previous session but we're going to leverage that today so we're going to need that use case for document classified that's already built and already trained is going to be our starting point so we won't be building that today but we'll use that as a starting point and then for each of these different type of documents I have a trained use case for data extraction that's uh the part that was covered in the get started with document intelligence data extraction session again we'll be using those uh use case as they are already trained I'm not going to cover the training part of that I do want to mention that if we have a use case for data extraction I want to deactivate the flows since I'm going to be kind of tweaking and rearranging the flows to integrate with data document classifier I'm going to deactivate the flows for the data extraction use cases and then add my logic in the flow today and as a starting point I'm going to use a table that I created that I call intake form it's really a way for me to trigger my workflow um so it's just an example of a way to do it but do really um use that more as a framework and use that as you see fit for your own specific cases here again I'm starting with a table that I call intake and then finally um I did change a system property on my instance before getting started uh because I could see that the extracted value table was not showing as a table in my flow in my flow designer so I I there's a certain property that you can change to allow some system tables to be shown on the drop down menu when you uh look for look up the records or something like that all right so with that being said I'm going to go back to my instance and let's get started so again we'll be looking at building that flow I'm only going to pick a specific piece of it so that we don't take too much time today but as a starting point I want to upload documents to a table that creates a new record and then I want to pafy those so let's get started with that so I'll go into my instance I'll refresh here so I have the intake table that I'm going to use as an input so whenever a record is created on that table there's some attachments to it I want to classify them so for that I'm going to go to my flow designer and I'm going to start by creating a new flow so my flow I give it a name uh choose the application and I make sure that I run that as the system user all right it's created so I need to trigger so as as I said when a new record is created in my intake table I can trigger uh I can start my flow all right in my flow what I'm going to do first is to create a new document task so for that I'm going to add the action create record that's under service now call and a create record and I'm using the document task so I want to create a new document task and for that task the use case that I select is my trained model for document classifier so that Finance train model is my document classifier model that I'm going to use to generate the predictions of my uh attachment I also have to add a source table and that's the table from the trigger record as well as a source record and that is also coming from my source record and that's the record itself so trigger record and then I'll just add a display name so that I can know later what that task was for so it's a classifier task for and I'll just add um the number of my task here is the number fil there you go all right so every time I create a new record with attachment I create a document task so I can start predicting the the category of my attachment uh to actually trigger the prediction I have to use a an action that's available on global here it's called doc process a document task if what if we um yeah we have to make sure that after the document task is created I I I make sure to process it otherwise it doesn't trigger the prediction so that's an important step here all right so when that's done document classifier is going to predict the category of my attachments and then I can continue my flow all right so I'm going to wait so I'm going to add weight condition here that's under service now call wait for condition I'm going to wait for my predictions to to be done so whenever my um document task record here is has been done so the status done I can move on with the flow so the status will change to done whether we are on full automation mode and the prediction were on a certain range of confidence and the pr were done or if an agent went and manually did the review so is a cases could lead to the the task being done all right once I'm done with uh well I'm done waiting I can move on to look for the results of those classification so I'll look at the results and that's going to be part of um the extracted values so I need to look up for multiple records and I'm going to look for the extracted value so that's the that I mentioned at the beginning there's a system property if you don't see the value extracted value here you might need to add the table to your system properties so that it shows here and what I want to do is that for all the extracted values that are coming from my document task and that are not empty so the field is not empty I can continue so what I'm what is seeing what is saying here is that for each of the documents that I that went through the document classifier each of those is going to result is going to return a prediction and each of those predictions is a category for my uh attachment so now that I that I'm going to Loop through them all so for each of those records do something and the something I'm going to do is going to depend on uh the type of of classification and to get the type of classification and the the data that's returned by the document classifier I'm going to have to pass the result and so for that I need to create a quick action so I create an action and in that action I create a few input um so first is the extracted value record so I'm going to use that record here as an input for my action and I'm going to use the document ID type with the extracted value so that's my input and then I want to pause so there is a field on that record that contains all the information related to my classification and so that's a string but it's part it's for as a Json so I want to pass that here so for that I'm going to get that that that field value and that's um I'm going to input that into my script and so that value is so my input the record and then the data field okay and I want to pause that and then I'm going to from that I'm going to extract two different piece of information one is the document ID and that's a string and the other output is the page number and that's an integer all right and then a very quick line of code here and it's just that I I take that input my extracted value data let's make sure it's the same and I just pass it as a Json and then I get the document ID that I store in my output as well as the page number so that's for the script and then I make sure to create output outputs um and so one of them is the actual category and that category I'm going to call it name and it's going to be a string there is the document ID that came from my script and then the page number and that's my integer all right I'm going to sign those so the name is actually in the extracted value record itself in the field and it's the name of the field and then the document ID was just the output of my script uh script step as well as the page number here all right I can publish that action and I will add it to my main flow so I get [Music] the I we add it here so my action was pause classifier extracted data so I get that as an input it's the record that I'm looping through and then as I mentioned I'm going to get different type of information uh I want to look at specifically for for the sake of time here I'm going to look at only one one case and the use case the case is that is going to be that if the name so the name again is the category if the C category of my document is stock transfer then I'm going to extract the form I'm also going to add the page number here as a condition because if my document has multiple pages I only need to know that the first pages is uh the beginning of my document so I I add a condition that the page number is one and if that's the case then I can go ahead and create an extraction document task so for that I'll use the doc Intel action available in global to create a document task and then I'll call it extraction task for and again it's my trigger record number here for the the task definition so the the use case because I'm looking at stock transfer request I assign the use case to be stock transfer request and I need a source table that's my intake table my source record ID that's the C ID of my intake record that triggered my flow and this is where I'm going to use the document ID that I extracted from the classifier fire the the document ID here is used as a filter so that the extraction only applies to the specific document that was classified as a stock transfer request so that's done for the document task and then as previously after I created the task I have to start the predictions so for that I'll use the process a document task action and I reply I'll send that to my document task that I just created all right so at that point an attachment came in it was classified as a stock transfer request we created a data extraction task to do the extraction what happens after that I want want to so first I need to get my document task record so you see when I use the create a document task actually only gave me the C ID now I I want the the record itself so I'll just do a quick look up on the document task I'll just say that my CIS ID is the C ID uh the ID that came as the output of Step number eight here so once I have my document uh task I can wait for it to be completed just like we did for um the do the classifier task I I wait for the record to be done and once it's done again it means that the extraction was done and I can do something with the data and to get the data first I have to do a retrieve I have to use another action from Doc Intel that's Global doc Intel retrieve the fields value so that gives me all the information that was extracted from my document and so for that I have to input the task once I have my values I can actually create a new record I create a record in a table that I called stock transfer request and that table has all the fields that I want the data to be stored in and they are all mapped in my uh document data extraction use case that's how I know which um field to use to store my data I'll just give it a short name and again I'll use the number of my incoming task as a information to know which one I'm looking at so I created that stock transfer request record and then I want to update my document task so the document intelligence task so that I know that so I get the document task that I create for extraction here and what I'm going to change here is that I want to change that the um table has changed now that I have a new record I'm going to use the table for the stock transfer request as well as the source recall being that same um recall here so for that I need the C ID uh so that I know where to send my data so I just need to update that here and then finally I'm going to finish by looking for another action in Doc Intel that's called set field values so set field values is going to apply all my extracted values so the ones that I got from my step 12 it's going to apply that to my document task that I know is in my step 10 and apply that to a Target record which is the target create record here now there's a little caveat here is that that's actually the C ID so there we go and that's it I can activate my flow and now I can see how it looks like end to end but saving my flow and uh we'll create a new record here so there we go so I create a new record and I I attach three different files they have all different types and we're going to see how the flow is going to go end to end from a task with three different attachments that we don't know what they are up all the way up till the end of extracting information um so if if sorry if we I want to show that in the flowchart again we uploaded our document it's going to be sent to classifier who's going to decide it's going to help us predict which category the document is in and then based on the category we can roll different flows so to see how that looks like we are go to uh classifier use case so Finance train here and we'll make sure that a new task classifier task was created that one was created just now and it's doing the predictions all right perfect uh I could you know if you use doing you know sometimes it takes a few minutes to process uh in that case I will just move forward and do that manually but if you wait it will do the classification automatic Al so you see I have three different documents and I categorize them they all have different categories now when I submit it my task changes to done so the task is executed and then the flow should continue and to verify that now I'll go to my list of the document task for extraction see if I add a filter on the task that was just created in the last 15 minutes I do see that I created my task here from the flow and I see that the attachment filter has a value and I see that the use case is the use case The Right Use case here so I can open that one and I will wait for that one to process uh because there's a lot of information to extract it's just easier um when AI helps me do that actually so you see that's my form uh I will wait a minute or two for that to process if that takes too long I'll just do it [Music] manually all right in the interest of time I'll just do that manually and I'll just do the one value here all right of course as I started it was done so I'll just overwrite my uh manual entry and just let AI do the prediction so here I got my values it's exactly what I wanted so I can submit my task so my task is submitted the status changes to done and if I refresh my task here I see that the values were extracted and I see that the source record was changed and it's been changed to that new record I created and that's the record with all the information so I'm going back to my slide here we uploaded three different documents that we didn't know what they were document classifier did classify them and find that one of them was a stock transfer request so I extracted my stock transfer request stored the data on the record on the platform and then obviously I can go on in that case I would want to call an integration so that the process keeps on going and the process is automated so that was it for today let me see if they have any questions all right the question is what does prediction input do I am not sure I understand the question all right if you have any other questions feel free to add them to the Q&A panel and K if you want to give more details around your question I can answer it right now I don't understand it okay on the yeah on the document task absolutely sorry for that all right so if I go back to my use case and look at the document class pacifier our use case it created a task and the question is what what is that prediction inputs tab here that that just um additional information on what's happening with the the different attachments I have three different attachments so I have three different records here uh but I I don't really need that for for what I'm doing here I'll just look at the extracted values prediction inputs is um actually might be a tab that I added myself it's it's more things that happening in the background related to how the AI gets the the attachment and makes the predictions but in my case what I'm really looking at is the extracted value because this is the output of my AI model that really gave me the category so in the field uh field colon here this is the category of my document and um so the question is does the document classifier uses predictive intelligence to predict the type of document no no it doesn't use predictive intelligence that's a different type of of model uh that uses information in the document as well as images and um text so it's both text and images from a document and it's able to predict the category based on uh the the training that the user can can do on that so it's separate from predictive intelligence and as it relates to that somebody's also asking what kind of license this is available for this is available uh through a separate license that you can uh purchase via automation engine or via a a a different product but you need
https://www.youtube.com/watch?v=q2QSEEjUnOs