forked from microsoft/semantic-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAIServiceOptions.cs
71 lines (60 loc) · 1.88 KB
/
AIServiceOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) Microsoft. All rights reserved.
using System.ComponentModel.DataAnnotations;
namespace OpenApiSkillsExample;
/// <summary>
/// Configuration options for AI services, such as Azure OpenAI and OpenAI.
/// </summary>
public sealed class AIServiceOptions
{
public const string PropertyName = "AIService";
/// <summary>
/// Supported types of AI services.
/// </summary>
public enum AIServiceType
{
/// <summary>
/// Azure OpenAI https://learn.microsoft.com/en-us/azure/cognitive-services/openai/
/// </summary>
AzureOpenAI,
/// <summary>
/// OpenAI https://openai.com/
/// </summary>
OpenAI
}
/// <summary>
/// AI models to use.
/// </summary>
public class ModelTypes
{
/// <summary>
/// Azure OpenAI deployment name or OpenAI model name to use for completions.
/// </summary>
[Required, NotEmptyOrWhitespace]
public string Completion { get; set; } = string.Empty;
}
/// <summary>
/// Type of AI service.
/// </summary>
[Required]
public AIServiceType Type { get; set; } = AIServiceType.AzureOpenAI;
/// <summary>
/// Models/deployment names to use.
/// </summary>
[Required]
public ModelTypes Models { get; set; } = new ModelTypes();
/// <summary>
/// (Azure OpenAI only) Azure OpenAI endpoint.
/// </summary>
[RequiredOnPropertyValue(nameof(Type), AIServiceType.AzureOpenAI, notEmptyOrWhitespace: true)]
public string Endpoint { get; set; } = string.Empty;
/// <summary>
/// Token limits for completion model interactions.
/// </summary>
[Required]
public int TokenLimit { get; set; } = 4096;
/// <summary>
/// Key to access the AI service.
/// </summary>
[Required, NotEmptyOrWhitespace]
public string Key { get; set; } = string.Empty;
}