-
Notifications
You must be signed in to change notification settings - Fork 827
Add function approvals support #6745
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
Add function approvals support #6745
Conversation
@dotnet-policy-service agree company="Microsoft" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds comprehensive function approval support to the Microsoft.Extensions.AI library. The changes enable functions to require user approval before execution, providing a mechanism for human oversight of AI function calls.
- Introduces
ApprovalRequiredAIFunction
wrapper to mark functions requiring approval - Adds user input content base types and function approval request/response content types
- Updates
FunctionInvokingChatClient
to handle approval workflows for both regular and streaming scenarios
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
ApprovalRequiredAIFunction.cs |
Core wrapper class for functions requiring approval with customizable approval callback |
UserInputRequestContent.cs & UserInputResponseContent.cs |
Base types for user input request/response patterns |
FunctionApprovalRequestContent.cs & FunctionApprovalResponseContent.cs |
Specific content types for function approval workflows |
FunctionInvokingChatClient.cs |
Major updates to handle approval processing, request/response conversion, and streaming approval handling |
Test files | Comprehensive test coverage for new approval functionality including edge cases and streaming scenarios |
AssertExtensions.cs |
Refactored message comparison logic into reusable helper method |
Comments suppressed due to low confidence (2)
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs:1
- The parameter description is incomplete. It should describe what
originalMessages
contains, such as 'The list of chat messages to process for approval requests and responses.'
// Licensed to the .NET Foundation under one or more agreements.
test/Libraries/Microsoft.Extensions.AI.Tests/ChatCompletion/FunctionInvokingChatClientApprovalsTests.cs:1
- Typo in method name: 'FunctionCalsAreBuffered' should be 'FunctionCallsAreBuffered'.
// Licensed to the .NET Foundation under one or more agreements.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be aware of #6695.
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/FunctionApprovalRequestContent.cs
Show resolved
Hide resolved
9c554ac
to
ae3e24b
Compare
I'm working on this now to get this merged today... |
2fbb35d
to
6969e3e
Compare
6969e3e
to
c0d0996
Compare
Microsoft Reviewers: Open in CodeFlow