|
2 | 2 | using System;
|
3 | 3 | using System.Collections.Generic;
|
4 | 4 | using System.Diagnostics.CodeAnalysis;
|
5 |
| -using System.Linq; |
6 | 5 | using System.Threading;
|
7 | 6 | using System.Threading.Tasks;
|
8 | 7 | using Microsoft.Extensions.Logging;
|
@@ -385,48 +384,4 @@ protected Task NotifyThreadOfNewMessage(AgentThread thread, ChatMessageContent m
|
385 | 384 | {
|
386 | 385 | return thread.OnNewMessageAsync(message, cancellationToken);
|
387 | 386 | }
|
388 |
| - |
389 |
| - /// <summary> |
390 |
| - /// Provides a merged instance of <see cref="KernelArguments"/> with precedence for override arguments. |
391 |
| - /// </summary> |
392 |
| - /// <param name="arguments">The override arguments.</param> |
393 |
| - /// <remarks> |
394 |
| - /// This merge preserves original <see cref="PromptExecutionSettings"/> and <see cref="KernelArguments"/> parameters. |
395 |
| - /// It allows for incremental addition or replacement of specific parameters while also preserving the ability |
396 |
| - /// to override the execution settings. |
397 |
| - /// </remarks> |
398 |
| - private KernelArguments MergeArguments(KernelArguments? arguments) |
399 |
| - { |
400 |
| - // Avoid merge when override arguments are not set. |
401 |
| - if (arguments == null) |
402 |
| - { |
403 |
| - return this.Arguments ?? []; |
404 |
| - } |
405 |
| - |
406 |
| - // Avoid merge when the Agent arguments are not set. |
407 |
| - if (this.Arguments is null) |
408 |
| - { |
409 |
| - return arguments ?? []; |
410 |
| - } |
411 |
| - |
412 |
| - // Both instances are not null, merge with precedence for override arguments. |
413 |
| - |
414 |
| - // Merge execution settings with precedence for override arguments. |
415 |
| - Dictionary<string, PromptExecutionSettings>? settings = |
416 |
| - (arguments.ExecutionSettings ?? s_emptySettings) |
417 |
| - .Concat(this.Arguments.ExecutionSettings ?? s_emptySettings) |
418 |
| - .GroupBy(entry => entry.Key) |
419 |
| - .ToDictionary(entry => entry.Key, entry => entry.First().Value); |
420 |
| - |
421 |
| - // Merge parameters with precedence for override arguments. |
422 |
| - Dictionary<string, object?>? parameters = |
423 |
| - arguments |
424 |
| - .Concat(this.Arguments) |
425 |
| - .GroupBy(entry => entry.Key) |
426 |
| - .ToDictionary(entry => entry.Key, entry => entry.First().Value); |
427 |
| - |
428 |
| - return new KernelArguments(parameters, settings); |
429 |
| - } |
430 |
| - |
431 |
| - private static readonly Dictionary<string, PromptExecutionSettings> s_emptySettings = []; |
432 | 387 | }
|
0 commit comments