microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.AI/Annotations/PromptAttribute.cs
38lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Teams.AI.Templates; |
| 5 | |
| 6 | namespace Microsoft.Teams.AI.Annotations; |
| 7 | |
| 8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = true)] |
| 9 | public class PromptAttribute : Attribute |
| 10 | { |
| 11 | /// <summary> |
| 12 | /// the prompts name |
| 13 | /// </summary> |
| 14 | public string? Name { get; private set; } |
| 15 | |
| 16 | /// <summary> |
| 17 | /// the prompts description |
| 18 | /// </summary> |
| 19 | public string? Description { get; private set; } |
| 20 | |
| 21 | /// <summary> |
| 22 | /// the prompts instructions |
| 23 | /// </summary> |
| 24 | public ITemplate? Instructions { get; private set; } |
| 25 | |
| 26 | public PromptAttribute(string? Name = null, string? Description = null) |
| 27 | { |
| 28 | this.Name = Name; |
| 29 | this.Description = Description; |
| 30 | } |
| 31 | |
| 32 | public PromptAttribute(string? Name = null, string? Description = null, params string[] Instructions) |
| 33 | { |
| 34 | this.Name = Name; |
| 35 | this.Description = Description; |
| 36 | this.Instructions = new StringTemplate(string.Join("\n", Instructions)); |
| 37 | } |
| 38 | } |