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: New Feature: KernelAgent - Update the Template property #9186

Closed
mickaelropars opened this issue Oct 9, 2024 · 2 comments · Fixed by #9236
Closed

.Net: New Feature: KernelAgent - Update the Template property #9186

mickaelropars opened this issue Oct 9, 2024 · 2 comments · Fixed by #9236
Assignees
Labels
agents .NET Issue or Pull requests regarding .NET code

Comments

@mickaelropars
Copy link


name: Feature request
in kernelAgent class the Template property is protected

/// <summary>
// A prompt-template based on the agent instructions.
/// </summary>
protected IPromptTemplate? Template { get; set; }

it can be usefull to render the template of an agent . in order to see that the prompt is well formated.

Is it possible to change the visibility of Template in KernelAgent?


@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Oct 9, 2024
@github-actions github-actions bot changed the title New Feature: KernelAgent - Update the Template property .Net: New Feature: KernelAgent - Update the Template property Oct 9, 2024
@crickman
Copy link
Contributor

@mickaelropars - Thanks for this input. Exposing the get accessor as public seems reasonable. I need to double check that side-effects aren't introduced. In the meantime, you might be able to utilize kernel prompt filters to intercept the runtime rendering:

https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/Filtering/PromptRenderFiltering.cs

@crickman crickman moved this to Sprint: In Progress in Semantic Kernel Oct 11, 2024
@crickman crickman moved this from Sprint: In Progress to Sprint: In Review in Semantic Kernel Oct 11, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 11, 2024
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

Fixes: #9072
Fixes: #9186

### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

The channel-key definition resulted in a hash that resulted in every
`AggregtorAgent` sharing the same channel. This overlap in chat
management interfere's with the desired isolation.

Also including a change to the scope of `KernelAgent.Template` property
to that its exposed to the caller (customer request)

### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->

- [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
- [X] I didn't break anyone 😄
@github-project-automation github-project-automation bot moved this from Sprint: In Review to Sprint: Done in Semantic Kernel Oct 11, 2024
@mickaelropars
Copy link
Author

@crickman , thanks a lot for your advice I will implement the prompt render filtering to get the content of the rendered prompt within our logs.

The template visibility change will help me when creating an agent to display prompt rendering when building the template (custom user agent creation) . Currently waiting for the unsealed agent class in order to build it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agents .NET Issue or Pull requests regarding .NET code
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants