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: Adding IKernel property the SKContext - Phase 1 #2846
.Net: Adding IKernel property the SKContext - Phase 1 #2846
Conversation
@RogerBarreto I would like to understand the rationale behind the change a little better. Did we have a technical discussion? If not, let's have one. |
dotnet/samples/KernelSyntaxExamples/Example05_InlineFunctionDefinition.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/KernelSyntaxExamples/Example07_BingAndGoogleSkills.cs
Outdated
Show resolved
Hide resolved
dotnet/src/SemanticKernel.Abstractions/Orchestration/SKContext.cs
Outdated
Show resolved
Hide resolved
dotnet/src/SemanticKernel.Abstractions/Orchestration/SKContext.cs
Outdated
Show resolved
Hide resolved
dotnet/src/SemanticKernel.Abstractions/Orchestration/SKContext.cs
Outdated
Show resolved
Hide resolved
…into features/skcontext-kernel
…nto features/skcontext-kernel
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.
LGTM
@@ -93,7 +92,7 @@ public LanguageCalculatorPlugin(IKernel kernel) | |||
|
|||
try | |||
{ | |||
answer = await this._mathTranslator.InvokeAsync(input).ConfigureAwait(false); | |||
answer = await context.Kernel.RunAsync(input).ConfigureAwait(false); |
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.
Whoops, I think this was wrong @RogerBarreto
### Motivation and Context⚠️ Breaking Change Adding Kernel instance as part of the SKContext enable functions to interact with other services available in the kernel from within the functions, including the ability to call other Functions using the same Kernel "context" as described in microsoft#2825 This will also allow Kernel.RunAsync to execute and trigger events (Resolves Partially microsoft#2324) seamlessly when running plans, plans steps and rendering prompts from templates (template engine) without resorting to implement those events for Plans and Template Engine separately. This change is also a step forward in making IKernel.RunAsync the main way to Invoke functions. ### Description This first step is only adding Kernel as a required SKContext property, PS: Other changes will start to harnessing the SKContext.Kernel reference to call Steps and Prompt rendering (thru prompt template engine) moving forward. ### Contribution Checklist - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
Motivation and Context
Adding Kernel instance as part of the SKContext enable functions to interact with other services available in the kernel from within the functions, including the ability to call other Functions using the same Kernel "context" as described in #2825
This will also allow Kernel.RunAsync to execute and trigger events (Resolves Partially #2324) seamlessly when running plans, plans steps and rendering prompts from templates (template engine) without resorting to implement those events for Plans and Template Engine separately.
This change is also a step forward in making IKernel.RunAsync the main way to Invoke functions.
Description
This first step is only adding Kernel as a required SKContext property,
PS: Other changes will start to harnessing the SKContext.Kernel reference to call Steps and Prompt rendering (thru prompt template engine) moving forward.
Contribution Checklist