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/imagedescriptiongenerator_createasync_616540418.md b/microsoft.windows.ai.imaging/imagedescriptiongenerator_createasync_616540418.md index 33c27d074..19af65d29 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** 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. + ## -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..8cf8f5429 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.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. + ## -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..df7065738 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 `EnsureNeeded`, 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/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..d4991c263 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_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. + ## -see-also [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..3482e7696 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** 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. + ## -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..8b397edff 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 `EnsureNeeded`, 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.md b/microsoft.windows.ai.imaging/imagescaler.md index d2e74b65b..b44a293ae 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 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. + +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/imagescaler_createasync_616540418.md b/microsoft.windows.ai.imaging/imagescaler_createasync_616540418.md index 0108d61dd..122813815 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** 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. + ## -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..7cfee359b 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 `EnsureNeeded`, 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..9e2a3f9a0 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. 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/recognizedline.md b/microsoft.windows.ai.imaging/recognizedline.md index 783d40a5c..8f6166ff2 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 check whether the text appears handwritten (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..d418f5f5c 100644 --- a/microsoft.windows.ai.imaging/recognizedtext.md +++ b/microsoft.windows.ai.imaging/recognizedtext.md @@ -15,8 +15,10 @@ 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) +[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.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.imaging/textrecognizer_createasync_616540418.md b/microsoft.windows.ai.imaging/textrecognizer_createasync_616540418.md index 96907a245..966ee1052 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** 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. + ## -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..4c807cb10 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`) 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..e2c35229f 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 `EnsureNeeded`, 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..eabfb98c6 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` 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. + +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/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..276047504 100644 --- a/microsoft.windows.ai.text/languagemodel.md +++ b/microsoft.windows.ai.text/languagemodel.md @@ -15,6 +15,47 @@ 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; + +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(); + +string prompt = "Provide the molecular formula for glucose."; +var result = await languageModel.GenerateResponseAsync(prompt); + +if (result.Status == LanguageModelResponseStatus.Complete) +{ + Console.WriteLine(result.Text); +} +``` 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..41dac64e1 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** 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. + ## -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..d19650689 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 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. + ## -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..d929d34b3 100644 --- a/microsoft.windows.ai.text/languagemodel_generateresponseasync_1596814667.md +++ b/microsoft.windows.ai.text/languagemodel_generateresponseasync_1596814667.md @@ -25,6 +25,31 @@ 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 Microsoft.Windows.AI.Text; + +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..cec9d7929 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. 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. + ## -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..25a3d6b7c 100644 --- a/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md +++ b/microsoft.windows.ai.text/languagemodel_getreadystate_1726041729.md @@ -19,6 +19,26 @@ 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 `EnsureNeeded`, call [EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md) to download and install the model. Other non-ready states include `NotSupportedOnCurrentSystem` and `DisabledByUser`. + ## -see-also +[EnsureReadyAsync](languagemodel_ensurereadyasync_1335418254.md), [CreateAsync](languagemodel_createasync_616540418.md), [Get started with Phi Silica](/windows/ai/apis/phi-silica) + ## -examples + +```csharp +using Microsoft.Windows.AI; +using Microsoft.Windows.AI.Text; + +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/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..da0b5eeb2 100644 --- a/microsoft.windows.ai.text/textrewriter.md +++ b/microsoft.windows.ai.text/textrewriter.md @@ -11,12 +11,21 @@ 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 -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/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.md b/microsoft.windows.ai.text/textsummarizer.md index 62d39421d..dda8ac4c1 100644 --- a/microsoft.windows.ai.text/textsummarizer.md +++ b/microsoft.windows.ai.text/textsummarizer.md @@ -11,10 +11,42 @@ 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 +**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); + +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 e01b153bf..25c87ac84 100644 --- a/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md +++ b/microsoft.windows.ai.text/textsummarizer_summarizeasync_822055106.md @@ -25,6 +25,29 @@ 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 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); + +if (result.Status == LanguageModelResponseStatus.Complete) +{ + 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..949a51a2c 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 +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 +[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.md b/microsoft.windows.ai.text/texttotableconverter.md index 576ee56d2..897d24a23 100644 --- a/microsoft.windows.ai.text/texttotableconverter.md +++ b/microsoft.windows.ai.text/texttotableconverter.md @@ -11,10 +11,19 @@ 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 +**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 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