microsoft / microsoft/WindowsAppSDK

[2.0.250930001-experimental1] Phi Silica GetReadyState and EnsureReadyAsync return NotReady when model is available

Open
#5,982 0 comments 0 reactions 0 assignees View on GitHub
area-WCR needs-triage
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

### Describe the bug

I'm upgrading an app from 1.8.250702007-experimental4 to WinAppSDK 2.0.250930001-experimental1. The app has some Phi SIlica functionality. Previously the following code worked:
```
auto readyState = LanguageModel::GetReadyState();
if (readyState == AIFeatureReadyState::NotReady)
{
LanguageModel::EnsureReadyAsync().get();
}

// Create the language model and generate a response synchronously
auto languageModel = LanguageModel::CreateAsync().get();
auto responseResult = languageModel.GenerateResponseAsync(winrt::to_hstring(prompt)).get();
auto result = winrt::to_string(responseResult.Text());
```
Now, `LanguageModel::GetReadyState()` returns `AIFeatureReadyState::NotReady`. `LanguageModel::EnsureReadyAsync()` returns Status `2` indicating the operation failed. However, if I remove the ready state checks and just run
```
auto languageModel = LanguageModel::CreateAsync().get();
auto responseResult = languageModel.GenerateResponseAsync(winrt::to_hstring(prompt)).get();
auto result = winrt::to_string(responseResult.Text());
return Napi::String::New(env, result);
```
The code works as expected and `result` contains the text response from Phi Silica. `LanguageModel::GetReadyState()` and `LanguageModel::EnsureReadyAsync()` appear to have a bug and claim the model isn't available/ready when it is.

### Steps to reproduce the bug

1. Begin with a WinAppSDK 2.0.250930001-experimental1 app with configuration for Phi Silica
2. Attempt to run a basic call to Phi Silica, while first checking if the model is available.

Observe: Model availability checks claim model is not available, but if you remove those checks you can still generate a LanguageModel instance and call API's.

### Expected behavior

1. Model availability checks should succeed, and model should return a generated text value.

### Screenshots

_No response_

### NuGet package version

Windows App SDK 2.0 Experimental 1: 2.0.250930001-experimental1

### Packaging type

Unpackaged, Packaged (MSIX)

### Windows version

Insider Build (xxxxx)

### IDE

Other

### Additional context

Let me know if there is a better place to file this issue instead of within this repo.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Phi Silica flow using LanguageModel::GetReadyState(), EnsureReadyAsync(), CreateAsync(), and GenerateResponseAsync() in a WinAppSDK 2.0 experimental app. Compare the readiness results with the successful generation path; done means availability checks report the model correctly and the existing text-generation call continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
ai, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.