-
Notifications
You must be signed in to change notification settings - Fork 33
Implementing KernelFactory interface in order to allow custom factories + Using SK function that supports external tools #64
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dd65fd2
IKernelFactory
pugafran 4928844
IKernelFactory
pugafran df20936
Implementing SK function that supports external tools
pugafran 93a6edf
Restoring .csproj
pugafran efaf412
Restoring Directory.Packages.props
pugafran a98cb7b
Replace var name
pugafran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/modules/agents/Elsa.Agents.Core/Contracts/IkernelFactory.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| using Microsoft.SemanticKernel; | ||
| namespace Elsa.Agents; | ||
|
|
||
| public interface IKernelFactory | ||
| { | ||
| Kernel CreateKernel(KernelConfig kernelConfig, AgentConfig agentConfig); | ||
| Kernel CreateKernel(KernelConfig kernelConfig, string agentName); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Out of curiosity, why is it better to explicitly handle a serialization exception and then wrapping it in an IOE?
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.
I added the explicit handling of JsonException and wrapped it in an InvalidOperationException mainly as a defensive programming measure.
Over the past few weeks, I’ve been doing a kind of reverse engineering to fully understand how the repository and the NuGet packages interact. I wanted to make sure I could trust and trace what's going on at every level while I was testing.
So this change was mostly precautionary, happy to revert or adjust it!
You probably have everything more aligned in your mind and clearly understand which parts interact and why. Since this is still 'new' to me, it's harder for me to reach those conclusions so quickly, haha. That's why I added that detail, more like a 'let me specify this for a moment, so if it breaks, I'll know what caused it.'
Uh oh!
There was an error while loading. Please reload this page.
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.
Got it, makes sense 👍🏻 Perhaps it'a not a bad practice actually, especially if we throw a custom exception to make it extra clear what's happening. In this case, it's failing to parse the agent's response as JSON, so that would be a nice message to include with a custom exception class called e.g.
FunctionCallExceptionorAgentInvocationException. If you agree, please add an exception class with a name that you think makes sense in this context. Alternatively, I'm happy to do so myself once this is merged.