Accessing Machine Learning Models with Camunda’s Hugging Face Connector for Business Improvement

Operationalize your processes with AI and machine learning to improve how your organization interacts with clients.
By
  • Blog
  • >
  • Accessing Machine Learning Models with Camunda’s Hugging Face Connector for Business Improvement

Connectors to external technologies have become a strong way to enhance your business processes, automating tasks that may have previously been very time-consuming or error-prone. With Camunda Marketplace, new connectors are often available—from both Camunda and our partners—providing more connections to the latest and greatest technologies.

This post will discuss using different machine learning models from the Hugging Face community to showcase the new Hugging Face AI Connector.

Prerequisites: To run this Connector, you must have an API key for Hugging Face. You can review our documentation for Hugging Face for where to obtain this key.

What is Hugging Face?

Hugging Face is a platform for accessing machine learning models, datasets, and applications. You can select models developed and available from the Hugging Face community. Choosing a paid plan also gives you additional functionality and access.

Using machine learning models for business improvement

Artificial intelligence (AI) and machine learning (ML) have become part of our daily lives, and they have great potential to improve business performance, customer satisfaction, and more.

  • What if you could automatically route customer inquiries to the proper department by sending the email content to a model so it can predict the subject or department based on that text?
  • Wouldn’t it be wonderful if you could get in front of a possibly faulty part by classifying customer support inquiries and social media posts that negatively mention the part?
  • How about knowing a customer’s perception of your company and products before cross-selling new products into the account or assessing renewals?

These are some simple examples of how machine learning models can help you improve your business performance and customer experience while reducing or even eliminating traditional human tasks.

Sample use cases

In this blog, you’ll learn how to use two different Hugging Face community models. You’ll review the results of each and then learn how you can make business decisions using these results. The premise will be around reviewing comments made on social platforms and review sites so you can mitigate any negative customer perception as quickly as possible.

You’ll run through two simple examples with two different ML models:

  • Review the top three (3) emotions conveyed in a message or comment with a confidence score from the ML model for that emotion.
  • Review the overall sentiment of a customer comment (positive, negative, or neutral) and route it to the proper customer success department based on the results.

Note: The examples in this blog post can be found in this GitHub repository.

Reviewing conveyed emotion

In the first use case, you’ll be looking at the emotions conveyed in a message from a customer so your organization can handle it appropriately.

BPMN process for the emotion evaluation

First, you will want to create a BPMN process. For this example, you’ll need a main process with a start and end event with two user tasks around a Connector call to Hugging Face. Something like the one shown below will work.

Workflow showing main process

The first human task has a form for entering a customer comment—this would most likely be fed from another system, but manually enter it in this case. The task after the Hugging Face Connector will have a form for displaying the Connector’s results, or you can view these using Operate.

Now, you’ve created a simple form to type in a message for the Enter Customer Comment user task.

Customer comment field

In this case, the customer comment was stored in the variable customerComment.

