Skip to content

Commit 3dc7786

Browse files
Merge pull request #1142 from MicrosoftDocs/main
Auto Publish – main to live - 2026-03-17 19:00 UTC
2 parents 16131c8 + 26fecf2 commit 3dc7786

8 files changed

Lines changed: 435 additions & 26 deletions

docs/TOC.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ items:
1313
items:
1414
- name: Overview
1515
href: ./apis/phi-silica.md
16-
- name: Tutorial
16+
- name: Tutorial (MAUI)
1717
href: ./apis/phi-silica-tutorial.md
18+
- name: Tutorial (WinUI 3)
19+
href: ./apis/phi-silica-winui-tutorial.md
1820
- name: LoRA fine-tuning
1921
href: ./apis/phi-silica-lora.md
2022
- name: Image Description

docs/apis/phi-silica-tutorial.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: Get Started with a Phi Silica Walkthrough
3-
description: Learn about the new Artificial Intelligence (AI) Phi Silica features and walk through tutorials
4-
ms.topic: get-started
5-
ms.date: 11/17/2025
2+
title: "Tutorial: Build a chat app with Phi Silica and .NET MAUI"
3+
description: Step-by-step guide to building a .NET MAUI app that uses the Phi Silica on-device language model for text generation and summarization.
4+
ms.topic: tutorial
5+
ms.date: 03/17/2026
66
dev_langs:
77
- csharp
88
- cpp
99
---
1010

11-
# Phi Silica walkthrough
11+
# Tutorial: Build a chat app with Phi Silica and .NET MAUI
1212

1313
> [!IMPORTANT]
1414
> The Phi Silica APIs are part of a Limited Access Feature (see [LimitedAccessFeatures class](/uwp/api/windows.applicationmodel.limitedaccessfeatures)). For more information or to request an unlock token, please use the [LAF Access Token Request Form](https://go.microsoft.com/fwlink/?linkid=2271232&c1cid=04x409).
@@ -20,7 +20,13 @@ This short tutorial walks through the [Windows AI API sample for .NET MAUI](http
2020
2121
## Prerequisites
2222

23-
Complete the steps for .NET MAUI described in the [Get started building an app with Windows AI APIs](get-started.md).
23+
- **Copilot+ PC** with NPU — required for Phi Silica. See the [Copilot+ PCs developer guide](../npu-devices/index.md).
24+
- **Windows 11 build 26100 or later** (25H2) — check with `winver`.
25+
- **Developer Mode** enabled — Windows Settings → System → For developers → Developer Mode.
26+
- **Visual Studio 2022** with the **Windows application development** workload.
27+
- **Windows App SDK 2.0.0-preview1** — install via NuGet (`Microsoft.WindowsAppSDK` version `2.0.0-preview1`).
28+
29+
Complete the platform-specific steps for .NET MAUI described in the [Get started building an app with Windows AI APIs](get-started.md).
2430

2531
## Introduction
2632

@@ -41,40 +47,38 @@ In the second file listed above, you'll find the following function, which demon
4147

4248
```csharp
4349
using Microsoft.Windows.AI;
50+
using Microsoft.Windows.AI.Text;
4451

4552
using LanguageModel languageModel = await LanguageModel.CreateAsync();
4653

47-
string prompt = "This is a large amount of text I want to have summarized.";
48-
49-
LanguageModelOptions options = new LanguageModelOptions {
50-
Skill = LanguageModelSkill.Summarize
51-
};
54+
string inputText = "This is a large amount of text I want to have summarized.";
55+
string prompt = $"Summarize the following text concisely:\n\n{inputText}";
5256

53-
var result = await languageModel.GenerateResponseAsync(options, prompt);
57+
var result = await languageModel.GenerateResponseAsync(prompt);
5458

5559
Console.WriteLine(result.Text);
5660
```
5761

5862
```cppwinrt
59-
using namespace winrt::Microsoft::Windows::AI::Generative;
63+
using namespace winrt::Microsoft::Windows::AI::Text;
6064
6165
auto languageModel = LanguageModel::CreateAsync().get();
6266
63-
std::string prompt = "This is a large amount of text I want to have summarized.";
64-
65-
LanguageModelOptions options = LanguageModelOptions();
66-
options.Skill = LanguageModelSkill.Summarize;
67+
std::wstring inputText = L"This is a large amount of text I want to have summarized.";
68+
std::wstring prompt = L"Summarize the following text concisely:\n\n" + inputText;
6769
68-
auto result = languageModel.GenerateResponseAsync(options, prompt).get();
70+
auto result = languageModel.GenerateResponseAsync(prompt).get();
6971
70-
std::cout << result.Text() << std::endl;
72+
std::wcout << result.Text() << std::endl;
7173
```
7274

75+
> [!NOTE]
76+
> The `LanguageModelSkill` enum (`Summarize`, `Rewrite`) is not available in Windows App SDK 2.0 preview. The examples above use prompt engineering — prepending an instruction to the input text — to achieve the same result. When the Skill API is released, you can replace the prompt construction with `new LanguageModelOptions { Skill = LanguageModelSkill.Summarize }`.
77+
7378
## Build and run the sample
7479

7580
1. Clone the [WindowsAppSDK-Samples](https://github.com/microsoft/WindowsAppSDK-Samples) repo.
76-
1. Switch to the "release/experimental" branch.
77-
1. Navigate to the [Samples/WindowsAIFoundry/cs-maui](https://github.com/microsoft/WindowsAppSDK-Samples/tree/release/experimental/Samples/WindowsAIFoundry/cs-maui) folder.
81+
1. Navigate to the [Samples/WindowsAIFoundry/cs-maui](https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/WindowsAIFoundry/cs-maui) folder.
7882
1. Open MauiWindowsAISample.sln in Visual Studio 2022.
7983
1. Ensure the debug toolbar has "Windows Machine" set as the target device.
8084
1. Press F5 or select "Start Debugging" from the Debug menu to run the sample (the sample can also be run without debugging by selecting "Start Without Debugging" from the Debug menu or Ctrl+F5).

0 commit comments

Comments
 (0)