Skip to content

Add remarks and examples to Windows AI API reference docs#123

Draft
GrantMeStrength wants to merge 6 commits into
docsfrom
grantmestrength/improve-ai-api-docs
Draft

Add remarks and examples to Windows AI API reference docs#123
GrantMeStrength wants to merge 6 commits into
docsfrom
grantmestrength/improve-ai-api-docs

Conversation

@GrantMeStrength

@GrantMeStrength GrantMeStrength commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Questions for SME reviewers

The following questions came up during authoring. Accurate answers would directly improve the docs — and are especially important for AI coding assistants (e.g. GitHub Copilot) that use API reference to generate code.

LanguageModel / Text APIs

  1. EnsureReadyAsync progress range — The double progress value on EnsureReadyAsync: is it 0.0–1.0 or 0–100? We removed a "between 0 and 1" claim because we could not verify it.
  2. GenerateResponseAsync streaming — The string progress on GenerateResponseAsync: is each progress callback a single new token, or the cumulative response so far? This is critical for implementing streaming UI.
  3. CreateAsync failure mode — What happens if you call CreateAsync when GetReadyState() returns EnsureNeeded or DisabledByUser? Does it throw, return null, or silently fail?
  4. SummarizeAsync vs SummarizeParagraphAsync output format — Does SummarizeAsync return bullet-point key points while SummarizeParagraphAsync returns prose? We softened this claim because the signatures both return LanguageModelResponseResult.
  5. Context window size — Is there a documented context window size (in tokens) for Phi Silica? Developers need to know how much text they can pass before hitting PromptLargerThanContext.
  6. Thread safety — Can LanguageModel and the Text Intelligence Skill classes be used from background threads, or must they be called on the UI/dispatcher thread?

Imaging APIs

  1. MaxSupportedScaleFactor value — What is the actual max scale factor on current Copilot+ PCs? We removed "up to 8×" because we could not verify it from the metadata. If 8× is correct, we would like to add it back with confidence.
  2. ImageBuffer creation — Which ImageBuffer factory methods should developers use to convert a SoftwareBitmap? We verified CreateBufferAttachedToBitmap and CreateCopyFromBitmap exist but are unsure which is preferred and whether there are C++/WinRT-specific variants.
  3. RecognizedLineStyle values — The RecognizedLineStyle enum only documents Handwritten. Is there a Printed or Unknown value, or is the absence of Handwritten the indicator for printed text?
  4. ImageObjectRemover behavior — Does RemoveFromSoftwareBitmap / RemoveFromImageBuffer modify the source in place or return a new image? The signatures suggest a return value, but the docs should be explicit.

General

  1. Error handling pattern — Beyond checking LanguageModelResponseResult.Status, should developers also catch specific exception types? If so, which ones?
  2. Model versions — Do these APIs use a fixed model version per SDK release, or can the on-device model update independently? This affects reproducibility guidance.

Summary

Adds remarks, see-also, and examples to 52 API reference files across Microsoft.Windows.AI.Text and Microsoft.Windows.AI.Imaging namespaces. These are GA APIs (Windows App SDK 1.7+) that power Phi Silica, text recognition, and imaging features.

Changes

Phase 1: Class-level files (16 files)

Microsoft.Windows.AI.Text (8 files)

  • LanguageModel — Phi Silica integration, availability check pattern, NPU requirement, China restriction, full code example
  • TextSummarizer — Three summarization methods, ConversationItem/ConversationSummaryOptions usage
  • TextRewriter — Tone options, rewriting behavior
  • TextToTableConverter — Structured table output, row/column access
  • ConversationItem — Message/participant properties, conversation summary usage
  • ConversationSummaryOptions — Configuration for conversation summarization
  • LanguageModelOptions — Content filtering configuration
  • LanguageModelResponseResult — Status checking and error handling pattern

Microsoft.Windows.AI.Imaging (8 files)

  • TextRecognizer — Enhanced OCR description, NPU acceleration, legacy API comparison
  • ImageScaler — Image Super Resolution, MaxSupportedScaleFactor
  • ImageObjectExtractor — Object segmentation with point/rectangle hints
  • ImageObjectRemover — Object erasure workflow with mask
  • ImageDescriptionGenerator — Natural-language descriptions, description kinds
  • ImageObjectExtractorHint — Include/exclude points and rects
  • RecognizedText — Result container, Lines property
  • RecognizedLine — Text, words, style, confidence

Phase 2: Key method files (36 files)

  • LanguageModel: CreateAsync, EnsureReadyAsync, GetReadyState, GenerateResponseAsync (3 overloads), GenerateResponseFromEmbeddingsAsync (3 overloads), Close
  • TextSummarizer: SummarizeAsync, SummarizeConversationAsync, SummarizeParagraphAsync, constructor
  • TextRewriter: RewriteAsync (2 overloads), constructor
  • TextToTableConverter: ConvertAsync, constructor
  • TextRecognizer: CreateAsync, EnsureReadyAsync, GetReadyState, RecognizeTextFromImage, RecognizeTextFromImageAsync
  • ImageScaler: CreateAsync, EnsureReadyAsync, GetReadyState, MaxSupportedScaleFactor
  • ImageDescriptionGenerator: CreateAsync, DescribeAsync, EnsureReadyAsync, GetReadyState
  • ImageDescriptionKind enum
  • ImageObjectRemover: CreateAsync, EnsureReadyAsync, GetReadyState

Motivation

OGF quality scan identified 93 files in these namespaces with empty remarks/examples. This PR addresses the highest-impact class and method files. All claims were audited against API metadata to avoid fabrication — the questions above flag areas where we intentionally left information out rather than risk inaccuracy.

Fill in empty -remarks, -see-also, and -examples sections for 16
class-level API reference files across Microsoft.Windows.AI.Text and
Microsoft.Windows.AI.Imaging namespaces.

AI.Text classes updated:
- LanguageModel: Phi Silica integration, availability check pattern,
  IDisposable, NPU requirement, China restriction, code example
- TextSummarizer: Text Intelligence Skill, three summarization methods
- TextRewriter: tone options, rewriting behavior
- TextToTableConverter: structured table output
- ConversationItem: message/participant properties, conversation summary usage
- ConversationSummaryOptions: configuration for conversation summarization
- LanguageModelOptions: content filtering configuration
- LanguageModelResponseResult: status checking and error handling

AI.Imaging classes updated:
- TextRecognizer: enhanced OCR description, NPU acceleration, legacy comparison
- ImageScaler: Image Super Resolution, 8x scaling, MaxSupportedScaleFactor
- ImageObjectExtractor: object segmentation with hints
- ImageObjectRemover: object erasure workflow with mask
- ImageDescriptionGenerator: natural-language descriptions, description kinds
- ImageObjectExtractorHint: include/exclude points and rects
- RecognizedText: result container, Lines property
- RecognizedLine: text, words, style, confidence

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 2: Fill in -remarks, -see-also, and -examples for 36 method-level
API reference files across Microsoft.Windows.AI.Text and
Microsoft.Windows.AI.Imaging namespaces.

LanguageModel methods (10 files):
- CreateAsync, EnsureReadyAsync, GetReadyState: availability check pattern
- GenerateResponseAsync (3 overloads): token streaming, status checking,
  context window usage, content moderation, code example
- GenerateResponseFromEmbeddingsAsync (3 overloads): RAG scenarios
- Close: IDisposable guidance

Text Intelligence Skills (9 files):
- TextSummarizer: SummarizeAsync (with example), SummarizeConversationAsync,
  SummarizeParagraphAsync, constructor
- TextRewriter: RewriteAsync (2 overloads), constructor
- TextToTableConverter: ConvertAsync, constructor

Imaging methods (17 files):
- TextRecognizer: CreateAsync, EnsureReadyAsync, GetReadyState,
  RecognizeTextFromImage (ImageBuffer creation, result structure),
  RecognizeTextFromImageAsync
- ImageScaler: CreateAsync, EnsureReadyAsync, GetReadyState,
  MaxSupportedScaleFactor
- ImageDescriptionGenerator: CreateAsync, EnsureReadyAsync, GetReadyState,
  DescribeAsync (description kinds, content filtering)
- ImageDescriptionKind: usage guidance for each enum value
- ImageObjectRemover: CreateAsync, EnsureReadyAsync, GetReadyState

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@GrantMeStrength GrantMeStrength marked this pull request as draft June 3, 2026 20:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enriches the Windows AI WinRT API reference documentation by adding substantive -remarks, -see-also, and (in a couple of cases) -examples sections to 16 class-level pages across Microsoft.Windows.AI.Text and Microsoft.Windows.AI.Imaging, improving discoverability and usage guidance for Phi Silica, OCR, and imaging features.

Changes:

  • Added detailed remarks/see-also guidance for Text Intelligence skill classes (summarize/rewrite/text-to-table) and supporting types.
  • Added usage guidance for readiness checks / model setup, NPU/on-device behavior, and regional availability notes.
  • Added/expanded C# examples for key entry points (notably LanguageModel and TextSummarizer).

Reviewed changes

