|
1 | 1 | // Copyright (c) Microsoft. All rights reserved. |
2 | 2 |
|
| 3 | +using System.Diagnostics.CodeAnalysis; |
3 | 4 | using Microsoft.SemanticKernel.Orchestration; |
4 | 5 |
|
5 | 6 | namespace Microsoft.SemanticKernel.SkillDefinition; |
6 | 7 |
|
7 | 8 | /// <summary> |
8 | 9 | /// Read-only skill collection interface. |
9 | 10 | /// </summary> |
10 | | -[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1710:Identifiers should have correct suffix", Justification = "It is a collection")] |
11 | 11 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "It is a collection")] |
12 | 12 | public interface IReadOnlySkillCollection |
13 | 13 | { |
14 | 14 | /// <summary> |
15 | | - /// Check if the collection contains the specified function in the global skill, regardless of the function type |
| 15 | + /// Gets the function stored in the collection. |
16 | 16 | /// </summary> |
17 | | - /// <param name="skillName">Skill name</param> |
18 | | - /// <param name="functionName">Function name</param> |
19 | | - /// <returns>True if the function exists, false otherwise</returns> |
20 | | - bool HasFunction(string skillName, string functionName); |
| 17 | + /// <param name="functionName">The name of the function to retrieve.</param> |
| 18 | + /// <returns>The function retrieved from the collection.</returns> |
| 19 | + /// <exception cref="KernelException">The specified function could not be found in the collection.</exception> |
| 20 | + ISKFunction GetFunction(string functionName); |
21 | 21 |
|
22 | 22 | /// <summary> |
23 | | - /// Check if the collection contains the specified function, regardless of the function type |
| 23 | + /// Gets the function stored in the collection. |
24 | 24 | /// </summary> |
25 | | - /// <param name="functionName">Function name</param> |
26 | | - /// <returns>True if the function exists, false otherwise</returns> |
27 | | - bool HasFunction(string functionName); |
| 25 | + /// <param name="skillName">The name of the skill with which the function is associated.</param> |
| 26 | + /// <param name="functionName">The name of the function to retrieve.</param> |
| 27 | + /// <returns>The function retrieved from the collection.</returns> |
| 28 | + /// <exception cref="KernelException">The specified function could not be found in the collection.</exception> |
| 29 | + ISKFunction GetFunction(string skillName, string functionName); |
28 | 30 |
|
29 | 31 | /// <summary> |
30 | | - /// Check if a semantic function is registered |
| 32 | + /// Gets the function stored in the collection. |
31 | 33 | /// </summary> |
32 | | - /// <param name="functionName">Function name</param> |
33 | | - /// <param name="skillName">Skill name</param> |
34 | | - /// <returns>True if the function exists</returns> |
35 | | - bool HasSemanticFunction(string skillName, string functionName); |
| 34 | + /// <param name="functionName">The name of the function to retrieve.</param> |
| 35 | + /// <param name="functionInstance">When this method returns, the function that was retrieved if one with the specified name was found; otherwise, <see langword="null"/>.</param> |
| 36 | + /// <returns><see langword="true"/> if the function was found; otherwise, <see langword="false"/>.</returns> |
| 37 | + bool TryGetFunction(string functionName, [NotNullWhen(true)] out ISKFunction? functionInstance); |
36 | 38 |
|
37 | 39 | /// <summary> |
38 | | - /// Check if a native function is registered |
| 40 | + /// Gets the function stored in the collection. |
39 | 41 | /// </summary> |
40 | | - /// <param name="functionName">Function name</param> |
41 | | - /// <param name="skillName">Skill name</param> |
42 | | - /// <returns>True if the function exists</returns> |
43 | | - bool HasNativeFunction(string skillName, string functionName); |
| 42 | + /// <param name="skillName">The name of the skill with which the function is associated.</param> |
| 43 | + /// <param name="functionName">The name of the function to retrieve.</param> |
| 44 | + /// <param name="functionInstance">When this method returns, the function that was retrieved if one with the specified name was found; otherwise, <see langword="null"/>.</param> |
| 45 | + /// <returns><see langword="true"/> if the function was found; otherwise, <see langword="false"/>.</returns> |
| 46 | + bool TryGetFunction(string skillName, string functionName, [NotNullWhen(true)] out ISKFunction? functionInstance); |
44 | 47 |
|
45 | 48 | /// <summary> |
46 | | - /// Check if a native function is registered in the global skill |
| 49 | + /// Gets the semantic function stored in the collection. |
47 | 50 | /// </summary> |
48 | | - /// <param name="functionName">Function name</param> |
49 | | - /// <returns>True if the function exists</returns> |
50 | | - bool HasNativeFunction(string functionName); |
| 51 | + /// <param name="functionName">The name of the function to retrieve.</param> |
| 52 | + /// <returns>The function retrieved from the collection.</returns> |
| 53 | + /// <exception cref="KernelException">The specified function could not be found in the collection.</exception> |
| 54 | + ISKFunction GetSemanticFunction(string functionName); |
51 | 55 |
|
52 | 56 | /// <summary> |
53 | | - /// Return the function delegate stored in the collection, regardless of the function type |
| 57 | + /// Gets the semantic function stored in the collection. |
54 | 58 | /// </summary> |
55 | | - /// <param name="functionName">Function name</param> |
56 | | - /// <returns>Function delegate</returns> |
57 | | - ISKFunction GetFunction(string functionName); |
| 59 | + /// <param name="skillName">The name of the skill with which the function is associated.</param> |
| 60 | + /// <param name="functionName">The name of the function to retrieve.</param> |
| 61 | + /// <returns>The function retrieved from the collection.</returns> |
| 62 | + /// <exception cref="KernelException">The specified function could not be found in the collection.</exception> |
| 63 | + ISKFunction GetSemanticFunction(string skillName, string functionName); |
58 | 64 |
|
59 | 65 | /// <summary> |
60 | | - /// Return the function delegate stored in the collection, regardless of the function type |
| 66 | + /// Gets the semantic function stored in the collection. |
61 | 67 | /// </summary> |
62 | | - /// <param name="functionName">Function name</param> |
63 | | - /// <param name="skillName">Skill name</param> |
64 | | - /// <returns>Function delegate</returns> |
65 | | - ISKFunction GetFunction(string skillName, string functionName); |
| 68 | + /// <param name="functionName">The name of the function to retrieve.</param> |
| 69 | + /// <param name="functionInstance">When this method returns, the function that was retrieved if one with the specified name was found; otherwise, <see langword="null"/>.</param> |
| 70 | + /// <returns><see langword="true"/> if the function was found; otherwise, <see langword="false"/>.</returns> |
| 71 | + bool TryGetSemanticFunction(string functionName, [NotNullWhen(true)] out ISKFunction? functionInstance); |
66 | 72 |
|
67 | 73 | /// <summary> |
68 | | - /// Return the semantic function delegate stored in the collection |
| 74 | + /// Gets the semantic function stored in the collection. |
69 | 75 | /// </summary> |
70 | | - /// <param name="functionName">Function name</param> |
71 | | - /// <returns>Semantic function delegate</returns> |
72 | | - ISKFunction GetSemanticFunction(string functionName); |
| 76 | + /// <param name="skillName">The name of the skill with which the function is associated.</param> |
| 77 | + /// <param name="functionName">The name of the function to retrieve.</param> |
| 78 | + /// <param name="functionInstance">When this method returns, the function that was retrieved if one with the specified name was found; otherwise, <see langword="null"/>.</param> |
| 79 | + /// <returns><see langword="true"/> if the function was found; otherwise, <see langword="false"/>.</returns> |
| 80 | + bool TryGetSemanticFunction(string skillName, string functionName, [NotNullWhen(true)] out ISKFunction? functionInstance); |
73 | 81 |
|
74 | 82 | /// <summary> |
75 | | - /// Return the semantic function delegate stored in the collection |
| 83 | + /// Gets the native function stored in the collection. |
76 | 84 | /// </summary> |
77 | | - /// <param name="functionName">Function name</param> |
78 | | - /// <param name="skillName">Skill name</param> |
79 | | - /// <returns>Semantic function delegate</returns> |
80 | | - ISKFunction GetSemanticFunction(string skillName, string functionName); |
| 85 | + /// <param name="functionName">The name of the function to retrieve.</param> |
| 86 | + /// <returns>The function retrieved from the collection.</returns> |
| 87 | + /// <exception cref="KernelException">The specified function could not be found in the collection.</exception> |
| 88 | + ISKFunction GetNativeFunction(string functionName); |
81 | 89 |
|
82 | 90 | /// <summary> |
83 | | - /// Return the native function delegate stored in the collection |
| 91 | + /// Gets the native function stored in the collection. |
84 | 92 | /// </summary> |
85 | | - /// <param name="functionName">Function name</param> |
86 | | - /// <param name="skillName">Skill name</param> |
87 | | - /// <returns>Native function delegate</returns> |
| 93 | + /// <param name="skillName">The name of the skill with which the function is associated.</param> |
| 94 | + /// <param name="functionName">The name of the function to retrieve.</param> |
| 95 | + /// <returns>The function retrieved from the collection.</returns> |
| 96 | + /// <exception cref="KernelException">The specified function could not be found in the collection.</exception> |
88 | 97 | ISKFunction GetNativeFunction(string skillName, string functionName); |
89 | 98 |
|
90 | 99 | /// <summary> |
91 | | - /// Return the native function delegate stored in the collection |
| 100 | + /// Gets the native function stored in the collection. |
92 | 101 | /// </summary> |
93 | | - /// <param name="functionName">Function name</param> |
94 | | - /// <returns>Native function delegate</returns> |
95 | | - ISKFunction GetNativeFunction(string functionName); |
| 102 | + /// <param name="functionName">The name of the function to retrieve.</param> |
| 103 | + /// <param name="functionInstance">When this method returns, the function that was retrieved if one with the specified name was found; otherwise, <see langword="null"/>.</param> |
| 104 | + /// <returns><see langword="true"/> if the function was found; otherwise, <see langword="false"/>.</returns> |
| 105 | + bool TryGetNativeFunction(string functionName, [NotNullWhen(true)] out ISKFunction? functionInstance); |
| 106 | + |
| 107 | + /// <summary> |
| 108 | + /// Gets the native function stored in the collection. |
| 109 | + /// </summary> |
| 110 | + /// <param name="skillName">The name of the skill with which the function is associated.</param> |
| 111 | + /// <param name="functionName">The name of the function to retrieve.</param> |
| 112 | + /// <param name="functionInstance">When this method returns, the function that was retrieved if one with the specified name was found; otherwise, <see langword="null"/>.</param> |
| 113 | + /// <returns><see langword="true"/> if the function was found; otherwise, <see langword="false"/>.</returns> |
| 114 | + bool TryGetNativeFunction(string skillName, string functionName, [NotNullWhen(true)] out ISKFunction? functionInstance); |
96 | 115 |
|
97 | 116 | /// <summary> |
98 | 117 | /// Get all registered functions details, minus the delegates |
|
0 commit comments