AI-901 Cheatsheet
Microsoft Azure AI Fundamentals
Download free PDFAI workloads and responsible AI
Recognize the workload
- **Generative AI** creates new text, images or other content from prompts. Drafting marketing emails and creating illustrations are generation tasks.
- **Natural language processing (NLP)** analyzes or interprets language: classify emails, understand an order request, find review sentiment or answer questions from a knowledge base.
- **Computer vision** interprets images or video. Camera-based bottle sorting uses visual recognition; **OCR** reads printed or handwritten text from images.
- **Speech recognition** converts spoken audio to text; **speech synthesis** converts text to audio. Captions and transcripts use recognition; script narration uses synthesis.
- **Predictive machine learning** learns patterns to estimate outcomes, such as future sales. An **embedding model** produces numeric vectors for similarity and retrieval.
Six responsible AI principles
- **Fairness** addresses unjustified differences between people or groups. Use representative data and compare outcomes across groups in lending, hiring or insurance.
- **Reliability and safety** means dependable behavior under expected and unexpected conditions. Test missing inputs, unusual cases and failure paths; monitor and remediate after deployment.
- **Privacy and security** protects personal and business information. Apply encryption, least-privilege access, secure credentials and appropriate data handling.
- **Inclusiveness** addresses barriers across abilities, languages and backgrounds. Support screen readers, keyboard navigation, captions and language options; popularity alone does not establish accessibility.
- **Transparency** makes the system understandable. Explain its purpose, capabilities, limitations and decision factors; document relevant data and model behavior.
- **Accountability** assigns responsibility for AI outcomes. Define owners, human oversight, escalation and correction processes; a human remains responsible for consequential decisions.
Apply the principles together
- For a **loan decision**, testing group disparities supports fairness; explaining the decision supports transparency; requiring a responsible reviewer supports accountability.
- **Removing protected attributes** does not guarantee fairness: other features can act as proxies. Evaluate representative populations and real outcomes, then monitor changes over time.
- **Authorized retrieval** must respect each user's data permissions. Redact unnecessary personal data and review sensitive outputs before downstream use.
Microsoft Foundry and model deployment
Choose and deploy a model
- **Microsoft Foundry** brings models, agents and AI tools into a development environment. A **project** organizes solution work; a **resource** provides Azure service access and configuration.
- Select a **text generation model** for explanations or summaries, an **image generation model** for new pictures, and a **vision-enabled model** for questions about supplied images.
- Check **model and deployment availability in the target Azure region** before deployment. Also compare supported modalities, context capacity, quality, latency and cost.
- Use **model cards and comparison or leaderboard information** to compare candidates. Evaluate representative prompts; advertised model size alone does not determine suitability.
- **Standard deployments** use consumption-based inference. **Provisioned deployments** allocate dedicated model processing capacity; size capacity for the expected workload. **Batch** suits supported asynchronous jobs.
Connect, authenticate and control cost
- A model client needs the correct **endpoint**, **authentication** and **deployment name**. The deployed name can differ from the model family name; use the name expected by that endpoint.
- For a deployment named **my-mini-gpt** using a GPT model, select that deployment in requests. A project display name or exported playground history is not connection information.
- Use supported **Microsoft Entra ID credentials** or service keys. Keep secrets outside source code and grant the calling identity the required service permissions.
- **Tokens per minute (TPM)** limits deployment throughput. Increasing its allocation can admit more token traffic; it does not set answer length or guarantee faster generation for one request.
- **Maximum output or completion tokens** caps generated tokens, depending on the API. Combine a suitable cap with concise prompts to control length and token cost; a cap can truncate an answer.
- **Temperature** and **top_p** affect sampling where supported. They influence output variation; they do not choose the model, region or throughput quota.
Prompts, agents and multimodal requests
Instructions and agent behavior
- A useful **prompt** states the task, relevant context and desired output. Add examples or formatting constraints when they clarify what success looks like.
- **System instructions** establish the agent's role, behavior and response constraints. The user's message supplies the immediate request; instructions do not provision model capacity.
- An **agent** combines a model, instructions and tools to carry out tasks. Tools can retrieve information or call application logic such as an Azure function.
- With supported tool calling, **tool_choice=auto** lets the model decide; **required** requires a tool call; **none** prevents one. To force a particular function among several, select that specific tool.
- Connect the **Azure Language MCP server** when an agent needs Language text-analysis tools. Tool access also requires appropriate authentication and permissions.
- Use the **playground** to test the selected agent configuration, including instructions and tools. Retrieve the **agent ID** from agent details or generated code; keep it distinct from the model deployment name.
- **Publishing** can expose an agent through a stable endpoint. Test the intended configuration and monitor deployed behavior; playground testing alone does not establish production reliability.
Images and audio in model requests
- For **image understanding**, use a vision-capable model and put the text question and image content in one user request. A text-only model cannot gain vision capability from a prompt.
- Provide an image through an **accessible image URL** or a supported **base64 data URL**. A local filesystem path does not upload the image to the remote service.
- A JPEG data URL has the form **data:image/jpeg;base64,** followed by encoded image bytes. Match the MIME type to the actual file format.
- The **Responses API** uses **input_text** and **input_image** content items. Chat Completions uses its own content structure, including **text** and **image_url**; keep API schemas distinct.
- Use a deployed image model such as **gpt-image-1** with the **Images API** to generate pictures from prompts. Generating an image and analyzing an existing image are different operations.
- An **audio-capable multimodal model** can accept supported audio input directly. For Chat Completions audio input, **input_audio** carries encoded data and format information; embeddings are not audio requests.
Language and text analysis
Choose the text capability
- **Named entity recognition (NER)** finds mentions and labels categories such as people, organizations and locations. **Custom NER** targets domain-specific categories.
- **Key phrase extraction** lists important concepts in feedback or documents. **Sentiment analysis** estimates positive, negative or neutral tone; opinion mining relates sentiment to specific aspects.
- **Language detection** identifies the language of input text. **Translation** converts meaning into another language, such as displaying stored English reviews in a user's chosen language.
- **Text classification** assigns labels such as work, personal or spam. **Language understanding** identifies intent and relevant details so an app can route requests for orders or support.
- **Summarization** condenses content. Extractive summaries select source sentences; abstractive summaries generate shorter wording. **Question answering** returns answers using a knowledge source.
- **PII detection** identifies sensitive text such as names and phone numbers for redaction. **Entity linking** resolves ambiguous mentions to a known entity; ordinary NER labels the mention's type.
Recognize Language SDK operations
- The Python **azure-ai-textanalytics** package provides **TextAnalyticsClient** for supported text analysis. Configure a service endpoint and supported credential before sending documents.
- **extract_key_phrases()** finds main concepts; **recognize_entities()** finds typed entities; **recognize_linked_entities()** resolves linked identities.
- **detect_language()**, **analyze_sentiment()** and **recognize_pii_entities()** identify language, tone and sensitive entities. Inspect per-document errors and returned fields before using results.
- For call analytics, first obtain a **transcript** from audio, then apply Language features to the text. Document layout and signature analysis belong to document-processing tools.
Speech recognition and synthesis
Match the audio workflow
- **Real-time speech to text** transcribes live microphone or streaming audio. Use **continuous recognition** for an ongoing conversation or command stream.
- **Batch transcription** processes collections of recorded audio asynchronously, such as support calls stored in Azure Storage. It does not require playing each recording through a microphone.
- **Text to speech** produces spoken notifications or narration from a script. Choose an output voice and route the synthesized audio to a speaker or file.
- **Speech translation** converts spoken content into another language. Recognition transcribes words; **speaker recognition** concerns who is speaking.
Speech SDK object roles
- Python **azure-cognitiveservices-speech** is imported as **azure.cognitiveservices.speech**. **SpeechConfig** holds service connection settings, authentication and language or voice settings.
- Configure **SpeechConfig** with the supported resource key and region or service endpoint. **AudioConfig** chooses input, such as **use_default_microphone=True** or an audio file.
- **SpeechRecognizer** combines service and input configuration. **recognize_once_async().get()** obtains one utterance; **start_continuous_recognition_async()** starts ongoing recognition.
- Handle recognition events for continuous results, then stop recognition when finished. Check recognized, no-match and canceled outcomes before consuming text.
- **SpeechSynthesizer** converts text to audio. **speak_text_async(text).get()** waits for synthesis; **AudioOutputConfig(filename=...)** directs output to a file.
Vision and structured content extraction
Pixels, text and document fields
- **Image classification** labels an image as a whole. **Object detection** identifies objects and their locations. **Image tagging** adds descriptive labels for organization and search.
- **Azure Vision** supports visual analysis and OCR capabilities. Reading a handwritten letter is text extraction from an image; extracting its main topics is a later language-analysis step.
- **OCR** captures visible text. **Document Intelligence** extracts document structure and fields using prebuilt or custom models, including invoice-processing scenarios.
- **Content Understanding** turns documents, images, audio and video into useful content and schema-defined fields. Use it when the workflow needs structured information across these modalities.
Analyzers and asynchronous results
- Provision a **Microsoft Foundry resource** for Content Understanding. Configure the service client with its endpoint and supported credentials; a project name alone is insufficient.
- An **analyzer** defines processing settings and the output **schema**. Specify field names, types and descriptions; nested objects or arrays can represent invoice line items.
- Match the analyzer to the content: a **document analyzer** for scanned invoice PDFs, an **audio analyzer** for voicemail WAV files, and a **video analyzer** for uploaded video.
- Audio analysis uses **transcription** to obtain words, then derives requested structured fields. Video analysis can combine speech and visual content; OCR alone cannot analyze a voicemail.
- In the Python SDK, **begin_analyze()** starts analysis with an analyzer ID and supported inputs. The returned poller represents a **long-running operation**; **poller.result()** retrieves its completed result.
- With REST, follow the operation's result location and poll until completion. Read results only after success; repeatedly submitting analysis creates new work instead of checking the original job.
- Validate **extracted field values**, missing data and any available confidence or grounding before automation. Route uncertain or consequential results for review.