Reader small image

You're reading from  Architecting AI Solutions on Salesforce

Product typeBook
Published inNov 2021
PublisherPackt
ISBN-139781801076012
Edition1st Edition
Concepts
Right arrow
Author (1)
Lars Malmqvist
Lars Malmqvist
author image
Lars Malmqvist

Lars Malmqvist is a 32x certified Salesforce CTA and has spent the past 15 years in the Salesforce ecosystem building advanced solutions on the platform. Currently, he works as a partner in the management consultancy, Implement Consulting Group, focusing on supporting large Nordic Salesforce clients in their transformation journeys. He has published two books, Architecting AI Solutions on Salesforce and Salesforce Anti-Patterns, both with Packt publishing.
Read more about Lars Malmqvist

Right arrow

Chapter 8: Integrating Third-Party AI Services

This, too, will be a hands-on chapter that takes you through three examples of custom development. In this case, we are using external third-party services as part of normal Sales/Service workflows on Salesforce. The first example will train a custom prediction model to predict the likelihood of a support case resulting in legal liability using Amazon SageMaker, the second will extract key phrases from a case, and the third will bring in automated translations with the Google Translation API. As part of each feature discussion, it will reference the Pickled Plastics Ltd. scenario that is used throughout the book to give a real-world grounding.

In this chapter, we're going to cover the following main topics:

  • Introducing the examples
  • Predicting with a custom model using AWS SageMaker
  • Extracting key phrases with Azure Text Analytics
  • Translating text with Google Translate

After completing this chapter, you...

Technical requirements

To follow along with the examples in this chapter, please register an analytics-enabled developer org. This can be requested by using the form here: https://developer.salesforce.com/promotions/orgs/analytics-de.

You will also need to download the chapter's files from GitHub at https://github.com/PacktPublishing/Architecting-AI-Solutions-on-Salesforce/tree/main/Chapter08.

Furthermore, you will need to sign up for free accounts with AWS, Google Cloud, and Microsoft Azure, using the following links:

We will not be providing instructions on the basic sign-up process. The following examples will assume that you are working from a newly created account on the respective platforms.

The Code in Action (CiA) video for the chapter can be found at https://bit.ly/2Yk00mU.

Introducing the examples

In this chapter, we will encounter three examples from three different cloud providers to see how to integrate third-party services into a Salesforce AI solution. All three of these providers offer a comprehensive suite of AI services and we will not attempt to survey these as each would require book-length treatment in their own right.

Instead, the examples are meant to teach you just enough about the services to understand what would be required were you to decide to adopt these third-party services as part of your application. They will also provide you with a solid understanding that you can use as a baseline for extending your own research in various directions.

The examples span three platforms:

  • Amazon Web Services
  • Microsoft Azure
  • Google Cloud Platform

These are the largest and most comprehensive cloud AI service providers in existence and odds are if you need something, one or more of these platforms will have what you are...

Predicting with a custom model using AWS SageMaker

Amazon Web Services (AWS) is the biggest player in the cloud marketplace and that includes AI services. In this section, we will be using four different services:

  • AWS SageMaker: A managed service for custom machine learning models
  • S3: The object storage layer of AWS
  • AWS Lambda: Serverless functions running in the cloud
  • API Gateway: The way you expose external APIs on AWS

The purpose of this example is to teach you the basics of using a custom machine learning model from Salesforce. To fit within the available amount of space, we will be skipping several elements that would normally be considered best practice, so don't use this example directly in a production environment. However, you will get an appreciation of how these elements can be formed into a solution should you need to architect one in the future.

As always, we return to our Pickled Plastics Ltd. scenario for our requirements. The legal...

Extracting key phrases with Azure Text Analytics

Azure is Microsoft's general platform within which they provide an extensive array of AI services via APIs. In this example, we will be making use of the Text Analytics component, a subcomponent of the wider Cognitive Services offering that contains most of the AI services on offer. This subcomponent contains a range of APIs related to Natural Language Processing (NLP), which can be used for a variety of purposes, some of which overlaps with the offerings from Einstein Platform Services that we examined in Chapter 7, Building AI Features with Einstein Platform Services.

However, for the purpose of this example, we will be using a service that has no such equivalence on the Salesforce platform. This is the Key Phrases API, which extracts key phrases from unstructured text documents. It works by you posting a set of JSON formatted text documents to the API endpoint identified by an index and getting in return a set of key phrases...

Translating text with Google Translate

For our last example, we will be using one of the AI applications almost everyone is aware of – Google Translate. Due to its use within the Chrome browser and the Google search engine, most people are aware of the vast capabilities of this technology to translate between languages. What fewer people are aware of is that this technology is available as an API that you can incorporate into your own application.

This is the API we will be working with for this example. Google, like Microsoft and AWS, has a substantial range of leading-edge AI services that you can access via APIs. Looking into these on your own after completing this example will repay the effort as you will understand the basics of how to interact with them after having completed this section.

This time, our requirements from Pickled Plastics Ltd. come from a happy place. The head of sales has just closed a new major deal with a Chinese reseller, not least due to the...

Summary

In this chapter, we have looked at how to integrate third-party AI services into our Salesforce solutions. We worked through a lot of material, but hopefully, by doing the hands-on work, you now have a real appreciation of what it takes to build this kind of solution, even if on a very simplified basis.

One key learning point is the substantial difference in complexity between deploying and accessing your own custom models and using third-party services. We spent by far the longest on the first task, and while this is a technique that can be used to meet any requirement, it puts all the onus on you to come up with the right data, model, and integration pattern. This is a big ask and while you can do it if the occasion calls for it, you should be cautious about overuse. This should also make you appreciate just how useful the ability to fine-tune existing models with your own data that we saw in Einstein Platform Services is.

In contrast, the other two services were integrated...

Questions

  1. Why would you need to use a custom-built AI model?
  2. Should you always seek to avoid third-party APIs?
  3. What are some of the major cloud providers where you might have a look for good AI services?
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Architecting AI Solutions on Salesforce
Published in: Nov 2021Publisher: PacktISBN-13: 9781801076012
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Lars Malmqvist

Lars Malmqvist is a 32x certified Salesforce CTA and has spent the past 15 years in the Salesforce ecosystem building advanced solutions on the platform. Currently, he works as a partner in the management consultancy, Implement Consulting Group, focusing on supporting large Nordic Salesforce clients in their transformation journeys. He has published two books, Architecting AI Solutions on Salesforce and Salesforce Anti-Patterns, both with Packt publishing.
Read more about Lars Malmqvist