Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Add prompt execution settings to AutoFunctionInvocationContext #10551

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

SergeyMenshykh
Copy link
Member

@SergeyMenshykh SergeyMenshykh commented Feb 14, 2025

Motivation, Context and Description

Today, the prompt execution settings supplied to the chat completion service are not available in AutoFunctionInvocationContext. This PR adds the new AutoFunctionInvocationContext.ExecutionSettings and assigns it to the settings with which the chat completion service was invoked.

Closes: #10475

@SergeyMenshykh SergeyMenshykh self-assigned this Feb 14, 2025
@SergeyMenshykh SergeyMenshykh requested a review from a team as a code owner February 14, 2025 17:38
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core labels Feb 14, 2025
/// The execution settings associated with the operation.
/// </summary>
[Experimental("SKEXP0001")]
public PromptExecutionSettings? ExecutionSettings { get; init; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a separate property in AutoFunctionInvocationContext for execution settings? Can we re-use AutoFunctionInvocationContext.Arguments for such scenario? Since KernelArguments type already contains a collection of execution settings.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmytrostruk Not fully sure. Arguments today is only filled if PromptExecutionSettings was literally passed as an Argument right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RogerBarreto Yes, but that's the only way how to pass PromptExecutionSettings if you use kernel.InvokePromptAsync instead of IChatCompletionService.

Copy link
Member

@RogerBarreto RogerBarreto Feb 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmytrostruk I see, any changes to Arguments in this manner would change the behavior, could be a good thing anyways, but we would need to reconsider how Arguments will be reflected, because from this perspective if we reuse arguments for actual selected settings, would be also important to add knowledge of which of the arguments in the execution settings dictionary is the one being used by the function.

@@ -129,6 +130,7 @@ public FunctionCallsProcessor(ILogger? logger = null)
/// <returns>Last chat history message if function invocation filter requested processing termination, otherwise null.</returns>
public async Task<ChatMessageContent?> ProcessFunctionCallsAsync(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be public (is already a internal class and utility) ?

Suggested change
public async Task<ChatMessageContent?> ProcessFunctionCallsAsync(
internal async Task<ChatMessageContent?> ProcessFunctionCallsAsync(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel.core kernel Issues or pull requests impacting the core kernel needs_port_to_python Indicate this item needs to also be done for Python .NET Issue or Pull requests regarding .NET code
Projects
Status: Sprint: In Review
Development

Successfully merging this pull request may close these issues.

.Net: The original execution settings are not available in IAutoFunctionInvocationFilter
5 participants