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: Expose underlying method from kernel function #11378

Merged
merged 14 commits into from
Apr 7, 2025

Conversation

SergeyMenshykh
Copy link
Member

Motivation, Context and Description

Currently, there is no way to access the underlying method that an instance of KernelFunctionFromMethod was created from or wraps. Being able to access this underlying method is useful when additional metadata is needed. For example, if the method has a custom attribute, you may need to retrieve that attribute to determine the execution path.

This PR adopts the same approach as M.E.AI by exposing the native method through the public MethodInfo? UnderlyingMethod {...} property. This property is null by default and is only initialized for native functions represented by the KernelFunctionFromMethod class.

Closes: #11182

@SergeyMenshykh SergeyMenshykh requested a review from a team as a code owner April 4, 2025 12:53
@SergeyMenshykh SergeyMenshykh self-assigned this Apr 4, 2025
@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 Apr 4, 2025
@SergeyMenshykh SergeyMenshykh added function_calling and removed kernel Issues or pull requests impacting the core kernel kernel.core labels Apr 4, 2025
@markwallace-microsoft markwallace-microsoft added kernel Issues or pull requests impacting the core kernel kernel.core labels Apr 4, 2025
SergeyMenshykh and others added 2 commits April 4, 2025 14:07
…n.cs

Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
@SergeyMenshykh SergeyMenshykh enabled auto-merge April 4, 2025 14:18
@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue Apr 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 7, 2025
@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue Apr 7, 2025
Merged via the queue into microsoft:main with commit 3ec6d01 Apr 7, 2025
20 checks passed
@SergeyMenshykh SergeyMenshykh deleted the expose-native-method branch April 7, 2025 10:49
@github-project-automation github-project-automation bot moved this from Sprint: In Review to Sprint: Done in Semantic Kernel Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
function_calling kernel.core kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
Status: Sprint: Done
Development

Successfully merging this pull request may close these issues.

.Net: New Feature: Define Additional Metadata of native plugin function via data annotations
3 participants