Skip to content

Semantic Functions with Microsoft.Extensions.AI #9825

Answered by stephentoub
mhagrelius asked this question in Q&A
Discussion options

You must be logged in to vote

The distinction between "semantic functions" and "native functions" is antiquated. In both cases, you're just running some code; it just happens in the former case that the code you're running is hardcoded to perform a particular action.

As you've discovered, you can use any KernelFunction, regardless of how it was created or what operation it invokes, as an AIFunction via the AsAIFunction method. You could also create your own wrapper, e.g. AIFunctionFactory.Create(() => kernelFunction.InvokeAsync(...), ...). In all of these cases, there's just a delegate being invoked.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mhagrelius
Comment options

Answer selected by evchaki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants