From 48061a610df90573a526bd10183915b4301af5b3 Mon Sep 17 00:00:00 2001 From: John Kennedy Date: Wed, 3 Jun 2026 13:29:25 -0700 Subject: [PATCH 1/6] Add remarks, see-also, and examples to Windows AI API class docs 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> --- .../imagedescriptiongenerator.md | 8 +++++ .../imageobjectextractor.md | 8 +++++ .../imageobjectextractorhint.md | 4 +++ .../imageobjectremover.md | 8 +++++ microsoft.windows.ai.imaging/imagescaler.md | 8 +++++ .../recognizedline.md | 2 ++ .../recognizedtext.md | 2 ++ .../textrecognizer.md | 8 ++++- microsoft.windows.ai.text/conversationitem.md | 6 ++++ .../conversationsummaryoptions.md | 2 ++ microsoft.windows.ai.text/languagemodel.md | 33 +++++++++++++++++++ .../languagemodeloptions.md | 4 +++ .../languagemodelresponseresult.md | 6 ++++ microsoft.windows.ai.text/textrewriter.md | 11 ++++++- microsoft.windows.ai.text/textsummarizer.md | 29 ++++++++++++++++ .../texttotableconverter.md | 9 +++++ 16 files changed, 146 insertions(+), 2 deletions(-) diff --git a/microsoft.windows.ai.imaging/imagedescriptiongenerator.md b/microsoft.windows.ai.imaging/imagedescriptiongenerator.md index 389a5e439..9d76999c5 100644 --- a/microsoft.windows.ai.imaging/imagedescriptiongenerator.md +++ b/microsoft.windows.ai.imaging/imagedescriptiongenerator.md @@ -15,6 +15,14 @@ Represents an object that can generate a description for the content of an image ## -remarks +**ImageDescriptionGenerator** uses AI to produce natural-language descriptions of image content. The descriptions can be used for accessibility (alt text), search indexing, or content understanding. + +Before creating an **ImageDescriptionGenerator** instance, call [GetReadyState](imagedescriptiongenerator_getreadystate_1726041729.md) to check whether the model is available on the device. If the model is not ready, call [EnsureReadyAsync](imagedescriptiongenerator_ensurereadyasync_1335418254.md) to download and prepare it. Then call [CreateAsync](imagedescriptiongenerator_createasync_616540418.md) to create an instance. + +Call [DescribeAsync](imagedescriptiongenerator_describeasync_1940073159.md) with an image and an [ImageDescriptionKind](imagedescriptionkind.md) to specify the format of the description. The result is an [ImageDescriptionResult](imagedescriptionresult.md) containing the generated description text and a status code. + +The **ImageDescriptionGenerator** class implements [IDisposable](/dotnet/api/system.idisposable), so you should use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging) diff --git a/microsoft.windows.ai.imaging/imageobjectextractor.md b/microsoft.windows.ai.imaging/imageobjectextractor.md index 3c0c755f9..69ad05f8b 100644 --- a/microsoft.windows.ai.imaging/imageobjectextractor.md +++ b/microsoft.windows.ai.imaging/imageobjectextractor.md @@ -15,6 +15,14 @@ Represents an object that can extract artifacts from an image. ## -remarks +**ImageObjectExtractor** uses AI to identify and segment specific objects within an image. You provide hints in the form of points and rectangles through an [ImageObjectExtractorHint](imageobjectextractorhint.md), and the extractor returns a mask of the identified object. + +Create an **ImageObjectExtractor** from either a [SoftwareBitmap](/uwp/api/windows.graphics.imaging.softwarebitmap) using [CreateWithSoftwareBitmapAsync](imageobjectextractor_createwithsoftwarebitmapasync_1289883320.md) or an [ImageBuffer](/windows/windows-app-sdk/api/winrt/microsoft.graphics.imaging.imagebuffer) using [CreateWithImageBufferAsync](imageobjectextractor_createwithimagebufferasync_698545862.md). Both factory methods first load and analyze the source image. + +After creating the extractor, call [GetSoftwareBitmapObjectMask](imageobjectextractor_getsoftwarebitmapobjectmask_775650447.md) or [GetImageBufferObjectMask](imageobjectextractor_getimagebufferobjectmask_396059515.md) with an **ImageObjectExtractorHint** to retrieve the object mask. + +The **ImageObjectExtractor** class implements [IDisposable](/dotnet/api/system.idisposable), so you should use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging) diff --git a/microsoft.windows.ai.imaging/imageobjectextractorhint.md b/microsoft.windows.ai.imaging/imageobjectextractorhint.md index 5a59eae59..3a734f5e8 100644 --- a/microsoft.windows.ai.imaging/imageobjectextractorhint.md +++ b/microsoft.windows.ai.imaging/imageobjectextractorhint.md @@ -15,6 +15,10 @@ Represents an object that helps an [ImageObjectExtractor](imageobjectextractor.m ## -remarks +Use **ImageObjectExtractorHint** to guide an [ImageObjectExtractor](imageobjectextractor.md) toward the object you want to segment. You can specify points that should be included in the extracted region through [IncludePoints](imageobjectextractorhint_includepoints.md), points that should be excluded through [ExcludePoints](imageobjectextractorhint_excludepoints.md), and rectangular regions that contain the target object through [IncludeRects](imageobjectextractorhint_includerects.md). + +Combining include and exclude points gives you fine-grained control when multiple objects are close together. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging) diff --git a/microsoft.windows.ai.imaging/imageobjectremover.md b/microsoft.windows.ai.imaging/imageobjectremover.md index 86337e50b..8f88a68b2 100644 --- a/microsoft.windows.ai.imaging/imageobjectremover.md +++ b/microsoft.windows.ai.imaging/imageobjectremover.md @@ -15,6 +15,14 @@ Represents an object that can remove artifacts from images. ## -remarks +**ImageObjectRemover** uses AI to erase objects from an image and fill the erased area with a reconstruction of the background. This is useful for removing unwanted elements from photos while preserving a natural appearance. + +Before creating an **ImageObjectRemover** instance, call [GetReadyState](imageobjectremover_getreadystate_1726041729.md) to check whether the model is available on the device. If the model is not ready, call [EnsureReadyAsync](imageobjectremover_ensurereadyasync_1335418254.md) to download and prepare it. Then call [CreateAsync](imageobjectremover_createasync_616540418.md) to create an instance. + +To remove an object, you typically first use [ImageObjectExtractor](imageobjectextractor.md) to generate a mask for the object you want to remove, then pass that mask along with the source image to [RemoveFromImageBuffer](imageobjectremover_removefromimagebuffer_1878721313.md) or [RemoveFromSoftwareBitmap](imageobjectremover_removefromsoftwarebitmap_1113498764.md). + +The **ImageObjectRemover** class implements [IDisposable](/dotnet/api/system.idisposable), so you should use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging) diff --git a/microsoft.windows.ai.imaging/imagescaler.md b/microsoft.windows.ai.imaging/imagescaler.md index d2e74b65b..e867a8689 100644 --- a/microsoft.windows.ai.imaging/imagescaler.md +++ b/microsoft.windows.ai.imaging/imagescaler.md @@ -15,6 +15,14 @@ Represents an object that can resize an image and increase or decrease its resol ## -remarks +**ImageScaler** uses AI-powered Image Super Resolution to scale and sharpen images up to 8× their original size while maintaining quality. The model runs on the device's NPU for hardware-accelerated performance. + +Before creating an **ImageScaler** instance, call [GetReadyState](imagescaler_getreadystate_1726041729.md) to check whether the model is available on the device. If the model is not ready, call [EnsureReadyAsync](imagescaler_ensurereadyasync_1335418254.md) to download and prepare it. Then call [CreateAsync](imagescaler_createasync_616540418.md) to create an instance. + +The **ImageScaler** class implements [IDisposable](/dotnet/api/system.idisposable), so you should use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. + +Check the [MaxSupportedScaleFactor](imagescaler_maxsupportedscalefactor.md) property to determine the maximum scaling factor supported by the device. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging), [Image scaler walkthrough](/windows/ai/apis/imaging-tutorial) diff --git a/microsoft.windows.ai.imaging/recognizedline.md b/microsoft.windows.ai.imaging/recognizedline.md index 783d40a5c..dc1e4f6cc 100644 --- a/microsoft.windows.ai.imaging/recognizedline.md +++ b/microsoft.windows.ai.imaging/recognizedline.md @@ -15,6 +15,8 @@ Represents a single line of text in an image detected by text recognition. ## -remarks +A **RecognizedLine** represents a single line of text detected within an image by the [TextRecognizer](textrecognizer.md). Access the [Text](recognizedline_text.md) property to get the full text of the line, the [Words](recognizedline_words.md) property to iterate over individual [RecognizedWord](recognizedword.md) objects, and the [Style](recognizedline_style.md) property to determine whether the text appears handwritten or printed (with a confidence level from [LineStyleConfidence](recognizedline_linestyleconfidence.md)). + ## -see-also [Get Started with AI Text Recognition (OCR)](/windows/ai/apis/text-recognition), [Text recognizer walkthrough](/windows/ai/apis/text-recognition-tutorial) diff --git a/microsoft.windows.ai.imaging/recognizedtext.md b/microsoft.windows.ai.imaging/recognizedtext.md index 7948d9754..e527d6272 100644 --- a/microsoft.windows.ai.imaging/recognizedtext.md +++ b/microsoft.windows.ai.imaging/recognizedtext.md @@ -15,6 +15,8 @@ Represents the result of a text recognition operation on an image. ## -remarks +**RecognizedText** contains the full result of a text recognition (OCR) operation performed by [TextRecognizer](textrecognizer.md). Access the [Lines](recognizedtext_lines.md) property to iterate over each [RecognizedLine](recognizedline.md) detected in the image. Each line in turn contains individual [RecognizedWord](recognizedword.md) objects with bounding boxes and confidence scores. + ## -see-also [RecognizeTextFromImage](textrecognizer_recognizetextfromimage_2145955329.md), [RecognizeTextFromImageAsync], (textrecognizer_recognizetextfromimageasync_356575282.md), [Get Started with AI Text Recognition (OCR)](/windows/ai/apis/text-recognition), [Text recognizer walkthrough](/windows/ai/apis/text-recognition-tutorial) diff --git a/microsoft.windows.ai.imaging/textrecognizer.md b/microsoft.windows.ai.imaging/textrecognizer.md index e03f3f380..48d688412 100644 --- a/microsoft.windows.ai.imaging/textrecognizer.md +++ b/microsoft.windows.ai.imaging/textrecognizer.md @@ -15,7 +15,13 @@ Represents an object that can perform AI-based optical character recognition (OC ## -remarks -Can be used to identify characters, words, lines, polygonal text boundaries, and provide confidence levels for each match. +**TextRecognizer** performs AI-powered optical character recognition (OCR) on images using hardware acceleration on devices with a neural processing unit (NPU). It is faster and more accurate than the legacy [Windows.Media.Ocr.OcrEngine](/uwp/api/windows.media.ocr.ocrengine) APIs. + +Before creating a **TextRecognizer** instance, call [GetReadyState](textrecognizer_getreadystate_1726041729.md) to check whether the model is available on the device. If the model is not ready, call [EnsureReadyAsync](textrecognizer_ensurereadyasync_1335418254.md) to download and prepare it. Then call [CreateAsync](textrecognizer_createasync_616540418.md) to create an instance. + +Call [RecognizeTextFromImage](textrecognizer_recognizetextfromimage_2145955329.md) or [RecognizeTextFromImageAsync](textrecognizer_recognizetextfromimageasync_356575282.md) with an [ImageBuffer](/windows/windows-app-sdk/api/winrt/microsoft.graphics.imaging.imagebuffer) to get a [RecognizedText](recognizedtext.md) result containing detected lines, words, bounding boxes, and confidence levels. + +The **TextRecognizer** class implements [IDisposable](/dotnet/api/system.idisposable), so you should use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. ## -see-also diff --git a/microsoft.windows.ai.text/conversationitem.md b/microsoft.windows.ai.text/conversationitem.md index 5675de82c..931a07f24 100644 --- a/microsoft.windows.ai.text/conversationitem.md +++ b/microsoft.windows.ai.text/conversationitem.md @@ -15,6 +15,12 @@ Represents the messages in a conversation. ## -remarks +A **ConversationItem** represents a single message in a conversation. Each item has a [Message](conversationitem_message.md) property containing the message text and a [Participant](conversationitem_participant.md) property identifying who sent the message. + +You use a collection of **ConversationItem** objects as input to [TextSummarizer.SummarizeConversationAsync](textsummarizer_summarizeconversationasync_1593584223.md) to produce a summary of a multi-turn conversation. Use [ConversationSummaryOptions](conversationsummaryoptions.md) to control how the summary is generated. + ## -see-also +[TextSummarizer](textsummarizer.md), [ConversationSummaryOptions](conversationsummaryoptions.md), [TextSummarizer.SummarizeConversationAsync](textsummarizer_summarizeconversationasync_1593584223.md) + ## -examples diff --git a/microsoft.windows.ai.text/conversationsummaryoptions.md b/microsoft.windows.ai.text/conversationsummaryoptions.md index b83154a66..390eb9680 100644 --- a/microsoft.windows.ai.text/conversationsummaryoptions.md +++ b/microsoft.windows.ai.text/conversationsummaryoptions.md @@ -15,6 +15,8 @@ Provides configuration options for summarizing a conversation. ## -remarks +Use **ConversationSummaryOptions** to control the behavior of [TextSummarizer.SummarizeConversationAsync](textsummarizer_summarizeconversationasync_1593584223.md). You can configure whether to include message citations for each key point, whether to attribute key points to specific participants, the maximum number of key points to return, and the language of the summary output. + ## -see-also [TextSummarizer.SummarizeConversationAsync](textsummarizer_summarizeconversationasync_1593584223.md), [TextSummarizer.IsPromptLargerThanContext](textsummarizer_ispromptlargerthancontext_123976394.md) diff --git a/microsoft.windows.ai.text/languagemodel.md b/microsoft.windows.ai.text/languagemodel.md index 4334c356c..3b4f5af31 100644 --- a/microsoft.windows.ai.text/languagemodel.md +++ b/microsoft.windows.ai.text/languagemodel.md @@ -15,6 +15,39 @@ Represents a local small language model. ## -remarks +The **LanguageModel** class provides access to Phi Silica, a local small language model (SLM) optimized for Windows Copilot+ PCs with a neural processing unit (NPU). The model runs entirely on-device, which means prompts and responses stay local and no internet connection is required. + +Before creating a **LanguageModel** instance, call [GetReadyState](languagemodel_getreadystate_1726041729.md) to check whether the model is available on the device. If the model is not ready, call [EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md) to download and prepare it. Then call [CreateAsync](languagemodel_createasync_616540418.md) to create an instance. + +The **LanguageModel** class implements [IDisposable](/dotnet/api/system.idisposable), so you should use a `using` statement (C#) or call **Close** (C++/WinRT) to release model resources when you are done. + +You can use **LanguageModel** directly to generate free-form text responses through [GenerateResponseAsync](languagemodel_generateresponseasync_1596814667.md), or pass a **LanguageModel** instance to a Text Intelligence Skill class such as [TextSummarizer](textsummarizer.md), [TextRewriter](textrewriter.md), or [TextToTableConverter](texttotableconverter.md) for structured text transformations. + +> [!IMPORTANT] +> Phi Silica features are not available in China. + ## -see-also +[Get started with Phi Silica](/windows/ai/apis/phi-silica), [LanguageModelOptions](languagemodeloptions.md), [LanguageModelResponseResult](languagemodelresponseresult.md), [TextSummarizer](textsummarizer.md), [TextRewriter](textrewriter.md), [TextToTableConverter](texttotableconverter.md), [Content moderation](/windows/ai/apis/content-moderation) + ## -examples + +The following example shows how to check model availability, create a **LanguageModel**, and generate a response. + +```csharp +using Microsoft.Windows.AI.Text; +using Microsoft.Windows.AI; + +if (LanguageModel.GetReadyState() == AIFeatureReadyState.NotReady) +{ + var op = await LanguageModel.EnsureReadyAsync(); +} + +using LanguageModel languageModel = await LanguageModel.CreateAsync(); + +string prompt = "Provide the molecular formula for glucose."; +var result = await languageModel.GenerateResponseAsync(prompt); + +Console.WriteLine(result.Text); +// Output: C6H12O6 +``` diff --git a/microsoft.windows.ai.text/languagemodeloptions.md b/microsoft.windows.ai.text/languagemodeloptions.md index 2a5f22701..2ee37a137 100644 --- a/microsoft.windows.ai.text/languagemodeloptions.md +++ b/microsoft.windows.ai.text/languagemodeloptions.md @@ -15,6 +15,10 @@ Defines the options that affect how the language model responds to a prompt. ## -remarks +Pass a **LanguageModelOptions** instance to [LanguageModel.GenerateResponseAsync](languagemodel_generateresponseasync_1153118514.md) to customize model behavior. You can configure content filtering through the [ContentFilterOptions](languagemodeloptions_contentfilteroptions.md) property, which controls the severity levels allowed for different content categories. + ## -see-also +[LanguageModel.GenerateResponseAsync](languagemodel_generateresponseasync_1153118514.md), [LanguageModel](languagemodel.md), [Content moderation](/windows/ai/apis/content-moderation) + ## -examples diff --git a/microsoft.windows.ai.text/languagemodelresponseresult.md b/microsoft.windows.ai.text/languagemodelresponseresult.md index 7a73e3966..0eaf16a7c 100644 --- a/microsoft.windows.ai.text/languagemodelresponseresult.md +++ b/microsoft.windows.ai.text/languagemodelresponseresult.md @@ -15,6 +15,12 @@ Represents a language model response. ## -remarks +**LanguageModelResponseResult** is returned by [LanguageModel.GenerateResponseAsync](languagemodel_generateresponseasync_1596814667.md) and contains the generated text, a status code, and extended error information if the request failed. + +Check the [Status](languagemodelresponseresult_status.md) property to determine whether the response completed successfully. A status of [Complete](languagemodelresponsestatus.md) indicates that the [Text](languagemodelresponseresult_text.md) property contains the full response. Other status values indicate errors such as content moderation blocks, context window overflow, or policy restrictions. When the status indicates an error, call [ExtendedError](languagemodelresponseresult_extendederror.md) for diagnostic details. + ## -see-also +[LanguageModel.GenerateResponseAsync](languagemodel_generateresponseasync_1596814667.md), [LanguageModelResponseStatus](languagemodelresponsestatus.md), [LanguageModel](languagemodel.md) + ## -examples diff --git a/microsoft.windows.ai.text/textrewriter.md b/microsoft.windows.ai.text/textrewriter.md index bab20ee9b..f4ede8717 100644 --- a/microsoft.windows.ai.text/textrewriter.md +++ b/microsoft.windows.ai.text/textrewriter.md @@ -15,8 +15,17 @@ Represents a specialized lanugage model capable of rewriting text input. ## -remarks -This object corrects spelling and grammar errors, enhances word choice, and maintains the tone and meaning while preserving the original intent of the text. +**TextRewriter** is a Text Intelligence Skill that uses a local [LanguageModel](languagemodel.md) to rephrase text. You create an instance by passing a **LanguageModel** to the [TextRewriter constructor](textrewriter_textrewriter_769658051.md). + +The rewriter corrects spelling and grammar errors, enhances word choice, and optimizes clarity and readability while preserving the original meaning and intent. You can optionally specify a [TextRewriteTone](textrewritetone.md) to control the style of the rewritten output (for example, professional, casual, or friendly). + +Call [RewriteAsync](textrewriter_rewriteasync_54766249.md) with the text you want to rewrite. An overload accepts a **TextRewriteTone** parameter to change the output style. + +> [!IMPORTANT] +> Phi Silica features are not available in China. ## -see-also +[Get started with Phi Silica](/windows/ai/apis/phi-silica), [LanguageModel](languagemodel.md), [TextRewriteTone](textrewritetone.md), [TextSummarizer](textsummarizer.md), [TextToTableConverter](texttotableconverter.md) + ## -examples diff --git a/microsoft.windows.ai.text/textsummarizer.md b/microsoft.windows.ai.text/textsummarizer.md index 62d39421d..c1262af77 100644 --- a/microsoft.windows.ai.text/textsummarizer.md +++ b/microsoft.windows.ai.text/textsummarizer.md @@ -15,6 +15,35 @@ Represents a specialized lanugage model capable of summarizing text input. ## -remarks +**TextSummarizer** is a Text Intelligence Skill that uses a local [LanguageModel](languagemodel.md) to produce concise summaries of text. You create an instance by passing a **LanguageModel** to the [TextSummarizer constructor](textsummarizer_textsummarizer_769658051.md). + +The class supports three summarization methods: + +- [SummarizeAsync](textsummarizer_summarizeasync_822055106.md) — summarizes a block of text. +- [SummarizeParagraphAsync](textsummarizer_summarizeparagraphasync_633554225.md) — summarizes text and returns the result as a paragraph. +- [SummarizeConversationAsync](textsummarizer_summarizeconversationasync_1593584223.md) — summarizes a conversation represented by a collection of [ConversationItem](conversationitem.md) objects, with options controlled by [ConversationSummaryOptions](conversationsummaryoptions.md). + +Before calling any summarization method, confirm that the text fits within the model's context window by calling [IsPromptLargerThanContext](textsummarizer_ispromptlargerthancontext_123976394.md). + +> [!IMPORTANT] +> Phi Silica features are not available in China. + ## -see-also +[Get started with Phi Silica](/windows/ai/apis/phi-silica), [LanguageModel](languagemodel.md), [ConversationItem](conversationitem.md), [ConversationSummaryOptions](conversationsummaryoptions.md), [TextRewriter](textrewriter.md), [TextToTableConverter](texttotableconverter.md) + ## -examples + +The following example shows how to summarize a block of text. + +```csharp +using Microsoft.Windows.AI.Text; + +using LanguageModel languageModel = await LanguageModel.CreateAsync(); + +var textSummarizer = new TextSummarizer(languageModel); +string text = "This is a large amount of text I want to have summarized."; +var result = await textSummarizer.SummarizeAsync(text); + +Console.WriteLine(result.Text); +``` diff --git a/microsoft.windows.ai.text/texttotableconverter.md b/microsoft.windows.ai.text/texttotableconverter.md index 576ee56d2..159aebe7b 100644 --- a/microsoft.windows.ai.text/texttotableconverter.md +++ b/microsoft.windows.ai.text/texttotableconverter.md @@ -15,6 +15,15 @@ Represents a specialized lanugage model capable of formatting text input into a ## -remarks +**TextToTableConverter** is a Text Intelligence Skill that uses a local [LanguageModel](languagemodel.md) to format text into a structured table. You create an instance by passing a **LanguageModel** to the [TextToTableConverter constructor](texttotableconverter_texttotableconverter_769658051.md). + +Call [ConvertAsync](texttotableconverter_convertasync_1749572750.md) to convert text into a [TextToTableResponseResult](texttotableresponseresult.md). The result contains rows accessible through [GetRows](texttotableresponseresult_getrows_1751622459.md), where each [TextToTableRow](texttotablerow.md) provides column values through [GetColumns](texttotablerow_getcolumns_2060251348.md). + +> [!IMPORTANT] +> Phi Silica features are not available in China. + ## -see-also +[Get started with Phi Silica](/windows/ai/apis/phi-silica), [LanguageModel](languagemodel.md), [TextToTableResponseResult](texttotableresponseresult.md), [TextToTableRow](texttotablerow.md), [TextSummarizer](textsummarizer.md), [TextRewriter](textrewriter.md) + ## -examples From 177b2ab4ee2c10b47e0f8a18870444167ff7c8c7 Mon Sep 17 00:00:00 2001 From: John Kennedy Date: Wed, 3 Jun 2026 13:34:31 -0700 Subject: [PATCH 2/6] Add remarks and examples to key method API reference files 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> --- ...criptiongenerator_createasync_616540418.md | 4 ++++ ...ptiongenerator_describeasync_1940073159.md | 6 +++++ ...ongenerator_ensurereadyasync_1335418254.md | 2 ++ ...ptiongenerator_getreadystate_1726041729.md | 2 ++ .../imagedescriptionkind.md | 2 ++ ...mageobjectremover_createasync_616540418.md | 4 ++++ ...jectremover_ensurereadyasync_1335418254.md | 2 ++ ...eobjectremover_getreadystate_1726041729.md | 2 ++ .../imagescaler_createasync_616540418.md | 4 ++++ ...imagescaler_ensurereadyasync_1335418254.md | 2 ++ .../imagescaler_getreadystate_1726041729.md | 2 ++ .../imagescaler_maxsupportedscalefactor.md | 2 ++ .../textrecognizer_createasync_616540418.md | 4 ++++ ...trecognizer_ensurereadyasync_1335418254.md | 4 ++++ ...textrecognizer_getreadystate_1726041729.md | 2 ++ ...nizer_recognizetextfromimage_2145955329.md | 6 +++++ ...r_recognizetextfromimageasync_356575282.md | 2 ++ .../languagemodel_close_811482585.md | 2 ++ .../languagemodel_createasync_616540418.md | 6 +++++ ...nguagemodel_ensurereadyasync_1335418254.md | 8 +++++++ ...emodel_generateresponseasync_1153118514.md | 8 +++++++ ...emodel_generateresponseasync_1596814667.md | 23 +++++++++++++++++++ ...gemodel_generateresponseasync_323610015.md | 6 +++++ ...eresponsefromembeddingsasync_1128583137.md | 4 ++++ ...teresponsefromembeddingsasync_253779765.md | 6 +++++ ...teresponsefromembeddingsasync_508759908.md | 4 ++++ .../languagemodel_getreadystate_1726041729.md | 11 +++++++++ .../textrewriter_rewriteasync_2021107407.md | 4 ++++ .../textrewriter_rewriteasync_54766249.md | 8 +++++++ .../textrewriter_textrewriter_769658051.md | 4 ++++ ...textsummarizer_summarizeasync_822055106.md | 18 +++++++++++++++ ...r_summarizeconversationasync_1593584223.md | 6 +++++ ...rizer_summarizeparagraphasync_633554225.md | 4 ++++ ...textsummarizer_textsummarizer_769658051.md | 4 ++++ ...otableconverter_convertasync_1749572750.md | 6 +++++ ...onverter_texttotableconverter_769658051.md | 4 ++++ 36 files changed, 188 insertions(+) diff --git a/microsoft.windows.ai.imaging/imagedescriptiongenerator_createasync_616540418.md b/microsoft.windows.ai.imaging/imagedescriptiongenerator_createasync_616540418.md index 33c27d074..944f97d07 100644 --- a/microsoft.windows.ai.imaging/imagedescriptiongenerator_createasync_616540418.md +++ b/microsoft.windows.ai.imaging/imagedescriptiongenerator_createasync_616540418.md @@ -19,6 +19,10 @@ An asynchronous operation object that returns an [ImageDescriptionGenerator](ima ## -remarks +Call [GetReadyState](imagedescriptiongenerator_getreadystate_1726041729.md) before calling this method. If **GetReadyState** returns `NotReady`, call [EnsureReadyAsync](imagedescriptiongenerator_ensurereadyasync_1335418254.md) first to download and install the model. + +The returned **ImageDescriptionGenerator** implements [IDisposable](/dotnet/api/system.idisposable). Use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging) diff --git a/microsoft.windows.ai.imaging/imagedescriptiongenerator_describeasync_1940073159.md b/microsoft.windows.ai.imaging/imagedescriptiongenerator_describeasync_1940073159.md index b5cba3124..67b51cd9a 100644 --- a/microsoft.windows.ai.imaging/imagedescriptiongenerator_describeasync_1940073159.md +++ b/microsoft.windows.ai.imaging/imagedescriptiongenerator_describeasync_1940073159.md @@ -33,6 +33,12 @@ An asynchronous operation with progress object which, when it completes, contain ## -remarks +The [ImageDescriptionKind](imagedescriptionkind.md) parameter controls the format and detail level of the description. Choose `BriefDescription` for a short caption, `DetailedDescription` for more thorough coverage, `DiagramDescription` for diagrams and charts, or `AccessibleDescription` for accessibility-optimized alt text. + +The [ContentFilterOptions](../microsoft.windows.ai.contentsafety/contentfilteroptions.md) parameter lets you configure the content moderation severity levels. + +The returned [ImageDescriptionResult](imagedescriptionresult.md) contains the generated [Description](imagedescriptionresult_description.md) text and a [Status](imagedescriptionresult_status.md) code. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging) diff --git a/microsoft.windows.ai.imaging/imagedescriptiongenerator_ensurereadyasync_1335418254.md b/microsoft.windows.ai.imaging/imagedescriptiongenerator_ensurereadyasync_1335418254.md index 8ebae3d6f..234755686 100644 --- a/microsoft.windows.ai.imaging/imagedescriptiongenerator_ensurereadyasync_1335418254.md +++ b/microsoft.windows.ai.imaging/imagedescriptiongenerator_ensurereadyasync_1335418254.md @@ -19,6 +19,8 @@ An asynchronous operation with progress object that returns an [AIFeatureReadyRe ## -remarks +Call [GetReadyState](imagedescriptiongenerator_getreadystate_1726041729.md) before calling this method to determine whether the model needs to be installed. If the model is already ready, you can skip calling **EnsureReadyAsync** and proceed directly to [CreateAsync](imagedescriptiongenerator_createasync_616540418.md). + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging) diff --git a/microsoft.windows.ai.imaging/imagedescriptiongenerator_getreadystate_1726041729.md b/microsoft.windows.ai.imaging/imagedescriptiongenerator_getreadystate_1726041729.md index ea662e583..d0890a72e 100644 --- a/microsoft.windows.ai.imaging/imagedescriptiongenerator_getreadystate_1726041729.md +++ b/microsoft.windows.ai.imaging/imagedescriptiongenerator_getreadystate_1726041729.md @@ -21,6 +21,8 @@ Returns `Ready` if the underlying language model is installed. ## -remarks +Use this method to check whether the image description model is available on the device before calling [CreateAsync](imagedescriptiongenerator_createasync_616540418.md). If the returned state is `NotReady`, call [EnsureReadyAsync](imagedescriptiongenerator_ensurereadyasync_1335418254.md) to download and install the model. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging) diff --git a/microsoft.windows.ai.imaging/imagedescriptionkind.md b/microsoft.windows.ai.imaging/imagedescriptionkind.md index e4cf411d3..35e5a2674 100644 --- a/microsoft.windows.ai.imaging/imagedescriptionkind.md +++ b/microsoft.windows.ai.imaging/imagedescriptionkind.md @@ -33,6 +33,8 @@ Generated description is optimized for accessibility. ## -remarks +Specifies the format and detail level of a description generated by [ImageDescriptionGenerator.DescribeAsync](imagedescriptiongenerator_describeasync_1940073159.md). Choose the kind that best matches your use case — for example, use `AccessibleDescription` when generating alt text for screen readers, or `DiagramDescription` for flowcharts and technical diagrams. + ## -see-also [DescribeAsync](imagedescriptiongenerator_describeasync_1940073159.md), [Get Started with AI Imaging](/windows/ai/apis/imaging) diff --git a/microsoft.windows.ai.imaging/imageobjectremover_createasync_616540418.md b/microsoft.windows.ai.imaging/imageobjectremover_createasync_616540418.md index 83e172f91..05bae2f02 100644 --- a/microsoft.windows.ai.imaging/imageobjectremover_createasync_616540418.md +++ b/microsoft.windows.ai.imaging/imageobjectremover_createasync_616540418.md @@ -19,6 +19,10 @@ An asynchronous operation object that returns an [ImageObjectRemover](imageobjec ## -remarks +Call [GetReadyState](imageobjectremover_getreadystate_1726041729.md) before calling this method. If **GetReadyState** returns `NotReady`, call [EnsureReadyAsync](imageobjectremover_ensurereadyasync_1335418254.md) first to download and install the model. + +The returned **ImageObjectRemover** implements [IDisposable](/dotnet/api/system.idisposable). Use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging) diff --git a/microsoft.windows.ai.imaging/imageobjectremover_ensurereadyasync_1335418254.md b/microsoft.windows.ai.imaging/imageobjectremover_ensurereadyasync_1335418254.md index c2d397c08..3d1f737e3 100644 --- a/microsoft.windows.ai.imaging/imageobjectremover_ensurereadyasync_1335418254.md +++ b/microsoft.windows.ai.imaging/imageobjectremover_ensurereadyasync_1335418254.md @@ -19,6 +19,8 @@ An asynchronous operation with progress object that returns an [AIFeatureReadyRe ## -remarks +Call [GetReadyState](imageobjectremover_getreadystate_1726041729.md) before calling this method to determine whether the model needs to be installed. If the model is already ready, you can skip calling **EnsureReadyAsync** and proceed directly to [CreateAsync](imageobjectremover_createasync_616540418.md). + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging) diff --git a/microsoft.windows.ai.imaging/imageobjectremover_getreadystate_1726041729.md b/microsoft.windows.ai.imaging/imageobjectremover_getreadystate_1726041729.md index caafdcb05..63ae4e3d0 100644 --- a/microsoft.windows.ai.imaging/imageobjectremover_getreadystate_1726041729.md +++ b/microsoft.windows.ai.imaging/imageobjectremover_getreadystate_1726041729.md @@ -21,6 +21,8 @@ Returns `Ready` if the underlying language model is installed. ## -remarks +Use this method to check whether the object removal model is available on the device before calling [CreateAsync](imageobjectremover_createasync_616540418.md). If the returned state is `NotReady`, call [EnsureReadyAsync](imageobjectremover_ensurereadyasync_1335418254.md) to download and install the model. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging) diff --git a/microsoft.windows.ai.imaging/imagescaler_createasync_616540418.md b/microsoft.windows.ai.imaging/imagescaler_createasync_616540418.md index 0108d61dd..0e1016a19 100644 --- a/microsoft.windows.ai.imaging/imagescaler_createasync_616540418.md +++ b/microsoft.windows.ai.imaging/imagescaler_createasync_616540418.md @@ -19,6 +19,10 @@ An asynchronous operation object that returns an [ImageScaler](imagescaler.md) o ## -remarks +Call [GetReadyState](imagescaler_getreadystate_1726041729.md) before calling this method. If **GetReadyState** returns `NotReady`, call [EnsureReadyAsync](imagescaler_ensurereadyasync_1335418254.md) first to download and install the model. + +The returned **ImageScaler** implements [IDisposable](/dotnet/api/system.idisposable). Use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging), [Image scaler walkthrough](/windows/ai/apis/imaging-tutorial) diff --git a/microsoft.windows.ai.imaging/imagescaler_ensurereadyasync_1335418254.md b/microsoft.windows.ai.imaging/imagescaler_ensurereadyasync_1335418254.md index 7becd776d..977afca20 100644 --- a/microsoft.windows.ai.imaging/imagescaler_ensurereadyasync_1335418254.md +++ b/microsoft.windows.ai.imaging/imagescaler_ensurereadyasync_1335418254.md @@ -19,6 +19,8 @@ An asynchronous operation with progress object that returns an [AIFeatureReadyRe ## -remarks +Call [GetReadyState](imagescaler_getreadystate_1726041729.md) before calling this method to determine whether the model needs to be installed. If the model is already ready, you can skip calling **EnsureReadyAsync** and proceed directly to [CreateAsync](imagescaler_createasync_616540418.md). + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging), [Image scaler walkthrough](/windows/ai/apis/imaging-tutorial) diff --git a/microsoft.windows.ai.imaging/imagescaler_getreadystate_1726041729.md b/microsoft.windows.ai.imaging/imagescaler_getreadystate_1726041729.md index 92dea0155..3d17a5f25 100644 --- a/microsoft.windows.ai.imaging/imagescaler_getreadystate_1726041729.md +++ b/microsoft.windows.ai.imaging/imagescaler_getreadystate_1726041729.md @@ -21,6 +21,8 @@ Returns `Ready` if the underlying language model is installed. ## -remarks +Use this method to check whether the image scaling model is available on the device before calling [CreateAsync](imagescaler_createasync_616540418.md). If the returned state is `NotReady`, call [EnsureReadyAsync](imagescaler_ensurereadyasync_1335418254.md) to download and install the model. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging), [Image scaler walkthrough](/windows/ai/apis/imaging-tutorial) diff --git a/microsoft.windows.ai.imaging/imagescaler_maxsupportedscalefactor.md b/microsoft.windows.ai.imaging/imagescaler_maxsupportedscalefactor.md index ce1dcaa5e..8fa3377db 100644 --- a/microsoft.windows.ai.imaging/imagescaler_maxsupportedscalefactor.md +++ b/microsoft.windows.ai.imaging/imagescaler_maxsupportedscalefactor.md @@ -19,6 +19,8 @@ The maximum scale factor supported by the [ImageScaler](imagescaler.md). ## -remarks +The maximum scale factor depends on the device hardware and model capabilities. The Image Super Resolution feature supports scaling up to 8× on supported devices. Always check this property before requesting a specific scale factor to avoid errors. + ## -see-also [Get Started with AI Imaging](/windows/ai/apis/imaging), [Image scaler walkthrough](/windows/ai/apis/imaging-tutorial) diff --git a/microsoft.windows.ai.imaging/textrecognizer_createasync_616540418.md b/microsoft.windows.ai.imaging/textrecognizer_createasync_616540418.md index 96907a245..1e7225e89 100644 --- a/microsoft.windows.ai.imaging/textrecognizer_createasync_616540418.md +++ b/microsoft.windows.ai.imaging/textrecognizer_createasync_616540418.md @@ -19,6 +19,10 @@ An asynchronous operation object that returns a [TextRecognizer](textrecognizer. ## -remarks +Call [GetReadyState](textrecognizer_getreadystate_1726041729.md) before calling this method. If **GetReadyState** returns `NotReady`, call [EnsureReadyAsync](textrecognizer_ensurereadyasync_1335418254.md) first to download and install the model. + +The returned **TextRecognizer** implements [IDisposable](/dotnet/api/system.idisposable). Use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. + ## -see-also [Get Started with AI Text Recognition (OCR)](/windows/ai/apis/text-recognition), [Text recognizer walkthrough](/windows/ai/apis/text-recognition-tutorial) diff --git a/microsoft.windows.ai.imaging/textrecognizer_ensurereadyasync_1335418254.md b/microsoft.windows.ai.imaging/textrecognizer_ensurereadyasync_1335418254.md index 1cc612331..efea1a913 100644 --- a/microsoft.windows.ai.imaging/textrecognizer_ensurereadyasync_1335418254.md +++ b/microsoft.windows.ai.imaging/textrecognizer_ensurereadyasync_1335418254.md @@ -19,6 +19,10 @@ An asynchronous operation with progress object that returns an [AIFeatureReadyRe ## -remarks +Call [GetReadyState](textrecognizer_getreadystate_1726041729.md) before calling this method to determine whether the model needs to be installed. If the model is already ready, you can skip calling **EnsureReadyAsync** and proceed directly to [CreateAsync](textrecognizer_createasync_616540418.md). + +The progress value (a `double` between 0 and 1) indicates the download and installation progress. Check the [AIFeatureReadyResult.Status](../microsoft.windows.ai/aifeaturereadyresult_status.md) property to confirm success. + ## -see-also [Get Started with AI Text Recognition (OCR)](/windows/ai/apis/text-recognition), [Text recognizer walkthrough](/windows/ai/apis/text-recognition-tutorial) diff --git a/microsoft.windows.ai.imaging/textrecognizer_getreadystate_1726041729.md b/microsoft.windows.ai.imaging/textrecognizer_getreadystate_1726041729.md index d70b36d24..077344d61 100644 --- a/microsoft.windows.ai.imaging/textrecognizer_getreadystate_1726041729.md +++ b/microsoft.windows.ai.imaging/textrecognizer_getreadystate_1726041729.md @@ -21,6 +21,8 @@ Returns `Ready` if the underlying language model is installed. ## -remarks +Use this method to check whether the text recognition model is available on the device before calling [CreateAsync](textrecognizer_createasync_616540418.md). If the returned state is `NotReady`, call [EnsureReadyAsync](textrecognizer_ensurereadyasync_1335418254.md) to download and install the model. + ## -see-also [Get Started with AI Text Recognition (OCR)](/windows/ai/apis/text-recognition), [Text recognizer walkthrough](/windows/ai/apis/text-recognition-tutorial) diff --git a/microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimage_2145955329.md b/microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimage_2145955329.md index 9c813baf6..a393bf046 100644 --- a/microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimage_2145955329.md +++ b/microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimage_2145955329.md @@ -25,6 +25,12 @@ The result of a text recognition operation on an image. ## -remarks +Performs synchronous text recognition on the image. The image must be provided as an [ImageBuffer](/windows/windows-app-sdk/api/winrt/microsoft.graphics.imaging.imagebuffer), which you can create from a [SoftwareBitmap](/uwp/api/windows.graphics.imaging.softwarebitmap) using `ImageBuffer.CreateBufferAttachedToBitmap` (C#) or `ImageBuffer.CreateForSoftwareBitmap` (C++/WinRT). + +The returned [RecognizedText](recognizedtext.md) contains a collection of [RecognizedLine](recognizedline.md) objects. Each line provides the recognized [Text](recognizedline_text.md), individual [Words](recognizedline_words.md) with bounding boxes and confidence scores, and a [Style](recognizedline_style.md) indicator (handwritten vs. printed). + +For asynchronous processing, use [RecognizeTextFromImageAsync](textrecognizer_recognizetextfromimageasync_356575282.md) instead. + ## -see-also [Get Started with AI Text Recognition (OCR)](/windows/ai/apis/text-recognition), [Text recognizer walkthrough](/windows/ai/apis/text-recognition-tutorial) diff --git a/microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimageasync_356575282.md b/microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimageasync_356575282.md index 342e02b3b..d112d8b28 100644 --- a/microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimageasync_356575282.md +++ b/microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimageasync_356575282.md @@ -25,6 +25,8 @@ An asynchronous operation object which, when it completes, contains the result o ## -remarks +Asynchronous version of [RecognizeTextFromImage](textrecognizer_recognizetextfromimage_2145955329.md). Use this method when you want to avoid blocking the UI thread. The image must be provided as an [ImageBuffer](/windows/windows-app-sdk/api/winrt/microsoft.graphics.imaging.imagebuffer). + ## -see-also [Get Started with AI Text Recognition (OCR)](/windows/ai/apis/text-recognition), [Text recognizer walkthrough](/windows/ai/apis/text-recognition-tutorial) diff --git a/microsoft.windows.ai.text/languagemodel_close_811482585.md b/microsoft.windows.ai.text/languagemodel_close_811482585.md index 828ac9b9e..dc3722224 100644 --- a/microsoft.windows.ai.text/languagemodel_close_811482585.md +++ b/microsoft.windows.ai.text/languagemodel_close_811482585.md @@ -15,6 +15,8 @@ Closes the [LanguageModel](languagemodel.md) object. ## -remarks +In C#, use a `using` statement instead of calling this method directly. The `using` statement ensures the object is disposed even if an exception occurs. + ## -see-also ## -examples diff --git a/microsoft.windows.ai.text/languagemodel_createasync_616540418.md b/microsoft.windows.ai.text/languagemodel_createasync_616540418.md index a6bb1271a..2ef6a14a3 100644 --- a/microsoft.windows.ai.text/languagemodel_createasync_616540418.md +++ b/microsoft.windows.ai.text/languagemodel_createasync_616540418.md @@ -19,6 +19,12 @@ A language model object. ## -remarks +Call [GetReadyState](languagemodel_getreadystate_1726041729.md) before calling this method. If **GetReadyState** returns `NotReady`, call [EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md) first to download and install the model. Calling **CreateAsync** when the model is not ready will fail. + +The returned **LanguageModel** implements [IDisposable](/dotnet/api/system.idisposable). Use a `using` statement (C#) or call [Close](languagemodel_close_811482585.md) (C++/WinRT) to release model resources when you are done. + ## -see-also +[GetReadyState](languagemodel_getreadystate_1726041729.md), [EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md), [Get started with Phi Silica](/windows/ai/apis/phi-silica) + ## -examples diff --git a/microsoft.windows.ai.text/languagemodel_ensurereadyasync_1335418254.md b/microsoft.windows.ai.text/languagemodel_ensurereadyasync_1335418254.md index 4472de17e..27563a8b5 100644 --- a/microsoft.windows.ai.text/languagemodel_ensurereadyasync_1335418254.md +++ b/microsoft.windows.ai.text/languagemodel_ensurereadyasync_1335418254.md @@ -19,6 +19,14 @@ An asynchronous action with progress object that returns an [AIFeatureReadyResul ## -remarks +Call [GetReadyState](languagemodel_getreadystate_1726041729.md) before calling this method to determine whether the model needs to be installed. If the model is already ready, you can skip calling **EnsureReadyAsync** and proceed directly to [CreateAsync](languagemodel_createasync_616540418.md). + +The progress value (a `double` between 0 and 1) indicates the download and installation progress. + +Check the [AIFeatureReadyResult.Status](../microsoft.windows.ai/aifeaturereadyresult_status.md) property of the returned result to confirm that the operation completed successfully. If it did not succeed, call [AIFeatureReadyResult.ExtendedError](../microsoft.windows.ai/aifeaturereadyresult_extendederror.md) for diagnostic details. + ## -see-also +[GetReadyState](languagemodel_getreadystate_1726041729.md), [CreateAsync](languagemodel_createasync_616540418.md), [Get started with Phi Silica](/windows/ai/apis/phi-silica) + ## -examples diff --git a/microsoft.windows.ai.text/languagemodel_generateresponseasync_1153118514.md b/microsoft.windows.ai.text/languagemodel_generateresponseasync_1153118514.md index a1844296d..316e617ec 100644 --- a/microsoft.windows.ai.text/languagemodel_generateresponseasync_1153118514.md +++ b/microsoft.windows.ai.text/languagemodel_generateresponseasync_1153118514.md @@ -33,6 +33,14 @@ The response to the prompt. ## -remarks +This overload accepts a [LanguageModelContext](languagemodelcontext.md) to maintain conversation history across multiple prompts and [LanguageModelOptions](languagemodeloptions.md) to configure content moderation. The context window acts as the model's short-term memory, holding previous exchanges so the model can generate coherent multi-turn responses. + +The operation reports progress as each token is generated. You can subscribe to progress updates to display partial responses in real time. + +Check the [Status](languagemodelresponseresult_status.md) property of the returned [LanguageModelResponseResult](languagemodelresponseresult.md) to determine whether the response completed successfully. A status of `PromptLargerThanContext` indicates that the prompt exceeds the context window. Call [GetUsablePromptLength](languagemodel_getusablepromptlength_261255212.md) to trim the prompt or create a new context. + ## -see-also +[GenerateResponseAsync(String)](languagemodel_generateresponseasync_1596814667.md), [LanguageModelContext](languagemodelcontext.md), [LanguageModelOptions](languagemodeloptions.md), [LanguageModelResponseResult](languagemodelresponseresult.md), [Get started with Phi Silica](/windows/ai/apis/phi-silica) + ## -examples diff --git a/microsoft.windows.ai.text/languagemodel_generateresponseasync_1596814667.md b/microsoft.windows.ai.text/languagemodel_generateresponseasync_1596814667.md index aa24baee7..71da46a8f 100644 --- a/microsoft.windows.ai.text/languagemodel_generateresponseasync_1596814667.md +++ b/microsoft.windows.ai.text/languagemodel_generateresponseasync_1596814667.md @@ -25,6 +25,29 @@ The response to the prompt. ## -remarks +This is the simplest overload of **GenerateResponseAsync**. It sends a single prompt to the local language model and returns the complete response. + +The operation reports progress as each token is generated. You can subscribe to progress updates to display partial responses in real time, which is useful for streaming scenarios. + +Check the [Status](languagemodelresponseresult_status.md) property of the returned [LanguageModelResponseResult](languagemodelresponseresult.md) to determine whether the response completed successfully. The [Text](languagemodelresponseresult_text.md) property contains the generated response. + +To maintain conversation context across multiple prompts, use the overload that accepts a [LanguageModelContext](languagemodelcontext.md). To configure content moderation, use the overload that accepts [LanguageModelOptions](languagemodeloptions.md). + ## -see-also +[GenerateResponseAsync(LanguageModelContext, String, LanguageModelOptions)](languagemodel_generateresponseasync_1153118514.md), [GenerateResponseAsync(String, LanguageModelOptions)](languagemodel_generateresponseasync_323610015.md), [LanguageModelResponseResult](languagemodelresponseresult.md), [Get started with Phi Silica](/windows/ai/apis/phi-silica) + ## -examples + +```csharp +using LanguageModel languageModel = await LanguageModel.CreateAsync(); + +string prompt = "Provide the molecular formula for glucose."; +var result = await languageModel.GenerateResponseAsync(prompt); + +if (result.Status == LanguageModelResponseStatus.Complete) +{ + Console.WriteLine(result.Text); + // Output: C6H12O6 +} +``` diff --git a/microsoft.windows.ai.text/languagemodel_generateresponseasync_323610015.md b/microsoft.windows.ai.text/languagemodel_generateresponseasync_323610015.md index 95fb9f29b..47d237ad7 100644 --- a/microsoft.windows.ai.text/languagemodel_generateresponseasync_323610015.md +++ b/microsoft.windows.ai.text/languagemodel_generateresponseasync_323610015.md @@ -29,6 +29,12 @@ The response to the prompt. ## -remarks +This overload accepts [LanguageModelOptions](languagemodeloptions.md) to configure content moderation for a single prompt. Use this when you don't need multi-turn conversation context but want to control content filtering. + +The operation reports progress as each token is generated. Check the [Status](languagemodelresponseresult_status.md) property of the returned [LanguageModelResponseResult](languagemodelresponseresult.md) to determine whether the response completed successfully. + ## -see-also +[GenerateResponseAsync(String)](languagemodel_generateresponseasync_1596814667.md), [GenerateResponseAsync(LanguageModelContext, String, LanguageModelOptions)](languagemodel_generateresponseasync_1153118514.md), [LanguageModelOptions](languagemodeloptions.md), [Content moderation](/windows/ai/apis/content-moderation) + ## -examples diff --git a/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_1128583137.md b/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_1128583137.md index b0b393349..539b5bfd7 100644 --- a/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_1128583137.md +++ b/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_1128583137.md @@ -29,6 +29,10 @@ The response to the prompt. ## -remarks +Generates a response from pre-computed embedding vectors with [LanguageModelOptions](languagemodeloptions.md) to configure content moderation. + ## -see-also +[GenerateResponseFromEmbeddingsAsync(IIterable\)](languagemodel_generateresponsefromembeddingsasync_253779765.md), [GenerateEmbeddingVectors](languagemodel_generateembeddingvectors_1167060492.md), [LanguageModelOptions](languagemodeloptions.md) + ## -examples diff --git a/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_253779765.md b/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_253779765.md index fbb5f272b..fbf2c49ae 100644 --- a/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_253779765.md +++ b/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_253779765.md @@ -25,6 +25,12 @@ The response to the prompt. ## -remarks +Generates a response from pre-computed embedding vectors instead of a text prompt. This enables retrieval-augmented generation (RAG) scenarios where you first convert documents or passages to embeddings using [GenerateEmbeddingVectors](languagemodel_generateembeddingvectors_1167060492.md), then retrieve relevant embeddings and pass them directly to the model. + +The operation reports progress as each token is generated. + ## -see-also +[GenerateEmbeddingVectors](languagemodel_generateembeddingvectors_1167060492.md), [GenerateResponseAsync(String)](languagemodel_generateresponseasync_1596814667.md), [LanguageModelResponseResult](languagemodelresponseresult.md) + ## -examples diff --git a/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_508759908.md b/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_508759908.md index b52ff7137..df5237dd3 100644 --- a/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_508759908.md +++ b/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_508759908.md @@ -33,6 +33,10 @@ The response to the prompt. ## -remarks +Generates a response from pre-computed embedding vectors with a [LanguageModelContext](languagemodelcontext.md) for multi-turn conversation history and [LanguageModelOptions](languagemodeloptions.md) for content moderation configuration. + ## -see-also +[GenerateResponseFromEmbeddingsAsync(IIterable\)](languagemodel_generateresponsefromembeddingsasync_253779765.md), [GenerateEmbeddingVectors](languagemodel_generateembeddingvectors_1167060492.md), [LanguageModelContext](languagemodelcontext.md), [LanguageModelOptions](languagemodeloptions.md) + ## -examples diff --git a/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md b/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md index 429df32b2..beeb70498 100644 --- a/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md +++ b/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md @@ -19,6 +19,17 @@ The readiness state of the language model. ## -remarks +Use this method to check whether the language model is available on the device before calling [CreateAsync](languagemodel_createasync_616540418.md). If the returned state is `NotReady`, call [EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md) to download and install the model. + ## -see-also +[EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md), [CreateAsync](languagemodel_createasync_616540418.md), [Get started with Phi Silica](/windows/ai/apis/phi-silica) + ## -examples + +```csharp +if (LanguageModel.GetReadyState() == AIFeatureReadyState.NotReady) +{ + var op = await LanguageModel.EnsureReadyAsync(); +} +``` diff --git a/microsoft.windows.ai.text/textrewriter_rewriteasync_2021107407.md b/microsoft.windows.ai.text/textrewriter_rewriteasync_2021107407.md index a873ba179..c20ff4f71 100644 --- a/microsoft.windows.ai.text/textrewriter_rewriteasync_2021107407.md +++ b/microsoft.windows.ai.text/textrewriter_rewriteasync_2021107407.md @@ -29,6 +29,10 @@ The rewritten text in the specified tone. ## -remarks +Rewrites the text using the specified [TextRewriteTone](textrewritetone.md), which controls the style of the output (for example, professional, casual, or friendly). The rewriter corrects spelling and grammar errors, enhances word choice, and optimizes clarity and readability while preserving the original meaning. + ## -see-also +[RewriteAsync(String)](textrewriter_rewriteasync_54766249.md), [TextRewriteTone](textrewritetone.md), [LanguageModelResponseResult](languagemodelresponseresult.md) + ## -examples diff --git a/microsoft.windows.ai.text/textrewriter_rewriteasync_54766249.md b/microsoft.windows.ai.text/textrewriter_rewriteasync_54766249.md index 243d12f35..d643c95b6 100644 --- a/microsoft.windows.ai.text/textrewriter_rewriteasync_54766249.md +++ b/microsoft.windows.ai.text/textrewriter_rewriteasync_54766249.md @@ -25,6 +25,14 @@ The rewritten text in the [default](textrewritetone.md) tone. ## -remarks +Rewrites the text using the default tone. The rewriter corrects spelling and grammar errors, enhances word choice, and optimizes clarity and readability while preserving the original meaning. + +The operation reports progress as each token is generated. Check the [Status](languagemodelresponseresult_status.md) property of the returned [LanguageModelResponseResult](languagemodelresponseresult.md) and read the rewritten text from the [Text](languagemodelresponseresult_text.md) property. + +To specify a particular tone, use the [RewriteAsync(String, TextRewriteTone)](textrewriter_rewriteasync_2021107407.md) overload. + ## -see-also +[RewriteAsync(String, TextRewriteTone)](textrewriter_rewriteasync_2021107407.md), [TextRewriteTone](textrewritetone.md), [LanguageModelResponseResult](languagemodelresponseresult.md) + ## -examples diff --git a/microsoft.windows.ai.text/textrewriter_textrewriter_769658051.md b/microsoft.windows.ai.text/textrewriter_textrewriter_769658051.md index 7ba1aa51a..92b5f2df0 100644 --- a/microsoft.windows.ai.text/textrewriter_textrewriter_769658051.md +++ b/microsoft.windows.ai.text/textrewriter_textrewriter_769658051.md @@ -21,6 +21,10 @@ The local small language model. ## -remarks +The **LanguageModel** must be created and ready before passing it to this constructor. Call [LanguageModel.GetReadyState](languagemodel_getreadystate_1726041729.md), [LanguageModel.EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md), and [LanguageModel.CreateAsync](languagemodel_createasync_616540418.md) to get a ready instance. + ## -see-also +[LanguageModel](languagemodel.md), [TextRewriter](textrewriter.md) + ## -examples diff --git a/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md b/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md index e01b153bf..cb1864a30 100644 --- a/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md +++ b/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md @@ -25,6 +25,24 @@ The summarized text. ## -remarks +Returns a [LanguageModelResponseResult](languagemodelresponseresult.md) containing the summarized text. Check the [Status](languagemodelresponseresult_status.md) property to determine whether the operation completed successfully, and read the summary from the [Text](languagemodelresponseresult_text.md) property. + +The operation reports progress as each token is generated, which you can use to display partial results in real time. + +Before calling this method, you can check whether the text fits within the model's context window by calling [IsPromptLargerThanContext](textsummarizer_ispromptlargerthancontext_123976394.md). + ## -see-also +[SummarizeParagraphAsync](textsummarizer_summarizeparagraphasync_633554225.md), [SummarizeConversationAsync](textsummarizer_summarizeconversationasync_1593584223.md), [LanguageModelResponseResult](languagemodelresponseresult.md), [Get started with Phi Silica](/windows/ai/apis/phi-silica) + ## -examples + +```csharp +using LanguageModel languageModel = await LanguageModel.CreateAsync(); + +var textSummarizer = new TextSummarizer(languageModel); +string text = "This is a large amount of text I want to have summarized."; +var result = await textSummarizer.SummarizeAsync(text); + +Console.WriteLine(result.Text); +``` diff --git a/microsoft.windows.ai.text/textsummarizer_summarizeconversationasync_1593584223.md b/microsoft.windows.ai.text/textsummarizer_summarizeconversationasync_1593584223.md index 2163843dd..f301b8b00 100644 --- a/microsoft.windows.ai.text/textsummarizer_summarizeconversationasync_1593584223.md +++ b/microsoft.windows.ai.text/textsummarizer_summarizeconversationasync_1593584223.md @@ -29,6 +29,12 @@ The summarized text. ## -remarks +Summarizes a multi-turn conversation represented by a collection of [ConversationItem](conversationitem.md) objects. Each **ConversationItem** contains a [Message](conversationitem_message.md) and a [Participant](conversationitem_participant.md) name. + +Use the [ConversationSummaryOptions](conversationsummaryoptions.md) parameter to control whether the summary includes message citations, participant attribution, and to set the maximum number of key points. + ## -see-also +[SummarizeAsync](textsummarizer_summarizeasync_822055106.md), [ConversationItem](conversationitem.md), [ConversationSummaryOptions](conversationsummaryoptions.md) + ## -examples diff --git a/microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md b/microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md index e79a00595..bbe93d93e 100644 --- a/microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md +++ b/microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md @@ -25,6 +25,10 @@ The summarized text. ## -remarks +Unlike [SummarizeAsync](textsummarizer_summarizeasync_822055106.md) which returns a list of key points, this method returns the summary as a single flowing paragraph. + ## -see-also +[SummarizeAsync](textsummarizer_summarizeasync_822055106.md), [SummarizeConversationAsync](textsummarizer_summarizeconversationasync_1593584223.md) + ## -examples diff --git a/microsoft.windows.ai.text/textsummarizer_textsummarizer_769658051.md b/microsoft.windows.ai.text/textsummarizer_textsummarizer_769658051.md index bfcc3522e..14afbbad0 100644 --- a/microsoft.windows.ai.text/textsummarizer_textsummarizer_769658051.md +++ b/microsoft.windows.ai.text/textsummarizer_textsummarizer_769658051.md @@ -21,6 +21,10 @@ The local small language model. ## -remarks +The **LanguageModel** must be created and ready before passing it to this constructor. Call [LanguageModel.GetReadyState](languagemodel_getreadystate_1726041729.md), [LanguageModel.EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md), and [LanguageModel.CreateAsync](languagemodel_createasync_616540418.md) to get a ready instance. + ## -see-also +[LanguageModel](languagemodel.md), [TextSummarizer](textsummarizer.md) + ## -examples diff --git a/microsoft.windows.ai.text/texttotableconverter_convertasync_1749572750.md b/microsoft.windows.ai.text/texttotableconverter_convertasync_1749572750.md index c2e7cadda..5786aa9a5 100644 --- a/microsoft.windows.ai.text/texttotableconverter_convertasync_1749572750.md +++ b/microsoft.windows.ai.text/texttotableconverter_convertasync_1749572750.md @@ -25,6 +25,12 @@ The formatted text. ## -remarks +Returns a [TextToTableResponseResult](texttotableresponseresult.md) containing the table data. Call [GetRows](texttotableresponseresult_getrows_1751622459.md) on the result to iterate over rows, and [GetColumns](texttotablerow_getcolumns_2060251348.md) on each [TextToTableRow](texttotablerow.md) to access column values. + +Check the [Status](texttotableresponseresult_status.md) property to determine whether the conversion completed successfully. + ## -see-also +[TextToTableResponseResult](texttotableresponseresult.md), [TextToTableRow](texttotablerow.md) + ## -examples diff --git a/microsoft.windows.ai.text/texttotableconverter_texttotableconverter_769658051.md b/microsoft.windows.ai.text/texttotableconverter_texttotableconverter_769658051.md index e97bb6861..e5e07ff2c 100644 --- a/microsoft.windows.ai.text/texttotableconverter_texttotableconverter_769658051.md +++ b/microsoft.windows.ai.text/texttotableconverter_texttotableconverter_769658051.md @@ -21,6 +21,10 @@ The local small language model. ## -remarks +The **LanguageModel** must be created and ready before passing it to this constructor. Call [LanguageModel.GetReadyState](languagemodel_getreadystate_1726041729.md), [LanguageModel.EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md), and [LanguageModel.CreateAsync](languagemodel_createasync_616540418.md) to get a ready instance. + ## -see-also +[LanguageModel](languagemodel.md), [TextToTableConverter](texttotableconverter.md) + ## -examples From e0bbe41ce818cc6837e64a83f2f909ebf4c09492 Mon Sep 17 00:00:00 2001 From: John Kennedy Date: Wed, 3 Jun 2026 13:38:59 -0700 Subject: [PATCH 3/6] Fix review feedback: enum value, broken links - 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> --- microsoft.windows.ai.imaging/imageobjectremover.md | 2 +- microsoft.windows.ai.imaging/recognizedtext.md | 2 +- microsoft.windows.ai.text/languagemodel.md | 4 ++-- .../languagemodel_getreadystate_1726041729.md | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/microsoft.windows.ai.imaging/imageobjectremover.md b/microsoft.windows.ai.imaging/imageobjectremover.md index 8f88a68b2..d4991c263 100644 --- a/microsoft.windows.ai.imaging/imageobjectremover.md +++ b/microsoft.windows.ai.imaging/imageobjectremover.md @@ -19,7 +19,7 @@ Represents an object that can remove artifacts from images. Before creating an **ImageObjectRemover** instance, call [GetReadyState](imageobjectremover_getreadystate_1726041729.md) to check whether the model is available on the device. If the model is not ready, call [EnsureReadyAsync](imageobjectremover_ensurereadyasync_1335418254.md) to download and prepare it. Then call [CreateAsync](imageobjectremover_createasync_616540418.md) to create an instance. -To remove an object, you typically first use [ImageObjectExtractor](imageobjectextractor.md) to generate a mask for the object you want to remove, then pass that mask along with the source image to [RemoveFromImageBuffer](imageobjectremover_removefromimagebuffer_1878721313.md) or [RemoveFromSoftwareBitmap](imageobjectremover_removefromsoftwarebitmap_1113498764.md). +To remove an object, you typically first use [ImageObjectExtractor](imageobjectextractor.md) to generate a mask for the object you want to remove, then pass that mask along with the source image to [RemoveFromImageBuffer](imageobjectremover_removefromimagebuffer_1878721313.md) or [RemoveFromSoftwareBitmap](imageobjectremover_removefromsoftwarebitmap_1744765345.md). The **ImageObjectRemover** class implements [IDisposable](/dotnet/api/system.idisposable), so you should use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. diff --git a/microsoft.windows.ai.imaging/recognizedtext.md b/microsoft.windows.ai.imaging/recognizedtext.md index e527d6272..d418f5f5c 100644 --- a/microsoft.windows.ai.imaging/recognizedtext.md +++ b/microsoft.windows.ai.imaging/recognizedtext.md @@ -19,6 +19,6 @@ Represents the result of a text recognition operation on an image. ## -see-also -[RecognizeTextFromImage](textrecognizer_recognizetextfromimage_2145955329.md), [RecognizeTextFromImageAsync], (textrecognizer_recognizetextfromimageasync_356575282.md), [Get Started with AI Text Recognition (OCR)](/windows/ai/apis/text-recognition), [Text recognizer walkthrough](/windows/ai/apis/text-recognition-tutorial) +[RecognizeTextFromImage](textrecognizer_recognizetextfromimage_2145955329.md), [RecognizeTextFromImageAsync](textrecognizer_recognizetextfromimageasync_356575282.md), [Get Started with AI Text Recognition (OCR)](/windows/ai/apis/text-recognition), [Text recognizer walkthrough](/windows/ai/apis/text-recognition-tutorial) ## -examples diff --git a/microsoft.windows.ai.text/languagemodel.md b/microsoft.windows.ai.text/languagemodel.md index 3b4f5af31..fb8a7ed5c 100644 --- a/microsoft.windows.ai.text/languagemodel.md +++ b/microsoft.windows.ai.text/languagemodel.md @@ -38,9 +38,9 @@ The following example shows how to check model availability, create a **Language using Microsoft.Windows.AI.Text; using Microsoft.Windows.AI; -if (LanguageModel.GetReadyState() == AIFeatureReadyState.NotReady) +if (LanguageModel.GetReadyState() != AIFeatureReadyState.Ready) { - var op = await LanguageModel.EnsureReadyAsync(); + await LanguageModel.EnsureReadyAsync(); } using LanguageModel languageModel = await LanguageModel.CreateAsync(); diff --git a/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md b/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md index beeb70498..acaafcfbc 100644 --- a/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md +++ b/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md @@ -28,8 +28,8 @@ Use this method to check whether the language model is available on the device b ## -examples ```csharp -if (LanguageModel.GetReadyState() == AIFeatureReadyState.NotReady) +if (LanguageModel.GetReadyState() != AIFeatureReadyState.Ready) { - var op = await LanguageModel.EnsureReadyAsync(); + await LanguageModel.EnsureReadyAsync(); } ``` From 02f873e8dc4f9c4f8fecbb8c448caa5e5c688e10 Mon Sep 17 00:00:00 2001 From: John Kennedy Date: Wed, 3 Jun 2026 13:53:56 -0700 Subject: [PATCH 4/6] Fix accuracy issues and review feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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> --- .../imagedescriptiongenerator_createasync_616540418.md | 2 +- .../imagedescriptiongenerator_describeasync_1940073159.md | 2 +- .../imagedescriptiongenerator_getreadystate_1726041729.md | 2 +- .../imageobjectremover_createasync_616540418.md | 2 +- .../imageobjectremover_getreadystate_1726041729.md | 2 +- .../imagescaler_createasync_616540418.md | 2 +- .../imagescaler_getreadystate_1726041729.md | 2 +- .../imagescaler_maxsupportedscalefactor.md | 2 +- .../textrecognizer_createasync_616540418.md | 2 +- .../textrecognizer_ensurereadyasync_1335418254.md | 2 +- .../textrecognizer_getreadystate_1726041729.md | 2 +- .../textrecognizer_recognizetextfromimage_2145955329.md | 4 ++-- .../languagemodel_createasync_616540418.md | 2 +- .../languagemodel_generateresponseasync_1596814667.md | 2 ++ ...agemodel_generateresponsefromembeddingsasync_253779765.md | 2 +- .../languagemodel_getreadystate_1726041729.md | 5 ++++- .../textsummarizer_summarizeasync_822055106.md | 2 ++ .../textsummarizer_summarizeparagraphasync_633554225.md | 2 +- 18 files changed, 24 insertions(+), 17 deletions(-) diff --git a/microsoft.windows.ai.imaging/imagedescriptiongenerator_createasync_616540418.md b/microsoft.windows.ai.imaging/imagedescriptiongenerator_createasync_616540418.md index 944f97d07..19af65d29 100644 --- a/microsoft.windows.ai.imaging/imagedescriptiongenerator_createasync_616540418.md +++ b/microsoft.windows.ai.imaging/imagedescriptiongenerator_createasync_616540418.md @@ -19,7 +19,7 @@ An asynchronous operation object that returns an [ImageDescriptionGenerator](ima ## -remarks -Call [GetReadyState](imagedescriptiongenerator_getreadystate_1726041729.md) before calling this method. If **GetReadyState** returns `NotReady`, call [EnsureReadyAsync](imagedescriptiongenerator_ensurereadyasync_1335418254.md) first to download and install the model. +Call [GetReadyState](imagedescriptiongenerator_getreadystate_1726041729.md) before calling this method. If **GetReadyState** does not return `Ready`, call [EnsureReadyAsync](imagedescriptiongenerator_ensurereadyasync_1335418254.md) first to download and install the model. The returned **ImageDescriptionGenerator** implements [IDisposable](/dotnet/api/system.idisposable). Use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. diff --git a/microsoft.windows.ai.imaging/imagedescriptiongenerator_describeasync_1940073159.md b/microsoft.windows.ai.imaging/imagedescriptiongenerator_describeasync_1940073159.md index 67b51cd9a..8cf8f5429 100644 --- a/microsoft.windows.ai.imaging/imagedescriptiongenerator_describeasync_1940073159.md +++ b/microsoft.windows.ai.imaging/imagedescriptiongenerator_describeasync_1940073159.md @@ -35,7 +35,7 @@ An asynchronous operation with progress object which, when it completes, contain The [ImageDescriptionKind](imagedescriptionkind.md) parameter controls the format and detail level of the description. Choose `BriefDescription` for a short caption, `DetailedDescription` for more thorough coverage, `DiagramDescription` for diagrams and charts, or `AccessibleDescription` for accessibility-optimized alt text. -The [ContentFilterOptions](../microsoft.windows.ai.contentsafety/contentfilteroptions.md) parameter lets you configure the content moderation severity levels. +The [ContentFilterOptions](../microsoft.windows.ai.contentmoderation/contentfilteroptions.md) parameter lets you configure the content moderation severity levels. The returned [ImageDescriptionResult](imagedescriptionresult.md) contains the generated [Description](imagedescriptionresult_description.md) text and a [Status](imagedescriptionresult_status.md) code. diff --git a/microsoft.windows.ai.imaging/imagedescriptiongenerator_getreadystate_1726041729.md b/microsoft.windows.ai.imaging/imagedescriptiongenerator_getreadystate_1726041729.md index d0890a72e..df7065738 100644 --- a/microsoft.windows.ai.imaging/imagedescriptiongenerator_getreadystate_1726041729.md +++ b/microsoft.windows.ai.imaging/imagedescriptiongenerator_getreadystate_1726041729.md @@ -21,7 +21,7 @@ Returns `Ready` if the underlying language model is installed. ## -remarks -Use this method to check whether the image description model is available on the device before calling [CreateAsync](imagedescriptiongenerator_createasync_616540418.md). If the returned state is `NotReady`, call [EnsureReadyAsync](imagedescriptiongenerator_ensurereadyasync_1335418254.md) to download and install the model. +Use this method to check whether the image description model is available on the device before calling [CreateAsync](imagedescriptiongenerator_createasync_616540418.md). If the returned state is `EnsureNeeded`, call [EnsureReadyAsync](imagedescriptiongenerator_ensurereadyasync_1335418254.md) to download and install the model. ## -see-also diff --git a/microsoft.windows.ai.imaging/imageobjectremover_createasync_616540418.md b/microsoft.windows.ai.imaging/imageobjectremover_createasync_616540418.md index 05bae2f02..3482e7696 100644 --- a/microsoft.windows.ai.imaging/imageobjectremover_createasync_616540418.md +++ b/microsoft.windows.ai.imaging/imageobjectremover_createasync_616540418.md @@ -19,7 +19,7 @@ An asynchronous operation object that returns an [ImageObjectRemover](imageobjec ## -remarks -Call [GetReadyState](imageobjectremover_getreadystate_1726041729.md) before calling this method. If **GetReadyState** returns `NotReady`, call [EnsureReadyAsync](imageobjectremover_ensurereadyasync_1335418254.md) first to download and install the model. +Call [GetReadyState](imageobjectremover_getreadystate_1726041729.md) before calling this method. If **GetReadyState** does not return `Ready`, call [EnsureReadyAsync](imageobjectremover_ensurereadyasync_1335418254.md) first to download and install the model. The returned **ImageObjectRemover** implements [IDisposable](/dotnet/api/system.idisposable). Use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. diff --git a/microsoft.windows.ai.imaging/imageobjectremover_getreadystate_1726041729.md b/microsoft.windows.ai.imaging/imageobjectremover_getreadystate_1726041729.md index 63ae4e3d0..8b397edff 100644 --- a/microsoft.windows.ai.imaging/imageobjectremover_getreadystate_1726041729.md +++ b/microsoft.windows.ai.imaging/imageobjectremover_getreadystate_1726041729.md @@ -21,7 +21,7 @@ Returns `Ready` if the underlying language model is installed. ## -remarks -Use this method to check whether the object removal model is available on the device before calling [CreateAsync](imageobjectremover_createasync_616540418.md). If the returned state is `NotReady`, call [EnsureReadyAsync](imageobjectremover_ensurereadyasync_1335418254.md) to download and install the model. +Use this method to check whether the object removal model is available on the device before calling [CreateAsync](imageobjectremover_createasync_616540418.md). If the returned state is `EnsureNeeded`, call [EnsureReadyAsync](imageobjectremover_ensurereadyasync_1335418254.md) to download and install the model. ## -see-also diff --git a/microsoft.windows.ai.imaging/imagescaler_createasync_616540418.md b/microsoft.windows.ai.imaging/imagescaler_createasync_616540418.md index 0e1016a19..122813815 100644 --- a/microsoft.windows.ai.imaging/imagescaler_createasync_616540418.md +++ b/microsoft.windows.ai.imaging/imagescaler_createasync_616540418.md @@ -19,7 +19,7 @@ An asynchronous operation object that returns an [ImageScaler](imagescaler.md) o ## -remarks -Call [GetReadyState](imagescaler_getreadystate_1726041729.md) before calling this method. If **GetReadyState** returns `NotReady`, call [EnsureReadyAsync](imagescaler_ensurereadyasync_1335418254.md) first to download and install the model. +Call [GetReadyState](imagescaler_getreadystate_1726041729.md) before calling this method. If **GetReadyState** does not return `Ready`, call [EnsureReadyAsync](imagescaler_ensurereadyasync_1335418254.md) first to download and install the model. The returned **ImageScaler** implements [IDisposable](/dotnet/api/system.idisposable). Use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. diff --git a/microsoft.windows.ai.imaging/imagescaler_getreadystate_1726041729.md b/microsoft.windows.ai.imaging/imagescaler_getreadystate_1726041729.md index 3d17a5f25..7cfee359b 100644 --- a/microsoft.windows.ai.imaging/imagescaler_getreadystate_1726041729.md +++ b/microsoft.windows.ai.imaging/imagescaler_getreadystate_1726041729.md @@ -21,7 +21,7 @@ Returns `Ready` if the underlying language model is installed. ## -remarks -Use this method to check whether the image scaling model is available on the device before calling [CreateAsync](imagescaler_createasync_616540418.md). If the returned state is `NotReady`, call [EnsureReadyAsync](imagescaler_ensurereadyasync_1335418254.md) to download and install the model. +Use this method to check whether the image scaling model is available on the device before calling [CreateAsync](imagescaler_createasync_616540418.md). If the returned state is `EnsureNeeded`, call [EnsureReadyAsync](imagescaler_ensurereadyasync_1335418254.md) to download and install the model. ## -see-also diff --git a/microsoft.windows.ai.imaging/imagescaler_maxsupportedscalefactor.md b/microsoft.windows.ai.imaging/imagescaler_maxsupportedscalefactor.md index 8fa3377db..9e2a3f9a0 100644 --- a/microsoft.windows.ai.imaging/imagescaler_maxsupportedscalefactor.md +++ b/microsoft.windows.ai.imaging/imagescaler_maxsupportedscalefactor.md @@ -19,7 +19,7 @@ The maximum scale factor supported by the [ImageScaler](imagescaler.md). ## -remarks -The maximum scale factor depends on the device hardware and model capabilities. The Image Super Resolution feature supports scaling up to 8× on supported devices. Always check this property before requesting a specific scale factor to avoid errors. +The maximum scale factor depends on the device hardware and model capabilities. Always check this property before requesting a specific scale factor to avoid errors. ## -see-also diff --git a/microsoft.windows.ai.imaging/textrecognizer_createasync_616540418.md b/microsoft.windows.ai.imaging/textrecognizer_createasync_616540418.md index 1e7225e89..966ee1052 100644 --- a/microsoft.windows.ai.imaging/textrecognizer_createasync_616540418.md +++ b/microsoft.windows.ai.imaging/textrecognizer_createasync_616540418.md @@ -19,7 +19,7 @@ An asynchronous operation object that returns a [TextRecognizer](textrecognizer. ## -remarks -Call [GetReadyState](textrecognizer_getreadystate_1726041729.md) before calling this method. If **GetReadyState** returns `NotReady`, call [EnsureReadyAsync](textrecognizer_ensurereadyasync_1335418254.md) first to download and install the model. +Call [GetReadyState](textrecognizer_getreadystate_1726041729.md) before calling this method. If **GetReadyState** does not return `Ready`, call [EnsureReadyAsync](textrecognizer_ensurereadyasync_1335418254.md) first to download and install the model. The returned **TextRecognizer** implements [IDisposable](/dotnet/api/system.idisposable). Use a `using` statement (C#) or call **Close** (C++/WinRT) to release resources when you are done. diff --git a/microsoft.windows.ai.imaging/textrecognizer_ensurereadyasync_1335418254.md b/microsoft.windows.ai.imaging/textrecognizer_ensurereadyasync_1335418254.md index efea1a913..4c807cb10 100644 --- a/microsoft.windows.ai.imaging/textrecognizer_ensurereadyasync_1335418254.md +++ b/microsoft.windows.ai.imaging/textrecognizer_ensurereadyasync_1335418254.md @@ -21,7 +21,7 @@ An asynchronous operation with progress object that returns an [AIFeatureReadyRe Call [GetReadyState](textrecognizer_getreadystate_1726041729.md) before calling this method to determine whether the model needs to be installed. If the model is already ready, you can skip calling **EnsureReadyAsync** and proceed directly to [CreateAsync](textrecognizer_createasync_616540418.md). -The progress value (a `double` between 0 and 1) indicates the download and installation progress. Check the [AIFeatureReadyResult.Status](../microsoft.windows.ai/aifeaturereadyresult_status.md) property to confirm success. +The progress value (a `double`) indicates the download and installation progress. Check the [AIFeatureReadyResult.Status](../microsoft.windows.ai/aifeaturereadyresult_status.md) property to confirm success. ## -see-also diff --git a/microsoft.windows.ai.imaging/textrecognizer_getreadystate_1726041729.md b/microsoft.windows.ai.imaging/textrecognizer_getreadystate_1726041729.md index 077344d61..e2c35229f 100644 --- a/microsoft.windows.ai.imaging/textrecognizer_getreadystate_1726041729.md +++ b/microsoft.windows.ai.imaging/textrecognizer_getreadystate_1726041729.md @@ -21,7 +21,7 @@ Returns `Ready` if the underlying language model is installed. ## -remarks -Use this method to check whether the text recognition model is available on the device before calling [CreateAsync](textrecognizer_createasync_616540418.md). If the returned state is `NotReady`, call [EnsureReadyAsync](textrecognizer_ensurereadyasync_1335418254.md) to download and install the model. +Use this method to check whether the text recognition model is available on the device before calling [CreateAsync](textrecognizer_createasync_616540418.md). If the returned state is `EnsureNeeded`, call [EnsureReadyAsync](textrecognizer_ensurereadyasync_1335418254.md) to download and install the model. ## -see-also diff --git a/microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimage_2145955329.md b/microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimage_2145955329.md index a393bf046..eabfb98c6 100644 --- a/microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimage_2145955329.md +++ b/microsoft.windows.ai.imaging/textrecognizer_recognizetextfromimage_2145955329.md @@ -25,9 +25,9 @@ The result of a text recognition operation on an image. ## -remarks -Performs synchronous text recognition on the image. The image must be provided as an [ImageBuffer](/windows/windows-app-sdk/api/winrt/microsoft.graphics.imaging.imagebuffer), which you can create from a [SoftwareBitmap](/uwp/api/windows.graphics.imaging.softwarebitmap) using `ImageBuffer.CreateBufferAttachedToBitmap` (C#) or `ImageBuffer.CreateForSoftwareBitmap` (C++/WinRT). +Performs synchronous text recognition on the image. The image must be provided as an [ImageBuffer](/windows/windows-app-sdk/api/winrt/microsoft.graphics.imaging.imagebuffer), which you can create from a [SoftwareBitmap](/uwp/api/windows.graphics.imaging.softwarebitmap) using `ImageBuffer.CreateBufferAttachedToBitmap` or `ImageBuffer.CreateCopyFromBitmap`. -The returned [RecognizedText](recognizedtext.md) contains a collection of [RecognizedLine](recognizedline.md) objects. Each line provides the recognized [Text](recognizedline_text.md), individual [Words](recognizedline_words.md) with bounding boxes and confidence scores, and a [Style](recognizedline_style.md) indicator (handwritten vs. printed). +The returned [RecognizedText](recognizedtext.md) contains a collection of [RecognizedLine](recognizedline.md) objects. Each line provides the recognized [Text](recognizedline_text.md), individual [Words](recognizedline_words.md) with bounding boxes and confidence scores, and a [Style](recognizedline_style.md) indicator. For asynchronous processing, use [RecognizeTextFromImageAsync](textrecognizer_recognizetextfromimageasync_356575282.md) instead. diff --git a/microsoft.windows.ai.text/languagemodel_createasync_616540418.md b/microsoft.windows.ai.text/languagemodel_createasync_616540418.md index 2ef6a14a3..41dac64e1 100644 --- a/microsoft.windows.ai.text/languagemodel_createasync_616540418.md +++ b/microsoft.windows.ai.text/languagemodel_createasync_616540418.md @@ -19,7 +19,7 @@ A language model object. ## -remarks -Call [GetReadyState](languagemodel_getreadystate_1726041729.md) before calling this method. If **GetReadyState** returns `NotReady`, call [EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md) first to download and install the model. Calling **CreateAsync** when the model is not ready will fail. +Call [GetReadyState](languagemodel_getreadystate_1726041729.md) before calling this method. If **GetReadyState** does not return `Ready`, call [EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md) first to download and install the model. The returned **LanguageModel** implements [IDisposable](/dotnet/api/system.idisposable). Use a `using` statement (C#) or call [Close](languagemodel_close_811482585.md) (C++/WinRT) to release model resources when you are done. diff --git a/microsoft.windows.ai.text/languagemodel_generateresponseasync_1596814667.md b/microsoft.windows.ai.text/languagemodel_generateresponseasync_1596814667.md index 71da46a8f..d929d34b3 100644 --- a/microsoft.windows.ai.text/languagemodel_generateresponseasync_1596814667.md +++ b/microsoft.windows.ai.text/languagemodel_generateresponseasync_1596814667.md @@ -40,6 +40,8 @@ To maintain conversation context across multiple prompts, use the overload that ## -examples ```csharp +using Microsoft.Windows.AI.Text; + using LanguageModel languageModel = await LanguageModel.CreateAsync(); string prompt = "Provide the molecular formula for glucose."; diff --git a/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_253779765.md b/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_253779765.md index fbf2c49ae..cec9d7929 100644 --- a/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_253779765.md +++ b/microsoft.windows.ai.text/languagemodel_generateresponsefromembeddingsasync_253779765.md @@ -25,7 +25,7 @@ The response to the prompt. ## -remarks -Generates a response from pre-computed embedding vectors instead of a text prompt. This enables retrieval-augmented generation (RAG) scenarios where you first convert documents or passages to embeddings using [GenerateEmbeddingVectors](languagemodel_generateembeddingvectors_1167060492.md), then retrieve relevant embeddings and pass them directly to the model. +Generates a response from pre-computed embedding vectors instead of a text prompt. Use [GenerateEmbeddingVectors](languagemodel_generateembeddingvectors_1167060492.md) to convert text to embeddings, then pass the relevant embeddings to this method. The operation reports progress as each token is generated. diff --git a/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md b/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md index acaafcfbc..ddaa49a76 100644 --- a/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md +++ b/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md @@ -19,7 +19,7 @@ The readiness state of the language model. ## -remarks -Use this method to check whether the language model is available on the device before calling [CreateAsync](languagemodel_createasync_616540418.md). If the returned state is `NotReady`, call [EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md) to download and install the model. +Use this method to check whether the language model is available on the device before calling [CreateAsync](languagemodel_createasync_616540418.md). If the returned state is `EnsureNeeded`, call [EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md) to download and install the model. Other non-ready states include `NotSupportedOnCurrentSystem` and `DisabledByUser`. ## -see-also @@ -28,6 +28,9 @@ Use this method to check whether the language model is available on the device b ## -examples ```csharp +using Microsoft.Windows.AI; +using Microsoft.Windows.AI.Text; + if (LanguageModel.GetReadyState() != AIFeatureReadyState.Ready) { await LanguageModel.EnsureReadyAsync(); diff --git a/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md b/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md index cb1864a30..c7e0d119f 100644 --- a/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md +++ b/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md @@ -38,6 +38,8 @@ Before calling this method, you can check whether the text fits within the model ## -examples ```csharp +using Microsoft.Windows.AI.Text; + using LanguageModel languageModel = await LanguageModel.CreateAsync(); var textSummarizer = new TextSummarizer(languageModel); diff --git a/microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md b/microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md index bbe93d93e..fb8280b83 100644 --- a/microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md +++ b/microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md @@ -25,7 +25,7 @@ The summarized text. ## -remarks -Unlike [SummarizeAsync](textsummarizer_summarizeasync_822055106.md) which returns a list of key points, this method returns the summary as a single flowing paragraph. +This method returns the summary as a single flowing paragraph, whereas [SummarizeAsync](textsummarizer_summarizeasync_822055106.md) may format the output as key points. ## -see-also From e9980424b9c3ccc80d59442b54f0eb9f1b55b0b3 Mon Sep 17 00:00:00 2001 From: John Kennedy Date: Wed, 3 Jun 2026 14:24:27 -0700 Subject: [PATCH 5/6] Fix typos, add status checks, handle non-recoverable states MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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> --- microsoft.windows.ai.text/languagemodel.md | 10 ++++++++-- .../languagemodel_getreadystate_1726041729.md | 8 +++++++- microsoft.windows.ai.text/textrewriter.md | 2 +- microsoft.windows.ai.text/textsummarizer.md | 7 +++++-- .../textsummarizer_summarizeasync_822055106.md | 5 ++++- microsoft.windows.ai.text/texttotableconverter.md | 2 +- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/microsoft.windows.ai.text/languagemodel.md b/microsoft.windows.ai.text/languagemodel.md index fb8a7ed5c..9030f628c 100644 --- a/microsoft.windows.ai.text/languagemodel.md +++ b/microsoft.windows.ai.text/languagemodel.md @@ -38,10 +38,16 @@ The following example shows how to check model availability, create a **Language using Microsoft.Windows.AI.Text; using Microsoft.Windows.AI; -if (LanguageModel.GetReadyState() != AIFeatureReadyState.Ready) +var readyState = LanguageModel.GetReadyState(); +if (readyState == AIFeatureReadyState.EnsureNeeded) { await LanguageModel.EnsureReadyAsync(); -} +} +else if (readyState != AIFeatureReadyState.Ready) +{ + // NotSupportedOnCurrentSystem or DisabledByUser — cannot proceed + return; +} using LanguageModel languageModel = await LanguageModel.CreateAsync(); diff --git a/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md b/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md index ddaa49a76..25a3d6b7c 100644 --- a/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md +++ b/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md @@ -31,8 +31,14 @@ Use this method to check whether the language model is available on the device b using Microsoft.Windows.AI; using Microsoft.Windows.AI.Text; -if (LanguageModel.GetReadyState() != AIFeatureReadyState.Ready) +var readyState = LanguageModel.GetReadyState(); +if (readyState == AIFeatureReadyState.EnsureNeeded) { await LanguageModel.EnsureReadyAsync(); } +else if (readyState != AIFeatureReadyState.Ready) +{ + // NotSupportedOnCurrentSystem or DisabledByUser — cannot proceed + return; +} ``` diff --git a/microsoft.windows.ai.text/textrewriter.md b/microsoft.windows.ai.text/textrewriter.md index f4ede8717..da0b5eeb2 100644 --- a/microsoft.windows.ai.text/textrewriter.md +++ b/microsoft.windows.ai.text/textrewriter.md @@ -11,7 +11,7 @@ public sealed class TextRewriter ## -description -Represents a specialized lanugage model capable of rewriting text input. +Represents a specialized language model capable of rewriting text input. ## -remarks diff --git a/microsoft.windows.ai.text/textsummarizer.md b/microsoft.windows.ai.text/textsummarizer.md index c1262af77..dda8ac4c1 100644 --- a/microsoft.windows.ai.text/textsummarizer.md +++ b/microsoft.windows.ai.text/textsummarizer.md @@ -11,7 +11,7 @@ public sealed class TextSummarizer ## -description -Represents a specialized lanugage model capable of summarizing text input. +Represents a specialized language model capable of summarizing text input. ## -remarks @@ -45,5 +45,8 @@ var textSummarizer = new TextSummarizer(languageModel); string text = "This is a large amount of text I want to have summarized."; var result = await textSummarizer.SummarizeAsync(text); -Console.WriteLine(result.Text); +if (result.Status == LanguageModelResponseStatus.Complete) +{ + Console.WriteLine(result.Text); +} ``` diff --git a/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md b/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md index c7e0d119f..25c87ac84 100644 --- a/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md +++ b/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md @@ -46,5 +46,8 @@ var textSummarizer = new TextSummarizer(languageModel); string text = "This is a large amount of text I want to have summarized."; var result = await textSummarizer.SummarizeAsync(text); -Console.WriteLine(result.Text); +if (result.Status == LanguageModelResponseStatus.Complete) +{ + Console.WriteLine(result.Text); +} ``` diff --git a/microsoft.windows.ai.text/texttotableconverter.md b/microsoft.windows.ai.text/texttotableconverter.md index 159aebe7b..897d24a23 100644 --- a/microsoft.windows.ai.text/texttotableconverter.md +++ b/microsoft.windows.ai.text/texttotableconverter.md @@ -11,7 +11,7 @@ public sealed class TextToTableConverter ## -description -Represents a specialized lanugage model capable of formatting text input into a table. +Represents a specialized language model capable of formatting text input into a table. ## -remarks From 048336d8103f78b0b6d1db2594e8381180adab4d Mon Sep 17 00:00:00 2001 From: John Kennedy Date: Wed, 3 Jun 2026 14:40:25 -0700 Subject: [PATCH 6/6] Remove unverifiable claims flagged by reviewer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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> --- microsoft.windows.ai.imaging/imagescaler.md | 2 +- microsoft.windows.ai.imaging/recognizedline.md | 2 +- microsoft.windows.ai.text/languagemodel.md | 6 ++++-- .../languagemodel_ensurereadyasync_1335418254.md | 2 +- .../textsummarizer_summarizeparagraphasync_633554225.md | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/microsoft.windows.ai.imaging/imagescaler.md b/microsoft.windows.ai.imaging/imagescaler.md index e867a8689..b44a293ae 100644 --- a/microsoft.windows.ai.imaging/imagescaler.md +++ b/microsoft.windows.ai.imaging/imagescaler.md @@ -15,7 +15,7 @@ Represents an object that can resize an image and increase or decrease its resol ## -remarks -**ImageScaler** uses AI-powered Image Super Resolution to scale and sharpen images up to 8× their original size while maintaining quality. The model runs on the device's NPU for hardware-accelerated performance. +**ImageScaler** uses AI-powered Image Super Resolution to scale and sharpen images while maintaining quality. The model runs on the device's NPU for hardware-accelerated performance. Call [MaxSupportedScaleFactor](imagescaler_maxsupportedscalefactor.md) to determine the maximum scale factor available on the current device. Before creating an **ImageScaler** instance, call [GetReadyState](imagescaler_getreadystate_1726041729.md) to check whether the model is available on the device. If the model is not ready, call [EnsureReadyAsync](imagescaler_ensurereadyasync_1335418254.md) to download and prepare it. Then call [CreateAsync](imagescaler_createasync_616540418.md) to create an instance. diff --git a/microsoft.windows.ai.imaging/recognizedline.md b/microsoft.windows.ai.imaging/recognizedline.md index dc1e4f6cc..8f6166ff2 100644 --- a/microsoft.windows.ai.imaging/recognizedline.md +++ b/microsoft.windows.ai.imaging/recognizedline.md @@ -15,7 +15,7 @@ Represents a single line of text in an image detected by text recognition. ## -remarks -A **RecognizedLine** represents a single line of text detected within an image by the [TextRecognizer](textrecognizer.md). Access the [Text](recognizedline_text.md) property to get the full text of the line, the [Words](recognizedline_words.md) property to iterate over individual [RecognizedWord](recognizedword.md) objects, and the [Style](recognizedline_style.md) property to determine whether the text appears handwritten or printed (with a confidence level from [LineStyleConfidence](recognizedline_linestyleconfidence.md)). +A **RecognizedLine** represents a single line of text detected within an image by the [TextRecognizer](textrecognizer.md). Access the [Text](recognizedline_text.md) property to get the full text of the line, the [Words](recognizedline_words.md) property to iterate over individual [RecognizedWord](recognizedword.md) objects, and the [Style](recognizedline_style.md) property to check whether the text appears handwritten (with a confidence level from [LineStyleConfidence](recognizedline_linestyleconfidence.md)). ## -see-also diff --git a/microsoft.windows.ai.text/languagemodel.md b/microsoft.windows.ai.text/languagemodel.md index 9030f628c..276047504 100644 --- a/microsoft.windows.ai.text/languagemodel.md +++ b/microsoft.windows.ai.text/languagemodel.md @@ -54,6 +54,8 @@ using LanguageModel languageModel = await LanguageModel.CreateAsync(); string prompt = "Provide the molecular formula for glucose."; var result = await languageModel.GenerateResponseAsync(prompt); -Console.WriteLine(result.Text); -// Output: C6H12O6 +if (result.Status == LanguageModelResponseStatus.Complete) +{ + Console.WriteLine(result.Text); +} ``` diff --git a/microsoft.windows.ai.text/languagemodel_ensurereadyasync_1335418254.md b/microsoft.windows.ai.text/languagemodel_ensurereadyasync_1335418254.md index 27563a8b5..d19650689 100644 --- a/microsoft.windows.ai.text/languagemodel_ensurereadyasync_1335418254.md +++ b/microsoft.windows.ai.text/languagemodel_ensurereadyasync_1335418254.md @@ -21,7 +21,7 @@ An asynchronous action with progress object that returns an [AIFeatureReadyResul Call [GetReadyState](languagemodel_getreadystate_1726041729.md) before calling this method to determine whether the model needs to be installed. If the model is already ready, you can skip calling **EnsureReadyAsync** and proceed directly to [CreateAsync](languagemodel_createasync_616540418.md). -The progress value (a `double` between 0 and 1) indicates the download and installation progress. +The progress callback reports a `double` value indicating download and installation progress. Check the [AIFeatureReadyResult.Status](../microsoft.windows.ai/aifeaturereadyresult_status.md) property of the returned result to confirm that the operation completed successfully. If it did not succeed, call [AIFeatureReadyResult.ExtendedError](../microsoft.windows.ai/aifeaturereadyresult_extendederror.md) for diagnostic details. diff --git a/microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md b/microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md index fb8280b83..949a51a2c 100644 --- a/microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md +++ b/microsoft.windows.ai.text/textsummarizer_summarizeparagraphasync_633554225.md @@ -25,7 +25,7 @@ The summarized text. ## -remarks -This method returns the summary as a single flowing paragraph, whereas [SummarizeAsync](textsummarizer_summarizeasync_822055106.md) may format the output as key points. +This method returns the summary as a single flowing paragraph. For other summarization approaches, see [SummarizeAsync](textsummarizer_summarizeasync_822055106.md) and [SummarizeConversationAsync](textsummarizer_summarizeconversationasync_1593584223.md). ## -see-also