Simon Bisson
Contributor

What’s new in Microsoft Azure’s NLP AI services

analysis
Jun 22, 20227 mins
Cloud ComputingDevelopment ToolsMachine Learning

Microsoft is finally close to delivering its long-promised natural user interfaces. Here’s how you can build them into your code.

artificially intelligent [AI] virtual assistant / chatbot
Credit: Thinkstock

If you want to begin using machine learning in your applications, Microsoft offers several different ways to jumpstart development. One key technology, Microsoft’s Azure Cognitive Services, offers a set of managed machine learning services with pretrained models and REST API endpoints. These models offer most of the common use cases, from working with text and language, to recognizing speech and images.

Machine learning is still evolving, with new models being released and new hardware to help speed up inferencing, and so Microsoft regularly updates its Cognitive Services. The latest major update, announced at Build 2022, features a lot of changes to its tools for working with text, bringing three different services under one umbrella. Where text analytics, QnA Maker, and the LUIS language understanding used to be separate tools, they’re now part of one set of natural language processing tools to help you work with stored data and real-time user inputs.

Introducing Cognitive Service for Language

Now branded as Cognitive Service for Language, the tools give you access to both familiar features (after migrating to the new APIs) and new services. Migration can be complex, as there are breaking changes between the two versions for some of the services. You can continue using the old APIs for now, but it’s worth investigating the new service for new applications and updates to existing code.

LUIS configuration files can create new Conversational Language Understanding projects, though some entities are not supported. This will affect models that have been customized. Although Microsoft suggests that its new language models don’t need these customizations, it’s worth monitoring application performance and working with the new APIs if you find problems with the new service.

If you’ve used the QnA Maker knowledge management service, you may find it best to create new custom question-answering services from the same source material. You can copy knowledge bases between services to bring in previously learned suggestions, but in practice, there are enough changes to the underlying model that a fresh start may well be preferable.

Cognitive Service for Language contains several new features that weren’t in the original platform. Some of these are particularly useful for enterprise applications because they help automate complex regulatory scenarios where users are entering free-form text (such as in chats or emails) and you need to store those interactions.

Automatically identify and redact PII

One new feature should be a quick win for any application that deals with personally identifiable information. PII is highly regulated in most jurisdictions, but it’s common for a user to include credit card details or a Social Security number in an email or a chat. These need to be redacted if you’re archiving content, and the PII identification tool in Azure Cognitive Service for Language can help identify this data.

Working with the PII detection tools is a matter of embedding them in your application workflow, like most Azure services. Start by creating an Azure Language resource, which will host your service endpoint and generate the appropriate keys for the service. You can now access the REST API for the PII identification service, addressing it directly using familiar HTTPS calls with JSON data. Alternatively, there are SDKs for most common languages and platforms that wrap API calls as methods, handling access, request, and response for you.

If you’re using Python, Microsoft provides a client library for its text analytics tools that can be installed via pip. Once installed, the library can issue your access keys and create a client object that accesses the PII recognition endpoints. You’ll need to provide text for the PII you’re aiming to redact, for example, content that may contain SSNs, credit card numbers, or phone numbers, and the system returns a text object with redacted data and a set of confidence scores.

These help you automate redacting unstructured documents, categorizing the redaction based on your sample documents. The service can recognize a set of common entity types: names, phone numbers, addresses (physical and email), numeric identifiers like product keys or bank account numbers, and credit card details.

If you’re using this tool with conversations, for example, as part of a chat bot, you can use an alternative API to analyze a list of conversation items for PII, returning data asynchronously. This means you can’t redact data in real time; instead, it’s intended to process entire chats before they’re archived, adding a redaction step to your application workflow. It can even process recognized speech for PII, ensuring transcripts don’t contain sensitive information and at the same time providing time codes to allow audio redaction. Each call to the conversational PII API will contain a document with a single conversation. Currently, you’re limited to using English only for this service.

Orchestrate workflows from chat

Microsoft continues to expand the available tools in its Cognitive Services, adding new features in a monthly cadence as it rolls out new models. One tool that recently entered general availability allows you to orchestrate the workflow across multiple services by using a conversational machine learning API to extract information from content and then pass it to the correct services.

This approach needs a custom model trained from tagged data that defines intents and actions. You build the model in Language Studio, an Azure portal that provides tools for training and testing your model. You’ll start with a schema that’s attached to a conversational language understanding project. Once trained, the orchestration model can be used to route data from a chatbot to the appropriate service.

For example, you could have an HR self-service bot that would identify whether you’re asking a question that needs to be passed to the HR knowledge base or you’re requesting time off, in which case it would extract dates and forward them to a vacation calendar request application. Workflows like this are informal, and a chatbot running in Microsoft Teams would allow staff to quickly access services without interrupting other tasks.

There are limits to the sizes of documents that can be sent to the Language service. You can send five documents at a time to the PII recognition API, with rate limits set by your subscription level. A document can be only 5,120 characters long for synchronous redaction, 125,000 characters and 1MB for all the documents in an asynchronous request. You can use standard string information calls to get document size before sending them to the service, chunking content if necessary.

A natural language interface

It makes sense for Microsoft to bundle the different services together that make up the new Cognitive Service for Language. Including them in an intelligent workflow routing engine helps glue services into the context of informal, unstructured conversations. Chatbots and other content-driven services have often been single-purpose and inflexible, whereas users expect a conversational environment that can support multiple tasks while still protecting their privacy.

As we automate more and more help desk like services both inside and outside our organizations, providing an intelligent interface to knowledge bases and applications is increasingly important. We need to match user expectations, and tools like these provide a scaffolding to deliver automated systems that don’t feel automated and can respond to the informal ways we communicate. It’s an interesting way to look at user interface development. This tool is a lot closer to the natural user interfaces that Microsoft has been championing for much of the last decade.

Simon Bisson
Contributor

Author of InfoWorld's Enterprise Microsoft blog, Simon Bisson prefers to think of “career” as a verb rather than a noun, having worked in academic and telecoms research, as well as having been the CTO of a startup, running the technical side of UK Online (the first national ISP with content as well as connections), before moving into consultancy and technology strategy. He’s built plenty of large-scale web applications, designed architectures for multi-terabyte online image stores, implemented B2B information hubs, and come up with next generation mobile network architectures and knowledge management solutions. In between doing all that, he’s been a freelance journalist since the early days of the web and writes about everything from enterprise architecture down to gadgets.

More from this author