API referencia a Phi Silicához a Windows App SDK-ban
Fontos
Elérhető a Windows App SDK legújabb kísérleti csatornáján kiadásában.
A Windows App SDK kísérleti csatornája api-kat és funkciókat tartalmaz a fejlesztés korai szakaszában. A kísérleti csatornán található összes API-ra kiterjedt változatok és kompatibilitástörő változások vonatkoznak, és bármikor eltávolíthatók a későbbi kiadásokból. A kísérleti funkciók nem használhatók éles környezetben, és az őket használó alkalmazások nem tehetők közzé a Microsoft Store-ban.
- A Phi Silica a Kínai szárazföldön nem érhető el.
- Az önálló alkalmazások nem támogatottak.
Ismerje meg a Windows App SDK API-kat, amelyek hozzáférhetnek olyan helyi nyelvi modellekhez, mint a Phi Silica, a Microsoft legerősebb NPU-val hangolt helyi nyelvi modellje, amely lehetővé teszi az eszközalapú feldolgozást és a csevegés generálását, a szöveges érvelést, a matematikai megoldásokat, a kódgenerálást stb.
A részletekért lásd: Kezdjen neki a Phi Silica használatának a Windows App SDK-ban.
Borravaló
Küldjön visszajelzést ezekről az API-król és működésükről egy új probléma létrehozásával a Windows App SDK GitHub-adattárban (a címben szerepeljen Phi Silica), vagy válaszoljon egy meglévő problémára.
Microsoft.Windows.AI.Generative névtér
API-kat biztosít a helyi, generatív AI-kérések feldolgozásához és a válaszokhoz.
ImageDescriptionGenerator osztály
public sealed class ImageDescriptionGenerator : System.IDisposable
ImageDescriptionGenerator.Close metódus
// This member is not implemented in C#
Megjegyzések
Nincs implementálva a C#-ban.
ImageDescriptionGenerator.CreateAsync metódus
public static Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.ImageDescriptionGenerator> CreateAsync ();
ImageDescriptionGenerator.DescribeAsync(Microsoft.Graphics.Imaging.ImageBuffer) metódus
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> DescribeAsync (Microsoft.Graphics.Imaging.ImageBuffer image);
Figyelmeztetés
Amikor ImageDescriptionGenerator.DescribeAsync()
-t hív meg egy képen, néha hiba történik. Ez a hiba kihagyható, így a hibakereső folytathatja és helyes kimenetet hozhat létre. A hiba csak a fejlesztői környezetben látható, a végfelhasználóknál (az alkalmazást használó ügyfeleknél) nem. A hibakeresési vagy kiadási buildek használata aktiválja ezt a hibát. A hiba időnként jelenik meg, és nem minden futáskor.
ImageDescriptionGenerator.DescribeAsync(Microsoft.Graphics.Imaging.ImageBuffer,Microsoft.Windows.AI.Generative.ImageDescriptionScenario) metódus
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> DescribeAsync (Microsoft.Graphics.Imaging.ImageBuffer image, Microsoft.Windows.AI.Generative.ImageDescriptionScenario scenario);
Paraméterek
kép
forgatókönyv
Visszatér
Megjegyzések
ImageDescriptionGenerator.DescribeAsync(Microsoft.Graphics.Imaging.ImageBuffer,Microsoft.Windows.AI.Generative.ImageDescriptionScenario,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) metódus
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);
Paraméterek
kép
forgatókönyv
tartalomszűrő-beállítások
Visszatér
Megjegyzések
ImageDescriptionGenerator.IsAvailable metódus
public static bool IsAvailable ();
ImageDescriptionGenerator.MakeAvailableAsync metódus
public static Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.Management.Deployment.PackageDeploymentResult,Microsoft.Windows.Management.Deployment.PackageDeploymentProgress> MakeAvailableAsync ();
KépleírásForgatókönyv enumerátor
public enum ImageDescriptionScenario
Mezők
Akadálymentesség: 1
Felirat: 2
RészletesElbeszélés: 3
OfficeCharts: 4
ImageLLMAdapterCreator osztály
public sealed class ImageLLMAdapterCreator : System.IDisposable
ImageLLMAdapterCreator.Close metódus
// This member is not implemented in C#
Megjegyzések
Nincs implementálva a C#-ban.
ImageLLMAdapterCreator.CreateAsync metódus
public static Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.ImageLLMAdapterCreator> CreateAsync ();
Visszatér
ImageLLMAdapterCreator.GetImageLLMEmbeddings(Microsoft.Windows.SemanticSearch.EmbeddingVector) metódus
public System.Collections.Generic.IReadOnlyList<float> GetImageLLMEmbeddings (Microsoft.Windows.SemanticSearch.EmbeddingVector embeddings);
Paraméterek
beágyazások
Visszatér
ImageLLMAdapterCreator.GetImageLLMEmbeddingsAsync(Microsoft.Windows.SemanticSearch.EmbeddingVector) metódus
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<float>> GetImageLLMEmbeddingsAsync (Microsoft.Windows.SemanticSearch.EmbeddingVector embeddings);
Paraméterek
beágyazások
Visszatér
ImageLLMAdapterCreator.GetModelInputSize függvény
public uint GetModelInputSize ();
Visszatér
ImageLLMAdapterCreator.GetModelOutputSize metódus
public uint GetModelOutputSize ();
Visszatér
ImageLLMAdapterCreator.IsAvailable metódus
public static bool IsAvailable ();
Visszatér
ImageLLMAdapterCreator.MakeAvailableAsync metódus
public static Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.Management.Deployment.PackageDeploymentResult,Microsoft.Windows.Management.Deployment.PackageDeploymentProgress> MakeAvailableAsync ();
Visszatér
LanguageModel osztály
public sealed class LanguageModel : System.IDisposable
Olyan objektumot jelöl, amely képes a helyi nyelvi modellel interakcióba lépni egy adott kérdésre adott válaszok létrehozásához.
LanguageModel.Close metódus
Az objektum és a társított erőforrások eltávolítása.
Megjegyzések
Nincs implementálva a C#-ban.
LanguageModel.CreateAsync metódus
public static Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.LanguageModel> CreateAsync ();
Aszinkron módon létrehozza a LanguageModel osztály új példányát.
Visszatér
A TextRecognizer osztály új példánya.
LanguageModel.CreateContext metódus
public Microsoft.Windows.AI.Generative.LanguageModelContext CreateContext ();
Visszatér
Megjegyzések
LanguageModel.CreateContext(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) metódus
public Microsoft.Windows.AI.Generative.LanguageModelContext CreateContext (string systemPrompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Paraméterek
systemPrompt
tartalomszűrő-beállítások
Visszatér
Megjegyzések
LanguageModel.GenerateEmbeddingVector(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) metódus
public System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector> GenerateEmbeddingVector (string prompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Paraméterek
haladéktalan
tartalomszűrő-beállítások
Visszatér
Megjegyzések
LanguageModel.GenerateEmbeddingVector(System.String) metódus
public System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector> GenerateEmbeddingVector (string prompt);
Paraméterek
haladéktalan
Visszatér
Megjegyzések
LanguageModel.GenerateEmbeddingVectorAsync(System.String) metódus
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector>> GenerateEmbeddingVectorAsync (string prompt);
Paraméterek
haladéktalan
Visszatér
Megjegyzések
LanguageModel.GenerateEmbeddingVectorAsync(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) metódus
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector>> GenerateEmbeddingVectorAsync (string prompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Paraméterek
haladéktalan
tartalomszűrő-beállítások
Visszatér
Megjegyzések
LanguageModel.GenerateResponseAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) metódus
public Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.LanguageModelResponse> GenerateResponseAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, string prompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Paraméterek
beállítások
haladéktalan
tartalomszűrő-beállítások
Visszatér
Megjegyzések
LanguageModel.GenerateResponseAsync(System.String) metódus
public Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.LanguageModelResponse> GenerateResponseAsync (string prompt);
Egy teljes választ hoz létre és ad vissza egyetlen kérdésre.
Paraméterek
haladéktalan
Kérdés formájában megjelenő feladat.
Visszatér
Válasz karakterlánc és állapot.
Kivételek
ArgumentException: A megadott kérés hosszabb, mint amit a modell által elfogadható tokenek maximális száma megenged.
LanguageModel.GenerateResponseAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions,Microsoft.Windows.AI.Generative.LanguageModelContext) metódus
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);
Paraméterek
beállítások
haladéktalan
tartalomszűrő-beállítások
kontextus
Visszatér
Megjegyzések
LanguageModel.GenerateResponseAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,System.String) metódus
public Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.LanguageModelResponse> GenerateResponseAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, string prompt);
Paraméterek
beállítások
haladéktalan
Visszatér
Megjegyzések
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) metódus
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);
Paraméterek
beállítások
promptEmbedding
tartalomszűrő-beállítások
kontextus
Visszatér
Megjegyzések
LanguageModel.GenerateResponseFromEmbeddingsWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{Microsoft.Windows.SemanticSearch.EmbeddingVector},Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) metódus
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);
Paraméterek
beállítások
promptEmbedding
tartalomszűrő-beállítások
Visszatér
Megjegyzések
LanguageModel.GenerateResponseFromEmbeddingsWithProgressAsync(Windows.Foundation.Collections.IVectorView{Microsoft.Windows.SemanticSearch.EmbeddingVector}) metódus
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseFromEmbeddingsWithProgressAsync (System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector> promptEmbedding);
Paraméterek
promptEmbedding
Visszatér
Megjegyzések
LanguageModel.GenerateResponseFromEmbeddingsWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{Microsoft.Windows.SemanticSearch.EmbeddingVector}) metódus
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);
Paraméterek
beállítások
promptEmbedding
Visszatér
LanguageModel.GenerateResponseFromTokensWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{System.Int64}) metódus
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseFromTokensWithProgressAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, System.Collections.Generic.IReadOnlyList<long> promptTokens);
Paraméterek
beállítások
promptTokens
Visszatér
LanguageModel.GenerateResponseFromTokensWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{System.Int64},Microsoft.Windows.AI.ContentModeration.ContentFilterOptions,Microsoft.Windows.AI.Generative.LanguageModelContext) módszer
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);
Paraméterek
beállítások
promptTokens
tartalomszűrő-beállítások
kontextus
Visszatér
LanguageModel.GenerateResponseFromTokensWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{System.Int64},Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) metódus
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);
Paraméterek
beállítások
promptTokens
tartalomszűrő-beállítások
Visszatér
LanguageModel.GenerateResponseWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) függvény
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);
Paraméterek
beállítások
haladéktalan
tartalomszűrő-beállítások
Visszatér
LanguageModel.GenerateResponseWithProgressAsync(System.String) metódus
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseWithProgressAsync (string prompt);
Paraméterek
haladéktalan
Visszatér
LanguageModel.GenerateResponseWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,System.String) függvény
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseWithProgressAsync (Microsoft.Windows.AI.Generative.LanguageModelOptions options, string prompt);
Paraméterek
beállítások
haladéktalan
Visszatér
LanguageModel.GenerateResponseWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions,Microsoft.Windows.AI.Generative.LanguageModelContext) metódus
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);
Paraméterek
beállítások
haladéktalan
tartalomszűrő-beállítások
kontextus
Visszatér
LanguageModel.GenerateTokens(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) metódus
public System.Collections.Generic.IReadOnlyList<long> GenerateTokens (string text, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Paraméterek
szöveg
tartalomszűrő-beállítások
Visszatér
LanguageModel.GenerateTokens(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) metódus
public System.Collections.Generic.IReadOnlyList<long> GenerateTokens (string text, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Paraméterek
szöveg
tartalomszűrő-beállítások
Visszatér
LanguageModel.GenerateTokensAsync(System.String) metódus
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<long>> GenerateTokensAsync (string text);
Paraméterek
szöveg
Visszatér
LanguageModel.GenerateTokensAsync(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) metódus
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<long>> GenerateTokensAsync (string text, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
Paraméterek
szöveg
tartalomszűrő-beállítások
Visszatér
LanguageModel.IsAvailable metódus
public static bool IsAvailable ();
Visszatér
LanguageModel.IsPromptLargerThanContext(Microsoft.Windows.AI.Generative.LanguageModelContext,System.String) metódus
public bool IsPromptLargerThanContext (Microsoft.Windows.AI.Generative.LanguageModelContext context, string prompt);
Paraméterek
kontextus
haladéktalan
Visszatér
LanguageModel.IsPromptLargerThanContext(System.String) metódus
public bool IsPromptLargerThanContext (string prompt);
Paraméterek
haladéktalan
Visszatér
LanguageModel.MakeAvailableAsync metódus (elérhetővé tételi)
public static Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.Management.Deployment.PackageDeploymentResult,Microsoft.Windows.Management.Deployment.PackageDeploymentProgress> MakeAvailableAsync ();
Visszatér
LanguageModelContext osztály
public sealed class LanguageModelContext
LanguageModelOptions osztály
public sealed class LanguageModelOptions
LanguageModelOptions.#ctor konstruktor
public LanguageModelOptions ();
LanguageModelOptions.#ctor(Microsoft.Windows.AI.Generative.LanguageModelSkill,System.Single,System.Single,System.UInt32) konstruktor
public LanguageModelOptions (Microsoft.Windows.AI.Generative.LanguageModelSkill skill, float temp, float top_p, uint top_k);
Paraméterek
készség
temp
top_p
top_k
LanguageModelOptions."Skill" tulajdonság
public Microsoft.Windows.AI.Generative.LanguageModelSkill Skill { get; set; }
Tulajdonságérték
LanguageModelOptions.Temp tulajdonság
public float Temp { get; set; }
Tulajdonságérték
LanguageModelOptions Top_k tulajdonság
public uint Top_k { get; set; }
Tulajdonságérték
LanguageModelOptions.Top_p jellemző
public float Top_p { get; set; }
Tulajdonságérték
LanguageModelResponse osztály
public sealed class LanguageModelResponse
LanguageModelResponse.#ctor(System.String,Microsoft.Windows.AI.Generative.LanguageModelResponseStatus) konstruktor
public LanguageModelResponse (string response, Microsoft.Windows.AI.Generative.LanguageModelResponseStatus status);
Paraméterek
válasz
állapot
LanguageModelResponse.Response mező
public string Response { get; }
Tulajdonságérték
LanguageModelResponse.Status elem tulajdonság
public Microsoft.Windows.AI.Generative.LanguageModelResponseStatus Status { get; }
Tulajdonságérték
LanguageModelResponseStatus felsorolás
public enum LanguageModelResponseStatus
Mezők
Kész: 0
Folyamatban: 1
Blokkolva a szabályzat által: 2
PromptLargerThanContext: 3
PromptBlockedByPolicy: 4
A válasz zárolva irányelv miatt: 5
LanguageModelSkill felsorolás
public enum LanguageModelSkill