For your Hugging Face Connector, this customerComment is passed to a Hugging Face model for finding emotions (https://huggingface.co/SamLowe/roberta-base-go_emotions). You’re extracting the top three (3) emotions and confidence scores from the response and storing those in commentEmotion# and commentScore# where # is the associated emotion and score, respectively.

Hint: Don’t forget to set up your Connector Secret for your Hugging Face API key.

Authentication for Hugging Face API key

Below, you can see the associated FEEL expression for the response from Hugging Face:

{
  commentEmotion1: response.body[1][1].label,
  commentScore1: response.body[1][1].score,
  commentEmotion2: response.body[1][2].label,
  commentScore2: response.body[1][2].score,
  commentEmotion3: response.body[1][3].label,
  commentScore3: response.body[1][3].score
}

Finally, a simple form displays the results of the call to Hugging Face.

Form for reviewing top emotions from customer comment

What is a Confidence Score? A Confidence Score is a value ranging from 0 to 1, indicating the likelihood that a machine learning model is accurate. The higher the score, the more confident the model is that it is providing the proper prediction.

Deploy and run

Now that you have a working example, run your process with some different fictitious customer statements and review the results. Here’s one example instance.

First, enter your fictitious customer comment.

Entering a negative customer comment

Reviewing the results of the Hugging Face model in Operate, you can see the top three emotions and associated confidence scores.

Viewing instance history with top emotions and associated confidence scores

You can also review the results using the second form you have created.

Reviewing and ranking top emotions from a customer comment

Try different statements to see how the model analyzes them and the associated confidence scores.

How this might be used in a business context

If you had some idea of the perception a customer has of new products, price fluctuations, new releases, and more, then your customer success team would know the climate when approaching a customer for further discussions.

Review the overall sentiment of a message and route it accordingly

Take the example above and expand on it in a business use case. Review the overall sentiment of a customer message. If the comment is:

  • Negative or neutral, route it to a customer success department to make some calls to repair the perception.
  • Positive, route it to a different group within your customer service department for a quick check-in and to thank them for the positive feedback.

Let’s put something together quickly to review this example.

BPMN process for the emotion evaluation

You can create a simple BPMN process (or even copy the one used previously) using the same initial user form to enter a customer comment. The following step will access the Hugging Face connector to call a sentiment-analysis model to determine the sentiment of the comment.

Based on the outcome of the ML model, the comment information will be routed to the appropriate customer success team. The highest-ranked sentiment and the confidence score will determine that routing.

The main process for this example might look like this.

Model for routing top-ranked emotion to correct customer success team

You can reuse the Customer Comment form from the previous example or create a new one.

This form is linked to the first human task, allowing you to enter a customer comment mimicking input from another system.

Just create a very simple form to be used for entering the customer comment with a text field for the comment.

Customer comment field

For the Hugging Face Connector, the customerComment is passed to a Hugging Face model for determining sentiment. This model will provide a confidence score for positive, negative, and neutral sentiments. Your workflow can capture all three sentiments but will only use the first (top-rated).

Model captures top three emotions

You can see the associated FEEL expression for the response from Hugging Face here:

{
  commentSentiment: response.body[1][1].label,
  commentScore: response.body[1][1].score,
  commentSentiment2: response.body[1][2].label,
  commentScore2: response.body[1][2].score,
  commentSentiment3: response.body[1][3].label,
  commentScore3: response.body[1][3].score
}

The three branches use the sentiment and the confidence score returned from the Connector to determine which action needs to be taken. Require that the confidence score be greater than 0.55 so you can feel comfortable that the sentiment is accurate. You can define the routing flows as follows:

Confidence score must be greater than 0.55 to ensure accurate routing
Confidence score must be greater than 0.55 to ensure accurate routing
An unclassified or neutral sequence flow

You can create simple forms for each of the associated branches; just make sure you create enough information on the form to acknowledge which branch was followed.

Negative
A simple form for reviewing a customer comment for improving perception
Positive
Reviewing comment for cross-selling
Neutral or Confidence Score <= 0.55
Form for customer comment and associated sentiment and confidence level

Deploy and run

Now that you have a working example, run your process with some different fictitious customer statements and review the results. Here’s one sample.

First, enter your fictitious customer comment.

Running process with fictitious negative customer comment

Reviewing the results of the Hugging Face model in Operate, you can see the sentiment for this comment, which is classified as negative, and the associated score. You can also see that the proper routing was taken based on the score and sentiment.

Viewing the instance history for a negative customer comment

You can now review the results using the form created for negative comments.

Viewing form results from negative comment

Try different statements to see how the model analyzes them and the associated sentiments and confidence scores.

How this might be used in a business context

As with the emotions example, this provides insight into how a customer might perceive your organization and allows you to receive an alert and take prompt action. By routing the information (you would include data like the contact for the customer and account—or even link to the customer record in your CRM system), you can get the appropriate customer success team to initiate contact accordingly.

Think of the possibilities of AI for business processes

So, think of the possibilities of operationalizing AI and ML models into your organization through your processes. You might create a model that finds specific product names and keywords and then routes customer inquiries or support tickets to the correct department without human interaction. You could even create a model that reviews and properly categorizes images or items in images to help speed up claims processing.

Check out some of the other community models available at Hugging Face and consider how they might help you eliminate or expedite human tasks. The possibilities are endless.

Try it out

With this new Hugging Face Connector, you have tons of models at your disposal. Be sure to check out our AI-powered suggestions to take advantage of other Connectors.

Learn more about how Camunda can help you with your process diagram development needs with a free trial. Camunda is a powerful and flexible process orchestration platform that can help you automate your processes and drive lasting value.

Start the discussion at forum.camunda.io

Try All Features of Camunda

Related Content

Coordinate automated and manual tasks with process orchestration for a complete end-to-end customer experience.
There are good reasons BPMN been so popular for so long. Let's talk about what BPMN can really do and why it's brilliant.
Visualization leads to optimization—workflow diagrams give you a clear map of even the most complex processes.