[AI] Windows Copilot Runtime (Phi Silica) support for Essentials.AI#33605
Draft
mattleibow wants to merge 18 commits intomainfrom
Draft
[AI] Windows Copilot Runtime (Phi Silica) support for Essentials.AI#33605mattleibow wants to merge 18 commits intomainfrom
mattleibow wants to merge 18 commits intomainfrom
Conversation
04c4caa to
7e57668
Compare
f884a51 to
fbd619c
Compare
0efd5f5 to
583fb81
Compare
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 33605Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 33605" |
5 tasks
- New LandmarkDetailPage with AI travel tips, similar destinations, tags - Semantic search bar on LandmarksPage with debounced filtering - ISemanticSearchService abstraction with EmbeddingSearchService and AppContentIndexerSearchService - Refactored DataService to use ISemanticSearchService instead of IEmbeddingGenerator - TaggingService switched to plaintext comma-separated parsing - TravelPlannerExecutor uses prompt-based JSON instead of structured output - TripPlanningPage auto-starts itinerary generation (no initial state) - Merged LandmarkTripView into TripPlanningPage, deleted unused views - Removed NonFunctionInvokingChatClient reference - Language picker moved to LandmarkDetailPage Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix navigation crash: add missing Gray700 color to Colors.xaml - Fix gradient overlays: remove broken BoxView global style, use transparent-white gradients - Replace SearchBar with borderless Entry, remove native border/focus ring on MacCatalyst - Edge-to-edge horizontal scrollers with aligned padding - Scrolling gradient + solid background pattern on detail and trip planning pages - Safe area: use SafeAreaEdges=None on root Grids, Container on back buttons - Debounced search with Timer instead of per-keystroke async work - Use IDispatcher instead of MainThread.BeginInvokeOnMainThread - Only-once AI initialization on LandmarkDetailPage - Migrate BackgroundColor to Background across pages and views - Fix null dereference warnings in DataService Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… Bunaken landmark - PromptBasedSchemaClient middleware for prompt-based structured output - Fixed chat bubble alignment and scroll-to-end on Windows - Removed LanguagePreferenceService — language passed via navigation - Added Temperature for creative agents (0.8) and travel tips (0.9) - Fixed WeatherService locale issue (InvariantCulture) - Added weather display to LandmarkDetailPage - Map placeholder on Windows (OnPlatform) - TravelPlanResult uses short JsonPropertyName for SLM reliability - StreamingResponseHandler passthrough mode + 7 unit tests - Added Bunaken Marine Park (Manado, Indonesia) landmark - Fixed agent instruction examples Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tenatedText) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f7c5eff to
27b87c9
Compare
PromptBasedSchemaClient reads DisplayName for prompt-based JSON schema generation, which works across all platforms including Phi Silica. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
27b87c9 to
2c34359
Compare
DisplayName does not work on properties for JSON schema generation — it only applies at the class/type level. JsonPropertyName is needed for PromptBasedSchemaClient to emit the correct short property names. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Introduce AI capabilities for Windows platform including: Core Components: - PhiSilicaChatClient: Chat completion client using Windows Copilot Runtime (Phi Silica) with streaming support via IChatClient - PhiSilicaEmbeddingGenerator: Text embedding generator using LanguageModel.GenerateEmbeddingVectorAsync via IEmbeddingGenerator - PhiSilicaExtensions: Convenience methods to convert LanguageModel to IChatClient and IEmbeddingGenerator - (internal) PhiSilicaModelFactory: Model availability checking and lazy initialization with proper disposal handling Samples: - Update Essentials.AI.Sample to use Phi Silica on Windows, falling back to OpenAI on other platforms - Configure packaged app deployment for Windows AI API access Tests: - Unit tests for PhiSilicaChatClient construction and metadata - Unit tests for PhiSilicaEmbeddingGenerator construction and metadata Dependencies: - Update Windows App SDK to 2.0.0-experimental4 (required for AI APIs) - Update WebView2 to 1.0.3650.58 Requires Windows 10.0.26100.0+ with Copilot Runtime support enabled.
… sample improvements - Updated WinAppSDK from experimental4 to experimental6 - Fixed PhiSilicaChatClient streaming using shared StreamingResponseHandler - Removed PhiSilicaEmbeddingGenerator (LLM token embeddings unsuitable for similarity) - Added ISemanticSearchService abstraction with EmbeddingSearchService and AppContentIndexerSearchService - New LandmarkDetailPage with AI travel tips, similar destinations, semantic search - Refactored DataService to use ISemanticSearchService - TaggingService switched to plaintext parsing for cross-platform compatibility - TripPlanningPage auto-starts itinerary generation - Fixed device test infrastructure (appxmanifest, PublicAPI, test runner script) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…dmark - PromptBasedSchemaClient middleware converts JSON schema to prompt-based instructions for Phi Silica - Strips markdown code fences from non-streaming responses - Fixed chat bubble alignment on Windows (Grid wrapper for CollectionView items) - Fixed chat scroll-to-end (DispatchDelayed + MakeVisible) - Removed LanguagePreferenceService — language passed as navigation parameter - Added Temperature (0.8-0.9) for creative agents/tips - Fixed WeatherService locale issue (InvariantCulture for coordinates) - Added weather display to LandmarkDetailPage - Map placeholder on Windows (OnPlatform swap) - TravelPlanResult uses short JsonPropertyName to prevent SLM misspelling - ActivityKind enum prompt-enforced (no attribute changes needed) - StreamingResponseHandler: optional chunker (passthrough mode for pre-chunked models) - Added 7 passthrough unit tests for StreamingResponseHandler - Added Bunaken Marine Park (Manado, Indonesia) as new landmark - Fixed ItineraryWorkflow agent instruction examples Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
File-link PromptBasedSchemaClient from the sample app into the device tests project (Windows only). Add PhiSilicaSchemaClient wrapper that chains PromptBasedSchemaClient → PhiSilicaChatClient, and derive PhiSilicaChatClientJsonSchemaTests from the shared base class. Skip the 'without schema' tests since Phi Silica requires prompt-based schema rewriting. Embedding tests remain excluded for Windows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
868d251 to
d9bdbcd
Compare
Revert Versions.props WinAppSDK (1.8.251106002) and WebView2 (1.0.3179.45) to main values so the rest of the repo is unaffected. Override MicrosoftWindowsAppSDKPackageVersion to 2.0.0-experimental6 only in Essentials.AI.csproj and the AI sample csproj — this scopes the experimental dependency to the AI projects without breaking customers or other MAUI libraries. Remove nuget.org from NuGet.config — the experimental package resolves from the existing internal feeds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…props Move the per-project MicrosoftWindowsAppSDKPackageVersion overrides into a shared Directory.Build.props at src/AI/. All AI projects (library, sample, device tests) pick it up through MSBuild walk-up. The sample no longer has a direct WinAppSDK PackageReference — it receives the dependency transitively through Essentials.AI. Chain: src/AI/samples/Directory.Build.props -> src/AI/Directory.Build.props -> root Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add PhiSilicaChatClientFunctionCallingTests (base class derivation) and PhiSilicaChatClientValidationTests (adapted from Apple tests). Packaged run on Copilot+ PC: 44/44 passed, 0 failed, 0 skipped. FunctionCalling/JsonSchema/Validation tests need longer runtime (each test makes real Phi Silica LLM calls). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Summary
Adds Windows Copilot Runtime (Phi Silica) support to
Microsoft.Maui.Essentials.AI, enabling on-device AI capabilities through the Microsoft.Extensions.AI abstractions on Windows.New Components
IChatClientimplementation for Windows Copilot Runtime — synchronous & streaming responses, lazy model init, cancellation support, middleware compatibleLanguageModel.AsIChatClient()extension methodISemanticSearchServiceusing Windows AppContentIndexer — OS handles embeddings internallyCapabilities
GetResponseAsync()(streaming internally)LanguageModel.CreateContext()PromptBasedSchemaClientmiddlewareSample App Changes
The
Essentials.AI.Samplenow uses Phi Silica on Windows (on-device) and falls back to OpenAI on other platforms.PromptBasedSchemaClientmiddleware andDisplayNameattributes replaceJsonPropertyNamefor cross-platform schema compatibility.Dependencies
Test Coverage
PhiSilicaChatClientTests— instantiation and metadata verificationRequirements