|
8 | 8 | namespace Microsoft.SemanticKernel.Agents;
|
9 | 9 |
|
10 | 10 | /// <summary>
|
11 |
| -/// Provides a <see cref="AgentFactory"/> which aggregates multiple kernel agent factories. |
| 11 | +/// Provides a <see cref="AgentFactory"/> which aggregates multiple agent factories. |
12 | 12 | /// </summary>
|
13 | 13 | [Experimental("SKEXP0110")]
|
14 |
| -public sealed class AggregatorKernelAgentFactory : AgentFactory |
| 14 | +public sealed class AggregatorAgentFactory : AgentFactory |
15 | 15 | {
|
16 |
| - private readonly AgentFactory[] _kernelAgentFactories; |
| 16 | + private readonly AgentFactory[] _agentFactories; |
17 | 17 |
|
18 | 18 | /// <summary>Initializes the instance.</summary>
|
19 |
| - /// <param name="kernelAgentFactories">Ordered <see cref="AgentFactory"/> instances to aggregate.</param> |
| 19 | + /// <param name="agentFactories">Ordered <see cref="AgentFactory"/> instances to aggregate.</param> |
20 | 20 | /// <remarks>
|
21 | 21 | /// Where multiple <see cref="AgentFactory"/> instances are provided, the first factory that supports the <see cref="AgentDefinition"/> will be used.
|
22 | 22 | /// </remarks>
|
23 |
| - public AggregatorKernelAgentFactory(params AgentFactory[] kernelAgentFactories) : base(kernelAgentFactories.SelectMany(f => f.Types).ToArray()) |
| 23 | + public AggregatorAgentFactory(params AgentFactory[] agentFactories) : base(agentFactories.SelectMany(f => f.Types).ToArray()) |
24 | 24 | {
|
25 |
| - Verify.NotNullOrEmpty(kernelAgentFactories); |
| 25 | + Verify.NotNullOrEmpty(agentFactories); |
26 | 26 |
|
27 |
| - foreach (AgentFactory kernelAgentFactory in kernelAgentFactories) |
| 27 | + foreach (AgentFactory agentFactory in agentFactories) |
28 | 28 | {
|
29 |
| - Verify.NotNull(kernelAgentFactory, nameof(kernelAgentFactories)); |
| 29 | + Verify.NotNull(agentFactory, nameof(agentFactories)); |
30 | 30 | }
|
31 | 31 |
|
32 |
| - this._kernelAgentFactories = kernelAgentFactories; |
| 32 | + this._agentFactories = agentFactories; |
33 | 33 | }
|
34 | 34 |
|
35 | 35 | /// <inheritdoc/>
|
36 | 36 | public override async Task<Agent?> TryCreateAsync(Kernel kernel, AgentDefinition agentDefinition, AgentCreationOptions? agentCreationOptions = null, CancellationToken cancellationToken = default)
|
37 | 37 | {
|
38 | 38 | Verify.NotNull(agentDefinition);
|
39 | 39 |
|
40 |
| - foreach (var kernelAgentFactory in this._kernelAgentFactories) |
| 40 | + foreach (var agentFactory in this._agentFactories) |
41 | 41 | {
|
42 |
| - if (kernelAgentFactory.IsSupported(agentDefinition)) |
| 42 | + if (agentFactory.IsSupported(agentDefinition)) |
43 | 43 | {
|
44 |
| - var kernelAgent = await kernelAgentFactory.TryCreateAsync(kernel, agentDefinition, agentCreationOptions, cancellationToken).ConfigureAwait(false); |
| 44 | + var kernelAgent = await agentFactory.TryCreateAsync(kernel, agentDefinition, agentCreationOptions, cancellationToken).ConfigureAwait(false); |
45 | 45 | if (kernelAgent is not null)
|
46 | 46 | {
|
47 | 47 | return kernelAgent;
|
|
0 commit comments