API-ref voor PhiSilium in de Windows App SDK
Belangrijk
Beschikbaar in de nieuwste experimentele kanaal versie van de Windows App SDK.
Het experimentele kanaal van de Windows App SDK bevat API's en functies in een vroeg stadium van ontwikkeling. Alle API's in het experimentele kanaal zijn onderhevig aan uitgebreide revisies en ingrijpende wijzigingen en kunnen te allen tijde uit volgende releases worden verwijderd. Experimentele functies worden niet ondersteund voor gebruik in productieomgevingen en apps die deze gebruiken, kunnen niet worden gepubliceerd naar de Microsoft Store.
- PhiSilium is niet beschikbaar op het vasteland van China.
- Zelfstandige apps worden niet ondersteund.
Meer informatie over de Windows App SDK API's die toegang hebben tot lokale taalmodellen, zoals PhiSilium, het krachtigste NPU-afgestemde lokale taalmodel van Microsoft waarmee het verwerken en genereren van chats op apparaten mogelijk is, redeneren over tekst, wiskundige oplossingen, codegeneratie en meer.
Zie Aan de slag met Phi Silicium in de Windows App SDKvoor meer informatie.
Fooi
Geef feedback over deze API's en hun functionaliteit door een nieuwe issue aan te maken in de GitHub-opslagplaats van de Windows App SDK (neem Phi Silica op in de titel) of door te reageren op een bestaande issue.
Microsoft.Windows.AI.Generative namespace
Biedt API's voor lokale, apparaatgeneratieve AI-promptverwerking en -antwoorden.
Klasse ImageDescriptionGenerator
public sealed class ImageDescriptionGenerator : System.IDisposable
ImageDescriptionGenerator.Close-methode
// This member is not implemented in C#
Opmerkingen
Niet geïmplementeerd in C#.
Methode ImageDescriptionGenerator.CreateAsync
public static Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.ImageDescriptionGenerator> CreateAsync ();
Methode ImageDescriptionGenerator.DescribeAsync(Microsoft.Graphics.Imaging.ImageBuffer)
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> DescribeAsync (Microsoft.Graphics.Imaging.ImageBuffer image);
Waarschuwing
Bij het aanroepen van ImageDescriptionGenerator.DescribeAsync()
op een afbeelding treedt soms een fout op. Deze fout kan worden overgeslagen, zodat het foutopsporingsprogramma kan doorgaan en de juiste uitvoer kan genereren. De fout is alleen zichtbaar in de ontwikkelomgeving, niet voor eindgebruikers (klanten die uw app gebruiken). Het gebruik van Debug- of Release-builds zal deze fout activeren. De fout verschijnt af en toe en niet elke keer.
Methode ImageDescriptionGenerator.DescribeAsync(Microsoft.Graphics.Imaging.ImageBuffer,Microsoft.Windows.AI.Ative.ImageDescriptionScenario)
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> DescribeAsync (Microsoft.Graphics.Imaging.ImageBuffer image, Microsoft.Windows.AI.Generative.ImageDescriptionScenario scenario);
Parameters
afbeelding
scenario
Retouren
Opmerkingen
ImageDescriptionGenerator.DescribeAsync(Microsoft.Graphics.Imaging.ImageBuffer,Microsoft.Windows.AI.Generative.ImageDescriptionScenario,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) methode
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> DescribeAsync (Microsoft.Graphics.Imaging.ImageBuffer image, Microsoft.Windows.AI.Generative.ImageDescriptionScenario scenario, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Parameters
afbeelding
scenario
inhoudfilteropties
Retouren
Opmerkingen
Methode ImageDescriptionGenerator.IsAvailable
public static bool IsAvailable ();
De methode ImageDescriptionGenerator.MakeAvailableAsync
public static Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.Management.Deployment.PackageDeploymentResult,Microsoft.Windows.Management.Deployment.PackageDeploymentProgress> MakeAvailableAsync ();
ImageDescriptionScenario enumerator
public enum ImageDescriptionScenario
Velden
Toegankelijkheid: 1
Bijschrift: 2
Gedetailleerde Vertelling: 3
OfficeCharts: 4
Klasse ImageLLMAdapterCreator
public sealed class ImageLLMAdapterCreator : System.IDisposable
Close-methode van ImageLLMAdapterCreator
// This member is not implemented in C#
Opmerkingen
Niet geïmplementeerd in C#.
De methode ImageLLMAdapterCreator.CreateAsync
public static Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.ImageLLMAdapterCreator> CreateAsync ();
Retouren
Methode ImageLLMAdapterCreator.GetImageLLMEmbeddings(Microsoft.Windows.SemanticSearch.EmbeddingVector)
public System.Collections.Generic.IReadOnlyList<float> GetImageLLMEmbeddings (Microsoft.Windows.SemanticSearch.EmbeddingVector embeddings);
Parameters
insluitingen
Retouren
Methode ImageLLMAdapterCreator.GetImageLLMEmbeddingsAsync(Microsoft.Windows.SemanticSearch.EmbeddingVector)
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<float>> GetImageLLMEmbeddingsAsync (Microsoft.Windows.SemanticSearch.EmbeddingVector embeddings);
Parameters
insluitingen
Retouren
De methode ImageLLMAdapterCreator.GetModelInputSize
public uint GetModelInputSize ();
Retouren
ImageLLMAdapterCreator.GetModelOutputSize-methode
public uint GetModelOutputSize ();
Retouren
ImageLLMAdapterCreator.IsAvailable-methode
public static bool IsAvailable ();
Retouren
Methode ImageLLMAdapterCreator.MakeAvailableAsync
public static Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.Management.Deployment.PackageDeploymentResult,Microsoft.Windows.Management.Deployment.PackageDeploymentProgress> MakeAvailableAsync ();
Retouren
LanguageModel-klasse
public sealed class LanguageModel : System.IDisposable
Vertegenwoordigt een object dat kan communiceren met een lokaal taalmodel om antwoorden te genereren voor een opgegeven prompt.
methode LanguageModel.Close
Hiermee verwijdert u het object en de bijbehorende resources.
Opmerkingen
Niet geïmplementeerd in C#.
Methode LanguageModel.CreateAsync
public static Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.LanguageModel> CreateAsync ();
Asynchroon wordt er een nieuw exemplaar van de LanguageModel-klasse gemaakt.
Retouren
Een nieuw exemplaar van de klasse TextRecognizer.
Methode "LanguageModel.CreateContext"
public Microsoft.Windows.AI.Generative.LanguageModelContext CreateContext ();
Retouren
Opmerkingen
Methode LanguageModel.CreateContext(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions)
public Microsoft.Windows.AI.Generative.LanguageModelContext CreateContext (string systemPrompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Parameters
systeemprompt
inhoudfilteropties
Retouren
Opmerkingen
LanguageModel.GenerateEmbeddingVector(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) methode
public System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector> GenerateEmbeddingVector (string prompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Parameters
aanmoediging
inhoudfilteropties
Retouren
Opmerkingen
Methode LanguageModel.GenerateEmbeddingVector(System.String)
public System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector> GenerateEmbeddingVector (string prompt);
Parameters
aanmoediging
Retouren
Opmerkingen
De LanguageModel.GenerateEmbeddingVectorAsync(System.String)-methode
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector>> GenerateEmbeddingVectorAsync (string prompt);
Parameters
aanmoediging
Retouren
Opmerkingen
De methode LanguageModel.GenerateEmbeddingVectorAsync(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions)
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector>> GenerateEmbeddingVectorAsync (string prompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Parameters
aanmoediging
inhoudfilteropties
Retouren
Opmerkingen
Methode LanguageModel.GenerateResponseAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions)
public Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.LanguageModelResponse> GenerateResponseAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, string prompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Parameters
Opties
aanmoediging
inhoudfilteropties
Retouren
Opmerkingen
Methode LanguageModel.GenerateResponseAsync(System.String)
public Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.LanguageModelResponse> GenerateResponseAsync (string prompt);
Genereert en retourneert een volledig antwoord voor één prompt.
Parameters
aanmoediging
Een prompt in de vorm van een vraag.
Retouren
Een antwoordtekenreeks en -status.
Uitzonderingen
ArgumentException: de opgegeven prompt is langer dan het maximum aantal tokens dat het model kan accepteren.
LanguageModel.GenerateResponseAsync(Microsoft.Windows.AI.Ative.LanguageModelOptions,System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions,Microsoft.Windows.AI.Ative.LanguageModelContext) methode
public Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.LanguageModelResponse> GenerateResponseAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, string prompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions, Microsoft.Windows.AI.Generative.LanguageModelContext context);
Parameters
Opties
aanmoediging
inhoudfilteropties
context
Retouren
Opmerkingen
Methode LanguageModel.GenerateResponseAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,System.String)
public Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.LanguageModelResponse> GenerateResponseAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, string prompt);
Parameters
Opties
aanmoediging
Retouren
Opmerkingen
Methode LanguageModel.GenerateResponseFromEmbeddingsWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{Microsoft.Windows.SemanticSearch.EmbeddingVector},Microsoft.Windows.AI.ContentModeration.ContentFilterOptions,Microsoft.Windows.AI.Generative.LanguageModelContext)
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseFromEmbeddingsWithProgressAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector> promptEmbedding, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions, Microsoft.Windows.AI.Generative.LanguageModelContext context);
Parameters
Opties
promptEmbedding
inhoudfilteropties
context
Retouren
Opmerkingen
Methode LanguageModel.GenerateResponseFromEmbeddingsWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{Microsoft.Windows.SemanticSearch.EmbeddingVector},Microsoft.Windows.AI.ContentModeration.ContentFilterOptions)
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseFromEmbeddingsWithProgressAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector> promptEmbedding, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Parameters
Opties
promptEmbedding
inhoudfilteropties
Retouren
Opmerkingen
Methode LanguageModel.GenerateResponseFromEmbeddingsWithProgressAsync(Windows.Foundation.Collections.IVectorView{Microsoft.Windows.SemanticSearch.EmbeddingVector})
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseFromEmbeddingsWithProgressAsync (System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector> promptEmbedding);
Parameters
promptEmbedding
Retouren
Opmerkingen
Methode LanguageModel.GenerateResponseFromEmbeddingsWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{Microsoft.Windows.SemanticSearch.EmbeddingVector})
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseFromEmbeddingsWithProgressAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector> promptEmbedding);
Parameters
Opties
promptEmbedding
Retouren
Methode LanguageModel.GenerateResponseFromTokensWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{System.Int64})
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseFromTokensWithProgressAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, System.Collections.Generic.IReadOnlyList<long> promptTokens);
Parameters
Opties
promptTokens
Retouren
Methode LanguageModel.GenerateResponseFromTokensWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{System.Int64},Microsoft.Windows.AI.ContentModeration.ContentFilterOptions,Microsoft.Windows.AI.Generative.LanguageModelContext)
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseFromTokensWithProgressAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, System.Collections.Generic.IReadOnlyList<long> promptTokens, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions, Microsoft.Windows.AI.Generative.LanguageModelContext context);
Parameters
Opties
promptTokens
inhoudfilteropties
context
Retouren
LanguageModel.GenerateResponseFromTokensWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{System.Int64},Microsoft.Windows.AI.ContentModeration.ContentFilterOptions)-methode
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseFromTokensWithProgressAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, System.Collections.Generic.IReadOnlyList<long> promptTokens, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Parameters
Opties
promptTokens
inhoudfilteropties
Retouren
Methode LanguageModel.GenerateResponseWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions)
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseWithProgressAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, string prompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Parameters
Opties
aanmoediging
inhoudfilteropties
Retouren
Methode LanguageModel.GenerateResponseWithProgressAsync(System.String)
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseWithProgressAsync (string prompt);
Parameters
aanmoediging
Retouren
Methode LanguageModel.GenerateResponseWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,System.String)
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseWithProgressAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, string prompt);
Parameters
Opties
aanmoediging
Retouren
LanguageModel.GenerateResponseWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions, System.String, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions, Microsoft.Windows.AI.Generative.LanguageModelContext) methode
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseWithProgressAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, string prompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions, Microsoft.Windows.AI.Generative.LanguageModelContext context);
Parameters
Opties
aanmoediging
inhoudfilteropties
context
Retouren
Methode LanguageModel.GenerateTokens(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions)
public System.Collections.Generic.IReadOnlyList<long> GenerateTokens (string text, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Parameters
Tekst
inhoudfilteropties
Retouren
Methode LanguageModel.GenerateTokens(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions)
public System.Collections.Generic.IReadOnlyList<long> GenerateTokens (string text, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Parameters
Tekst
inhoudfilteropties
Retouren
Methode LanguageModel.GenerateTokensAsync(System.String)
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<long>> GenerateTokensAsync (string text);
Parameters
Tekst
Retouren
Methode LanguageModel.GenerateTokensAsync(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions)
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<long>> GenerateTokensAsync (string text, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Parameters
Tekst
inhoudfilteropties
Retouren
De methode LanguageModel.IsAvailable
public static bool IsAvailable ();
Retouren
Methode LanguageModel.IsPromptLargerThanContext(Microsoft.Windows.AI.Generative.LanguageModelContext,System.String)
public bool IsPromptLargerThanContext (Microsoft.Windows.AI.Generative.LanguageModelContext context, string prompt);
Parameters
context
aanmoediging
Retouren
Methode LanguageModel.IsPromptLargerThanContext(System.String)
public bool IsPromptLargerThanContext (string prompt);
Parameters
aanmoediging
Retouren
LanguageModel.MakeAvailableAsync-methode
public static Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.Management.Deployment.PackageDeploymentResult,Microsoft.Windows.Management.Deployment.PackageDeploymentProgress> MakeAvailableAsync ();
Retouren
LanguageModelContext-klasse
public sealed class LanguageModelContext
Klasse LanguageModelOptions
public sealed class LanguageModelOptions
LanguageModelOptions.#ctor constructor
public LanguageModelOptions ();
LanguageModelOptions.#ctor(Microsoft.Windows.AI.Generative.LanguageModelSkill,System.Single,System.Single,System.UInt32) constructor
public LanguageModelOptions (Microsoft.Windows.AI.Generative.LanguageModelSkill skill, float temp, float top_p, uint top_k);
Parameters
vaardigheid
temp
top_p
top_k
Eigenschap van LanguageModelOptions.Skill
public Microsoft.Windows.AI.Generative.LanguageModelSkill Skill { get; set; }
Eigenschapswaarde
Eigenschap LanguageModelOptions.Temp
public float Temp { get; set; }
Eigenschapswaarde
Eigenschap LanguageModelOptions.Top_k
public uint Top_k { get; set; }
Eigenschapswaarde
LanguageModelOptions.Top_p-eigenschap
public float Top_p { get; set; }
Eigenschapswaarde
Klasse LanguageModelResponse
public sealed class LanguageModelResponse
LanguageModelResponse.#ctor(System.String,Microsoft.Windows.AI.Generative.LanguageModelResponseStatus) constructor
public LanguageModelResponse (string response, Microsoft.Windows.AI.Generative.LanguageModelResponseStatus status);
Parameters
antwoord
toestand
Eigenschap van LanguageModelResponse.Response
public string Response { get; }
Eigenschapswaarde
De LanguageModelResponse.Status-eigenschap
public Microsoft.Windows.AI.Generative.LanguageModelResponseStatus Status { get; }
Eigenschapswaarde
De opsomming TaalModelResponsStatus
public enum LanguageModelResponseStatus
Velden
Voltooid: 0
InProgress: 1
GeblokkeerdDoorBeleid: 2
PromptLargerThanContext: 3
PromptGeblokkeerdDoorBeleid: 4
ReactieGeblokkeerdDoorBeleid: 5
Enumeratie LanguageModelSkill
public enum LanguageModelSkill