AWS-111 · Lesson 10 of 12 · 18 min
Managed AI services for language, vision and speech
▶ Video coming soon A video version of this lesson is on the way.
Not every idea on Noor's list needed a custom model. Hannah had a pile of client survey comments, Andre wanted reminder calls in more than one language, and the emergency hospital wanted a searchable record of after-hours calls. "For these," Noor said, "someone at AWS has already trained the model. We just call it."
AWS offers a family of managed AI services: pre-trained models for common tasks, used through a simple API with no ML expertise, no training and no servers. You send text, audio or images and receive results, paying per use. The exam guide names several and expects you to match each to a use case. This lesson tours them.
Language: Amazon Comprehend
Amazon Comprehend is a natural language processing service that finds meaning in text. Its built-in features include sentiment analysis (positive, negative, neutral or mixed), entity recognition (people, places, organizations, dates, quantities), key phrase extraction, language detection, topic modeling across a collection of documents, and detection of personally identifiable information (PII), which can find or redact names, phone numbers and similar details. With custom classification and custom entity recognition, you can train it on your own labeled examples, such as sorting emails into billing, booking and medical questions, without managing a model yourself.
Hannah ran 4,800 survey comments from the past year through Comprehend. Sentiment was positive for most clinics, and key phrases surfaced recurring complaints about parking at one clinic and wait times at the emergency hospital on weekends. Amazon Comprehend Medical is a related service that extracts medical information such as conditions, medications and dosages from clinical text; it is designed for human health records, so Noor noted it as something to check carefully before assuming it suits veterinary notes, and to confirm Region availability.
Translation: Amazon Translate
Amazon Translate is a neural machine translation service that converts text between dozens of languages, in real time or in batches of documents. It supports custom terminology, so that product names or clinical terms are translated consistently, and it can preserve formatting in documents. Andre wanted appointment letters available in Spanish for clients who prefer it. Noor's caution: machine translation is good but not perfect, so templates that carry important instructions, such as pre-surgery fasting rules, should be translated once and checked by a fluent reviewer, with Translate used for routine messages.
Speech to text: Amazon Transcribe
Amazon Transcribe converts speech to text, from recordings or live streams. Features include speaker identification, automatic punctuation, custom vocabularies for unusual words such as drug names, and automatic redaction of sensitive content. Transcribe Call Analytics adds call-center insights such as sentiment, talk time and call summaries, and Amazon Transcribe Medical targets clinical dictation. For the emergency hospital's after-hours line, transcripts would make calls searchable and feed the summarizing idea in AWS-112. Hannah added a condition first: callers must be told the call is recorded, and recordings and transcripts must be kept and deleted according to the privacy policy.
Text to speech: Amazon Polly
Amazon Polly turns text into lifelike speech in many languages and voices. Its neural voices sound natural, and SSML (Speech Synthesis Markup Language) lets developers control pronunciation, pauses and emphasis. Kwame proposed using Polly for automated reminder calls to clients who prefer a phone call to a text: "Hello, this is Cascade Ridge Veterinary. Your appointment for Biscuit is tomorrow at 9:30."
Conversation: Amazon Lex
Amazon Lex builds conversational interfaces, chatbots and voice bots, using the same kind of speech and language technology as Alexa. A Lex bot recognizes the user's intent, such as booking an appointment, and collects the details it needs, called slots, such as the pet's name, the clinic and the preferred day. It can hand off to a person and connects to Amazon Connect for contact centers. A booking bot would be a natural next step after the no-show pilot. AWS-112 and AWS-113 show how foundation models now make such bots more flexible.
Vision and documents
- Amazon Rekognition analyses images and video: detecting objects, scenes and text, comparing faces, flagging unsafe content, and tracking people in video. Custom Labels lets you train it to recognize your own categories from a modest number of labeled images. Facial analysis raises privacy and consent questions, and Cascade Ridge had no use for it.
- Amazon Textract extracts printed and handwritten text, forms and tables from scanned documents and PDFs, going beyond simple optical character recognition by keeping the structure. Outside laboratories send results to the clinics as PDFs; Textract could pull values into the practice system for a technician to check.
Search and recommendations
- Amazon Kendra is an intelligent enterprise search service: staff ask questions in natural language and it finds answers across documents, wikis and file shares. It can also feed retrieval for generative AI applications, covered in AWS-113.
- Amazon Personalize builds recommendation systems from interaction data, the same kind of technology Amazon.com uses, without ML expertise. A clinic group might use it to suggest relevant pet-care articles on its website.
| Need | Service |
|---|---|
| Find sentiment, entities or PII in text | Amazon Comprehend |
| Translate a letter into another language | Amazon Translate |
| Turn a call recording into text | Amazon Transcribe |
| Read a reminder aloud in a natural voice | Amazon Polly |
| Build a booking chatbot | Amazon Lex |
| Detect objects or text in images | Amazon Rekognition |
| Extract tables and forms from scanned PDFs | Amazon Textract |
| Answer staff questions from internal documents | Amazon Kendra |
| Recommend items based on behavior | Amazon Personalize |
Calling a managed service is usually one request. This command, shown as an illustration, asks Comprehend for the sentiment of one comment.
aws comprehend detect-sentiment \
--language-code en \
--text "The vet was wonderful but parking was impossible." \
--region ca-central-1# What a sentiment service returns, imitated with a toy word list (not how Comprehend works inside).
POS = {"wonderful", "kind", "great", "quick", "friendly"}
NEG = {"impossible", "slow", "rude", "expensive", "long"}
def toy_sentiment(text):
words = {w.strip(".,!").lower() for w in text.split()}
p, n = len(words & POS), len(words & NEG)
label = "MIXED" if p and n else "POSITIVE" if p else "NEGATIVE" if n else "NEUTRAL"
return {"Sentiment": label, "positive_words": p, "negative_words": n}
for c in ["The vet was wonderful but parking was impossible.",
"Friendly staff and a quick visit.",
"Wait was long and the bill was expensive."]:
print(toy_sentiment(c)){'Sentiment': 'MIXED', 'positive_words': 1, 'negative_words': 1}
{'Sentiment': 'POSITIVE', 'positive_words': 2, 'negative_words': 0}
{'Sentiment': 'NEGATIVE', 'positive_words': 0, 'negative_words': 2}What this code does
It imitates what a sentiment analysis service returns, using a toy list of positive and negative words rather than a real model. Each comment's words are compared with the two lists and labeled positive, negative, mixed or neutral, with counts of the matching words. Three sample reviews show a mixed, a positive and a negative result, the same kind of labels Amazon Comprehend gives.
The toy only counts words, which is why real services use trained models: they understand negation, sarcasm and context that a word list misses. What the toy does show is the shape of the result a managed service returns, a label plus supporting detail, which an application can store, count and chart.
Common mistakes
MistakeTraining a custom model for a common task like translation or transcription.
InsteadStart with the managed AI service; build custom only if it cannot meet the need.
MistakeConfusing Amazon Polly with Amazon Transcribe.
InsteadPolly turns text into speech; Transcribe turns speech into text.
MistakeUsing Rekognition to read tables from scanned forms.
InsteadUse Textract, which keeps the structure of forms and tables.
MistakeRecording calls without telling callers.
InsteadInform callers and follow the retention policy before transcribing calls.
Combining services
Managed services are often chained. The after-hours line idea used three in a row: Amazon Transcribe turns each recorded call into text, Amazon Comprehend detects and redacts personal details and extracts key phrases such as the pet's species and the reported symptom, and the redacted text is stored for search. A booking bot might chain Amazon Lex for the conversation, Amazon Polly for the voice on the phone and the BookVet API for the booking itself. Each step is a separate service with its own IAM permissions, logs and costs, so Mateo drew the chain as a diagram before anything was built, marking where personal information appears and where it is removed.
Choosing a managed service also means accepting its limits. Accuracy can be lower for strong accents, background noise or specialist vocabulary; custom vocabularies and terminology help, but results should be checked on real samples before launch. Noor ran 50 real after-hours recordings, used with permission, through Transcribe and had a technician compare the transcripts with the audio. Drug names were the most common errors, which a custom vocabulary of the hospital's formulary largely fixed.
Managed services, custom models and foundation models
The three layers from lesson 1 meet in this lesson. Managed AI services such as Comprehend and Transcribe are the quickest route when a task matches what they do. Custom models in SageMaker AI are needed when the problem is specific to the company's own data, like the no-show model. Foundation models through Amazon Bedrock now overlap with some managed services: a large language model can classify sentiment, extract details or translate a letter if prompted. The choice comes down to fit and cost. A purpose-built service is usually cheaper per request, more consistent and easier to monitor for its specific job, while a foundation model is more flexible when the task is unusual or open-ended. Noor's rule was to use the purpose-built service when it does the job, and to reach for a foundation model when the task needs reasoning or generation the services cannot provide.
Region availability and data handling should also be checked for each service. Not every AI service or feature is offered in every Region, and services differ in how they store inputs and whether they may use them to improve the service. AWS documents opt-out options for some AI services. Hannah added two lines to the project checklist: confirm the service runs in the company's chosen Region, and confirm the data-handling settings before sending any client information.
Measuring a managed service before relying on it
Even pre-trained services should be evaluated on the company's own data before they are trusted. For Comprehend's sentiment results, Hannah had two staff members label 200 survey comments by hand and compared their labels with the service's, using the precision and recall ideas from lesson 5. Agreement was high for clearly positive and negative comments and lower for mixed ones, so the summary report presents mixed comments separately for a person to read.
Costs of managed services
Managed AI services are priced by use: per character translated, per minute of audio transcribed, per unit of text analyzed, per image processed, often with a free tier for the first months. That makes small experiments cheap and costs easy to predict from volume. Lorraine asked for a monthly estimate before approving the survey analysis and the call transcription trial. Jonah multiplied expected volumes by the published rates and added a margin, then Mateo set an AWS Budgets alert for the ML account, following the habits from AWS-104. The estimate, shown as illustrative in the project notes because prices change, came to far less than one staff member's time spent reading comments by hand.
By the end of the session Jonah had a simple way to remember the services: Comprehend understands text, Translate changes its language, Transcribe turns speech into text and Polly turns text into speech, Lex holds a conversation, Rekognition looks at images and video, Textract reads documents, Kendra searches and Personalize recommends. Each name answers one question, and most exam questions about managed AI services are a matter of matching that question to the scenario described.
Worked problem
Matching four requests
Four requests reach Noor: (1) find recurring complaints in 4,800 survey comments; (2) let clients book appointments by chatting on the website; (3) pull glucose and kidney values from PDF lab reports; (4) phone clients who prefer calls with a spoken reminder. Which services fit?
Show solution
- (1) Finding themes and sentiment in text: Amazon Comprehend (key phrases, sentiment, topic modeling).
- (2) A conversational booking interface: Amazon Lex.
- (3) Structured values from scanned documents: Amazon Textract, with a technician checking each result.
- (4) Turning reminder text into natural speech: Amazon Polly, possibly through Amazon Connect for the calls.
Answer: Comprehend, Lex, Textract and Polly.
Summary and key terms
- Managed AI services provide pre-trained models through simple APIs, with no ML expertise, training or servers, paid per use.
- Amazon Comprehend analyses text for sentiment, entities, key phrases, language, topics and PII, and supports custom classification; Comprehend Medical targets clinical text.
- Amazon Translate translates text and documents.
- Amazon Transcribe converts speech to text, with Call Analytics and Medical variants.
- Amazon Polly converts text to speech.
- Amazon Lex builds chatbots and voice bots using intents and slots.
- Amazon Rekognition analyses images and video; Amazon Textract extracts text, forms and tables from documents.
- Amazon Kendra provides intelligent search and Amazon Personalize builds recommendations.
- Managed AI service
- A pre-trained AI capability offered through an API, with no model to build or host.
- Amazon Comprehend
- NLP service for sentiment, entities, key phrases, language, topics and PII.
- Amazon Translate
- Neural machine translation service.
- Amazon Transcribe
- Speech-to-text service.
- Amazon Polly
- Text-to-speech service.
- Amazon Lex
- Service for building chatbots and voice bots.
- Amazon Rekognition
- Image and video analysis service.
- Amazon Textract
- Service that extracts text, forms and tables from documents.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Which service converts a call recording into text?
Show answer
Amazon Transcribe.
Which service builds a chatbot that collects slots such as pet name and clinic?
Show answer
Amazon Lex.
Which service can detect personal information such as phone numbers in text?
Show answer
Amazon Comprehend.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.