Windows 앱 SDK Phi Silica에 대한 API ref
Important
Windows 앱 SDK의 최신 실험 채널 릴리스에서 사용할 수 있습니다.
Windows 앱 SDK 실험 채널에는 개발 초기 단계의 API 및 기능이 포함되어 있습니다. 실험적 채널의 모든 API는 광범위한 수정 및 호환성이 손상되는 변경이 적용되며 언제든지 후속 릴리스에서 제거될 수 있습니다. 실험적 기능은 프로덕션 환경에서 사용할 수 없으며 이를 사용하는 앱은 Microsoft Store에 게시할 수 없습니다.
- 피 실리카는 중국 본토에서 사용할 수 없습니다.
- 자체 포함 앱은 지원되지 않습니다.
디바이스 내 처리 및 채팅 생성, 텍스트 추론, 수학 해결, 코드 생성 등을 가능하게 하는 Microsoft의 가장 강력한 NPU 튜닝 로컬 언어 모델인 Phi Silica와 같은 로컬 언어 모델에 액세스할 수 있는 Windows 앱 SDK API에 대해 알아봅니다.
자세한 내용은 Windows 앱 SDK 피 실리카 시작하기를 참조하세요.
팁
Windows 앱 SDK GitHub 리포지토리(타이틀에 Phi Silica 포함)에서 새 문제 만들거나 기존 문제에 응답하여 이러한 API 및 해당 기능에 대한 피드백을 제공합니다.
Microsoft.Windows.AI.Generative 네임스페이스
로컬 디바이스에서 생성된 AI 프롬프트 처리 및 응답을 위한 API를 제공합니다.
ImageDescriptionGenerator 클래스
public sealed class ImageDescriptionGenerator : System.IDisposable
ImageDescriptionGenerator.Close 메소드
// This member is not implemented in C#
설명
C#에서 구현되지 않았습니다.
ImageDescriptionGenerator.CreateAsync 메서드
public static Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.ImageDescriptionGenerator> CreateAsync ();
ImageDescriptionGenerator.DescribeAsync(Microsoft.Graphics.Imaging.ImageBuffer) 메서드
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> DescribeAsync (Microsoft.Graphics.Imaging.ImageBuffer image);
경고
이미지에서 ImageDescriptionGenerator.DescribeAsync()
를 호출할 때 때때로 오류가 발생하는 경우가 있습니다. 이 오류를 건너뛰어 디버거가 계속 진행하여 올바른 출력을 생성할 수 있습니다. 이 오류는 최종 사용자(앱을 사용하는 고객)가 아닌 개발자 환경에서만 표시됩니다. 디버그 또는 릴리스 빌드를 사용하면 이 오류가 트리거됩니다. 오류는 모든 실행이 아닌 간헐적으로 나타납니다.
ImageDescriptionGenerator.DescribeAsync(Microsoft.Graphics.Imaging.ImageBuffer,Microsoft.Windows.AI.Generative.ImageDescriptionScenario) 메서드
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> DescribeAsync (Microsoft.Graphics.Imaging.ImageBuffer image, Microsoft.Windows.AI.Generative.ImageDescriptionScenario scenario);
매개 변수
이미지
시나리오
반품
설명
ImageDescriptionGenerator.DescribeAsync(Microsoft.Graphics.Imaging.ImageBuffer,Microsoft.Windows.AI.Generative.ImageDescriptionScenario,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) 메서드
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);
매개 변수
이미지
시나리오
콘텐츠 필터 옵션
반품
설명
ImageDescriptionGenerator.IsAvailable 메서드
public static bool IsAvailable ();
ImageDescriptionGenerator.MakeAvailableAsync 메서드
public static Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.Management.Deployment.PackageDeploymentResult,Microsoft.Windows.Management.Deployment.PackageDeploymentProgress> MakeAvailableAsync ();
이미지 설명 시나리오 열거자
public enum ImageDescriptionScenario
필드
접근성: 1
캡션: 2
DetailedNarration: 3
OfficeCharts: 4
ImageLLMAdapterCreator 클래스
public sealed class ImageLLMAdapterCreator : System.IDisposable
ImageLLMAdapterCreator.Close 메서드
// This member is not implemented in C#
설명
C#에서 구현되지 않았습니다.
ImageLLMAdapterCreator.CreateAsync 메서드
public static Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.ImageLLMAdapterCreator> CreateAsync ();
반품
ImageLLMAdapterCreator.GetImageLLMEmbeddings(Microsoft.Windows.SemanticSearch.EmbeddingVector) 메서드
public System.Collections.Generic.IReadOnlyList<float> GetImageLLMEmbeddings (Microsoft.Windows.SemanticSearch.EmbeddingVector embeddings);
매개 변수
embeddings
반품
ImageLLMAdapterCreator.GetImageLLMEmbeddingsAsync(Microsoft.Windows.SemanticSearch.EmbeddingVector) 메서드
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<float>> GetImageLLMEmbeddingsAsync (Microsoft.Windows.SemanticSearch.EmbeddingVector embeddings);
매개 변수
embeddings
반품
ImageLLMAdapterCreator.GetModelInputSize 메서드
public uint GetModelInputSize ();
반품
ImageLLMAdapterCreator.GetModelOutputSize 메서드
public uint GetModelOutputSize ();
반품
ImageLLMAdapterCreator.IsAvailable 메서드
public static bool IsAvailable ();
반품
ImageLLMAdapterCreator.MakeAvailableAsync 메서드
public static Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.Management.Deployment.PackageDeploymentResult,Microsoft.Windows.Management.Deployment.PackageDeploymentProgress> MakeAvailableAsync ();
반품
LanguageModel 클래스
public sealed class LanguageModel : System.IDisposable
제공된 프롬프트에 대한 응답을 생성하기 위해 로컬 언어 모델과 상호 작용할 수 있는 개체를 나타냅니다.
LanguageModel.Close 메서드
개체 및 연결된 리소스를 삭제합니다.
설명
C#에서 구현되지 않았습니다.
LanguageModel.CreateAsync 메서드
public static Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.LanguageModel> CreateAsync ();
LanguageModel 클래스의 새 인스턴스를 비동기적으로 만듭니다.
반품
TextRecognizer 클래스의 새 인스턴스입니다.
LanguageModel.CreateContext 메서드
public Microsoft.Windows.AI.Generative.LanguageModelContext CreateContext ();
반품
설명
LanguageModel.CreateContext(System.String, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) 메서드
public Microsoft.Windows.AI.Generative.LanguageModelContext CreateContext (string systemPrompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
매개 변수
시스템 프롬프트
콘텐츠 필터 옵션
반품
설명
LanguageModel.GenerateEmbeddingVector(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) 메서드
public System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector> GenerateEmbeddingVector (string prompt, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
매개 변수
prompt
콘텐츠 필터 옵션
반품
설명
LanguageModel.GenerateEmbeddingVector(System.String) 메서드
public System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector> GenerateEmbeddingVector (string prompt);
매개 변수
prompt
반품
설명
LanguageModel.GenerateEmbeddingVectorAsync(System.String) 메서드
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<Microsoft.Windows.SemanticSearch.EmbeddingVector>> GenerateEmbeddingVectorAsync (string prompt);
매개 변수
prompt
반품
설명
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);
매개 변수
prompt
콘텐츠 필터 옵션
반품
설명
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);
매개 변수
options
prompt
콘텐츠 필터 옵션
반품
설명
LanguageModel.GenerateResponseAsync(System.String) 메서드
public Windows.Foundation.IAsyncOperation<Microsoft.Windows.AI.Generative.LanguageModelResponse> GenerateResponseAsync (string prompt);
단일 프롬프트에 대한 전체 응답을 생성하고 반환합니다.
매개 변수
prompt
질문 형식의 프롬프트입니다.
반품
응답 문자열 및 상태입니다.
예외
ArgumentException: 지정한 프롬프트가 모델이 허용할 수 있는 최대 토큰 수보다 깁니다.
LanguageModel.GenerateResponseAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions,Microsoft.Windows.AI.Generative.LanguageModelContext) 메서드
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);
매개 변수
options
prompt
콘텐츠 필터 옵션
문맥
반품
설명
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);
매개 변수
options
prompt
반품
설명
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);
매개 변수
options
promptEmbedding (프롬프트 임베딩)
콘텐츠 필터 옵션
문맥
반품
설명
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);
매개 변수
options
promptEmbedding (프롬프트 임베딩)
콘텐츠 필터 옵션
반품
설명
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);
매개 변수
promptEmbedding (프롬프트 임베딩)
반품
설명
LanguageModel.GenerateResponseFromEmbeddingsWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{Microsoft.Windows.SemanticSearch.EmbeddingVector}) method
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);
매개 변수
options
promptEmbedding (프롬프트 임베딩)
반품
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);
매개 변수
options
promptTokens
반품
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);
매개 변수
options
promptTokens
콘텐츠 필터 옵션
문맥
반품
LanguageModel.GenerateResponseFromTokensWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,Windows.Foundation.Collections.IVectorView{System.Int64},Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) 메서드
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);
매개 변수
options
promptTokens
콘텐츠 필터 옵션
반품
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);
매개 변수
options
prompt
콘텐츠 필터 옵션
반품
LanguageModel.GenerateResponseWithProgressAsync(System.String) 메서드
public Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.AI.Generative.LanguageModelResponse,string> GenerateResponseWithProgressAsync (string prompt);
매개 변수
prompt
반품
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);
매개 변수
options
prompt
반품
LanguageModel.GenerateResponseWithProgressAsync(Microsoft.Windows.AI.Generative.LanguageModelOptions,System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions,Microsoft.Windows.AI.Generative.LanguageModelContext) 메서드
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);
매개 변수
options
prompt
콘텐츠 필터 옵션
문맥
반품
LanguageModel.GenerateTokens(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) 메서드
public System.Collections.Generic.IReadOnlyList<long> GenerateTokens (string text, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
매개 변수
문자 메시지
콘텐츠 필터 옵션
반품
LanguageModel.GenerateTokens(System.String,Microsoft.Windows.AI.ContentModeration.ContentFilterOptions) 메서드
public System.Collections.Generic.IReadOnlyList<long> GenerateTokens (string text, Microsoft.Windows.AI.ContentModeration.ContentFilterOptions contentFilterOptions);
매개 변수
문자 메시지
콘텐츠 필터 옵션
반품
LanguageModel.GenerateTokensAsync(System.String) 메서드
public Windows.Foundation.IAsyncOperation<System.Collections.Generic.IReadOnlyList<long>> GenerateTokensAsync (string text);
매개 변수
문자 메시지
반품
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);
매개 변수
문자 메시지
콘텐츠 필터 옵션
반품
LanguageModel.IsAvailable 메서드
public static bool IsAvailable ();
반품
LanguageModel.IsPromptLargerThanContext(Microsoft.Windows.AI.Generative.LanguageModelContext,System.String) 메서드
public bool IsPromptLargerThanContext (Microsoft.Windows.AI.Generative.LanguageModelContext context, string prompt);
매개 변수
문맥
prompt
반품
LanguageModel.IsPromptLargerThanContext(System.String) 메서드
public bool IsPromptLargerThanContext (string prompt);
매개 변수
prompt
반품
LanguageModel.MakeAvailableAsync 메서드
public static Windows.Foundation.IAsyncOperationWithProgress<Microsoft.Windows.Management.Deployment.PackageDeploymentResult,Microsoft.Windows.Management.Deployment.PackageDeploymentProgress> MakeAvailableAsync ();
반품
LanguageModelContext 클래스
public sealed class LanguageModelContext
LanguageModelOptions 클래스
public sealed class LanguageModelOptions
LanguageModelOptions.#ctor 생성자
public LanguageModelOptions ();
LanguageModelOptions.#ctor(Microsoft.Windows.AI.Generative.LanguageModelSkill,System.Single,System.Single,System.UInt32) 생성자
public LanguageModelOptions (Microsoft.Windows.AI.Generative.LanguageModelSkill skill, float temp, float top_p, uint top_k);
매개 변수
기술
temp
top_p
top_k
LanguageModelOptions.Skill 속성
public Microsoft.Windows.AI.Generative.LanguageModelSkill Skill { get; set; }
속성 값
LanguageModelOptions.Temp 속성
public float Temp { get; set; }
속성 값
LanguageModelOptions.Top_k 속성
public uint Top_k { get; set; }
속성 값
LanguageModelOptions.Top_p 속성
public float Top_p { get; set; }
속성 값
LanguageModelResponse 클래스
public sealed class LanguageModelResponse
LanguageModelResponse.#ctor(System.String, Microsoft.Windows.AI.Generative.LanguageModelResponseStatus) 생성자
public LanguageModelResponse (string response, Microsoft.Windows.AI.Generative.LanguageModelResponseStatus status);
매개 변수
응답
상태
LanguageModelResponse.Response 속성
public string Response { get; }
속성 값
LanguageModelResponse.Status 속성
public Microsoft.Windows.AI.Generative.LanguageModelResponseStatus Status { get; }
속성 값
LanguageModelResponseStatus 열거형
public enum LanguageModelResponseStatus
필드
완료: 0
InProgress: 1
BlockedByPolicy: 2
PromptLargerThanContext: 3
정책에 의해 차단됨: 4 (PromptBlockedByPolicy)
정책에 의해 응답 차단됨: 5
LanguageModelSkill 열거형
public enum LanguageModelSkill