Text Analysis Solutions
Exam weight: 10–15%
Overview
AI-103 tests text and speech analysis in the context of Foundry Tools — Azure AI Language, Azure Translator, and Azure AI Speech accessed through the Foundry ecosystem. The exam also covers using LLM prompting as an alternative to dedicated service calls for some text analysis tasks.
Key Concepts
Language Analysis
| Technique | Foundry Tool / Approach | What it returns |
|---|---|---|
| Entity extraction | Azure AI Language or LLM prompt | Named entities with categories |
| Topic extraction | LLM prompt with structured output | Topics as JSON |
| Summarization | Azure AI Language or LLM | Abstractive or extractive summary |
| Sentiment / tone | Azure AI Language or LLM | positive / negative / neutral + confidence |
| Safety / harmful content detection | Azure AI Content Safety | Category + severity scores |
| PII detection | Azure AI Language | PII entities with optional redaction |
| Text translation | Azure Translator in Foundry Tools | Translated text |
LLM-based Text Analysis (structured JSON output)
Using generative models for text analysis is increasingly common in AI-103 scenarios:
from azure.ai.inference import ChatCompletionsClient
from azure.ai.inference.models import SystemMessage, UserMessage
from azure.core.credentials import AzureKeyCredential
import json
client = ChatCompletionsClient(endpoint="<endpoint>", credential=AzureKeyCredential("<key>"))
response = client.complete(
model="gpt-4o",
messages=[
SystemMessage("""Extract the following from the user's text and return as JSON:
- entities: list of {text, type} where type is Person, Organization, or Location
- sentiment: "positive", "negative", or "neutral"
- summary: one sentence summary
Return only valid JSON, no other text."""),
UserMessage("Microsoft announced new AI features at their Seattle headquarters yesterday.")
],
response_format={"type": "json_object"},
)
result = json.loads(response.choices[0].message.content)
print(result)
Speech Solutions
| Capability | Implementation |
|---|---|
| Speech-to-text (STT) | Azure AI Speech in Foundry Tools |
| Text-to-speech (TTS) | Azure AI Speech in Foundry Tools — neural voices |
| Custom speech | Fine-tuned STT model for domain vocabulary |
| Agent speech modality | Integrate STT/TTS into an agent for voice interaction |
| Audio-to-text with LLM reasoning | Send audio to a multimodal model (GPT-4o audio) |
| Speech translation | Azure AI Speech real-time translation |
import azure.cognitiveservices.speech as speechsdk
speech_config = speechsdk.SpeechConfig(subscription="<key>", region="<region>")
speech_config.speech_synthesis_voice_name = "en-US-JennyNeural"
# Text to Speech
synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config)
synthesizer.speak_text_async("Hello, I am an AI assistant.").get()
# Speech to Text
recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config)
result = recognizer.recognize_once()
print(result.text)
When to Use LLM vs. Dedicated Service
| Scenario | Recommendation |
|---|---|
| Simple, structured extraction at scale | Dedicated Azure AI Language service (faster, cheaper) |
| Complex, domain-specific extraction | LLM with structured output prompt |
| Translation of standard languages | Azure Translator (accurate, cost-effective) |
| Translation with context / tone preservation | LLM-powered translation flow |
| High-volume speech transcription | Azure AI Speech (optimized) |
| Voice interaction in an agent | Azure AI Speech integrated with Foundry Agent |