Salesforce

Classify content

« Go Back
Information
Classify content
000004250
Public
Product Selection
aiWare - aiWare
Article Details

AUTOMATE STUDIO USER GUIDE

To classify content using Automate Studio, the flow takes a text file URL, runs it through a content classification engine, creates an output of categories based on the text excerpts, and emails you a summary.

Step 1: Log in to Automate Studio

  1. Log in to automate.veritone.com.
  2. Click + New flow. Give the flow a name. The palette window appears.

Step 2: Set the aiware in node

  1. Drag the aiware-in node onto the canvas, then double-click the node. The node properties open. Select the following:
    • Click Output format and select Simple.
    • In the Manually Inject Data section, select Sample Input > Default.
    • In the Edit JSON tab, paste the following code:
    {
        "url": "https://pollin8-ab.s3-us-west-1.amazonaws.com/sample-2.txt"
    }
  2. To close the node properties and save the changes, click Done.

Step 3: Add a cognition node

  1. Drag the cognition core node onto the canvas next to the aiware in node. Wire the two nodes.
  2. To open its properties, double-click the Cognition - Core node. In node properties, select the following:
    • In the Name field, enter "Content Classification."
    • In the Category dropdown, select Content Classification.
    • In the Engine dropdown, select eContext Classify (IAB) V3.
    • In the Advanced Settings section, under the Cluster option, select "prd5 - Adhoc Cluster."
    • In the Job Priority dropdown, select Very High.
    • Check Wait for results. This pauses the flow and proceeds to the next node only when the job is done and the results are generated.
  3. Click Done to close the node properties and save the settings.

Step 4: Modify data using a custom function

  1. Drag the Function node onto the canvas next to the cognition core node, then connect the nodes.
  2. Double-click the Function node, then rename it to Format Results.
  3. Copy the code below and paste it in the Function node.

    This code iterates through the Engine Result and groups all categories found by the Cognition node into an array. It then generates an output that's sent to the logged in user. The output of this function is returned in the msg object in a new property that you created at runtime and named emailBody.

    var output = []
    msg.payload.aiware.engineResult.object.forEach(function(source, index) {
        var categories = [];
        
        (source.objectCategory || []).forEach(function(category) {
            if (category.class) {
                categories.push(category.class);
            }
        }); 
    
        output.push(`<i><b>${categories.length ? ('(' + categories.join(', ') + ')') : ''}</b></i> ${source.text !== undefined ? source.text : ''}`);
    })
    
    var last = msg.payload.aiware.engineResult.object.pop();
    var summary = [];
    (last.objectCategory || []).forEach(function(category, index) {
        if (category.class) {
            summary.push( (index+1) + '. '+category.class);
        }
    }); 
    
    
    var fullOutput = JSON.stringify(msg.payload.aiware.engineResult.object,null ,2);
    
    msg.emailBody = `
    Congratulations on running your Automate Studio flow! The Content Classification engine has just finished processing <a href="https://s3.amazonaws.com/static.veritone.com/sample.txt">this sample input file</a>, here are the results:
    <br><br>   
        ${output.join(' ')}
    <br>
    <br>
    Summary of Categories below
    <br>
        ${summary.join('<br>')}
    <hr>
    <br>
    Want to do more with this flow? Here are some suggestions to try out:
    <br>
    <br>
    1. This email is sent via the aiware-email node. It is a great tool for debugging or notifying you when a process is complete. Try changing the email subject and re-run the flow. <a href="https://docs.veritone.com/#/automate-studio/getting-started/README?id=step-2-add-nodes-to-your-flow">Learn more</a>. 
    <br>
    <br>
    2. Try changing the input data by editing the "url" within the input node. <a href="https://docs.veritone.com/#/automate-studio/getting-started/README?id=step-3-add-cognition">Learn more</a>.
    <br>
    <br>
    3. Want to get even more technical? Check out the raw output below. Inside the flow, this output exists in the variable msg.payload.aiware.engineResult.object, try looking for it in the 'debug' panel on the right. <a href="https://docs.veritone.com/#/automate-studio/Training/crawl"> Learn more</a>.
    <br>
    <br>
    <hr>    
        ${fullOutput}
    `;
    return msg
  4. Click Done to close the node properties and save the changes.

Step 5: Get user details

  1. Drag the user details node onto the canvas next to the previous node.
  2. Connect the top gray circle of the Function node to the User details node.

Step 6: Configure the email node

  1. Drag the email node onto the canvas next to the previous node, then connect the success output of the User Details node with the email node.
  2. Double-click the email node. The node's properties appear.

Step 7: Get notified if the job succeeds

  1. In node properties, make the following changes:
    • In the To Email section, select the Input Type dropdown, then select msg.. In the Input field, enter payload.aiware.user.name.
    • In the Email Subject section, select the Input Type dropdown, then select string. In the Input field, enter Automate Hello World Content Classification.
    • In the Email Body section, select the Input Type dropdown, then select msg.. In the Input field, enter emailBody.
  2. Click Done to close the editor, then click Done again to close the node properties and save the changes.
  3. Drag the aiware out node onto the canvas next to the previous node.
  4. Copy the node and paste it below the original.

Step 8: Get notified if the job fails

  1. Double-click the copied node to open the Node Properties. From the Output Status dropdown, select failure.
  2. Connect the aiware email node's success output to the aiware out [success] node.
  3. Drag three link out nodes onto the canvas below the content classification, get user details, and email nodes, then connect each of them to the Failure output of the node above.
  4. Drag a link in node onto the canvas in front of the aiware out [failure] node, then connect the nodes.
  5. Select the link out nodes one by one and connect each of them to the link in node.

Step 9: Run the flow

  1. Select the checkbox on the aiware-in node.
  2. Follow the job progress and debug the node from the Debug window by selecting the bug icon on the sidebar.

The flow completes in a few minutes and the results are sent to your email.

Additional Technical Documentation Information
Properties
7/30/2024 8:26 PM
7/30/2024 8:27 PM
7/30/2024 8:27 PM
Documentation
Documentation
000004250
Translation Information
English

Powered by