Copilot reviewed 52 out of 52 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
microsoft.windows.ai.text/texttotableconverter.md Added remarks/see-also describing converting text into structured rows/columns and linking related types.
microsoft.windows.ai.text/textsummarizer.md Added remarks/see-also plus a basic C# summarization example and method overview.
microsoft.windows.ai.text/textrewriter.md Expanded remarks/see-also describing rewriting behavior and tone options.
microsoft.windows.ai.text/languagemodelresponseresult.md Added remarks/see-also explaining status handling and diagnostic patterns.
microsoft.windows.ai.text/languagemodeloptions.md Added remarks/see-also for configuring model behavior and content filtering.
microsoft.windows.ai.text/languagemodel.md Added detailed remarks/see-also and a C# example covering availability and response generation.
microsoft.windows.ai.text/conversationsummaryoptions.md Added remarks describing how options affect conversation summarization output.
microsoft.windows.ai.text/conversationitem.md Added remarks/see-also clarifying role in conversation summarization input.
microsoft.windows.ai.imaging/textrecognizer.md Expanded remarks describing OCR usage, readiness pattern, and output types.
microsoft.windows.ai.imaging/recognizedtext.md Added remarks describing the OCR result container and navigation via lines/words.
microsoft.windows.ai.imaging/recognizedline.md Added remarks describing line-level OCR data (text/words/style/confidence).
microsoft.windows.ai.imaging/imagescaler.md Added remarks describing super resolution scaling, readiness, disposal, and max scaling factor.
microsoft.windows.ai.imaging/imageobjectremover.md Added remarks describing object removal workflow including mask generation and removal methods.
microsoft.windows.ai.imaging/imageobjectextractorhint.md Added remarks explaining include/exclude hint usage for segmentation guidance.
microsoft.windows.ai.imaging/imageobjectextractor.md Added remarks describing segmentation workflow, factory methods, and mask retrieval.
microsoft.windows.ai.imaging/imagedescriptiongenerator.md Added remarks describing description generation workflow, readiness, and result shape.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread microsoft.windows.ai.text/languagemodel.md Outdated
Comment thread microsoft.windows.ai.imaging/recognizedtext.md Outdated
Comment thread microsoft.windows.ai.imaging/imageobjectremover.md Outdated
- Use AIFeatureReadyState.Ready (not fabricated NotReady) in code examples
- Fix broken markdown link for RecognizeTextFromImageAsync in recognizedtext.md
- Fix incorrect filename suffix for RemoveFromSoftwareBitmap link

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 52 out of 52 changed files in this pull request and generated 16 comments.

Comment thread microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md Outdated
Comment thread microsoft.windows.ai.text/languagemodel_createasync_616540418.md Outdated
Comment thread microsoft.windows.ai.imaging/textrecognizer_getreadystate_1726041729.md Outdated
Comment thread microsoft.windows.ai.imaging/textrecognizer_createasync_616540418.md Outdated
Comment thread microsoft.windows.ai.imaging/imagescaler_getreadystate_1726041729.md Outdated
Comment thread microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md Outdated
Comment thread microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md Outdated
Comment thread microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimage_2145955329.md Outdated
Address Copilot review comments and audit findings:

- Replace all NotReady enum references with EnsureNeeded or != Ready
  (AIFeatureReadyState has Ready, EnsureNeeded, NotSupportedOnCurrentSystem,
  DisabledByUser — no NotReady value)
- Fix ContentFilterOptions link: contentsafety → contentmoderation
- Fix ImageBuffer method name: remove fabricated CreateForSoftwareBitmap,
  use verified CreateBufferAttachedToBitmap / CreateCopyFromBitmap
- Remove unverifiable 'up to 8x' scaling claim from MaxSupportedScaleFactor
- Remove unverifiable 'between 0 and 1' progress range claim
- Remove unverifiable 'handwritten vs. printed' style claim
- Soften SummarizeParagraphAsync vs SummarizeAsync comparison
- Soften RAG scenario claim on GenerateResponseFromEmbeddingsAsync
- Add using Microsoft.Windows.AI.Text namespace imports to all code examples

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 52 out of 52 changed files in this pull request and generated 7 comments.

Comment thread microsoft.windows.ai.text/textsummarizer.md Outdated
Comment thread microsoft.windows.ai.text/textrewriter.md Outdated
Comment thread microsoft.windows.ai.text/texttotableconverter.md Outdated
Comment thread microsoft.windows.ai.text/textsummarizer.md Outdated
Comment thread microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md Outdated
Comment thread microsoft.windows.ai.text/languagemodel.md Outdated
Comment thread microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md
- Fix 'lanugage' → 'language' typo in 3 files
- Add result.Status check before accessing result.Text in summarizer examples
- Handle NotSupportedOnCurrentSystem/DisabledByUser states separately from
  EnsureNeeded in availability check examples

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 52 out of 52 changed files in this pull request and generated 13 comments.

Comment thread microsoft.windows.ai.text/languagemodel_ensurereadyasync_1335418254.md Outdated
Comment thread microsoft.windows.ai.imaging/imagescaler.md Outdated
Comment thread microsoft.windows.ai.imaging/recognizedline.md Outdated
Comment thread microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md Outdated
Comment thread microsoft.windows.ai.text/languagemodel.md
Comment thread microsoft.windows.ai.text/texttotableconverter.md
Comment thread microsoft.windows.ai.text/textsummarizer.md
Comment thread microsoft.windows.ai.text/textrewriter.md
- Remove 'between 0 and 1' progress range (unverifiable)
- Remove 'up to 8x' scaling claim, point to MaxSupportedScaleFactor instead
- Remove 'handwritten or printed' — only Handwritten enum value exists
- Remove SummarizeAsync 'key points' comparison (unverifiable)
- Add status check to LanguageModel example

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants