.Net: Add optional role parameter to 'ResponseContentPart' conversion methods#13156
.Net: Add optional role parameter to 'ResponseContentPart' conversion methods#13156HillPhelmuth wants to merge 8 commits into
Conversation
Introduce an optional `AuthorRole? role` parameter to the `ToResponseContentPart` methods in `KernelContentExtensions` . Update the `ToResponseItem` method in `ChatContentMessageExtensions` to utilize this role for determining the correct content part type (Input or Output). Modify tests in `ChatContentMessageExtensionsTests` to ensure accurate validation of content part types based on the author role.
|
@microsoft-github-policy-service agree |
|
@HillPhelmuth do you have any clue when the merge will be completed, and/or do you have a workaround for this issue perhaps? I'm currently completely blocked by this issue since I need to use the responses API but can never build up a reasonable conversation... |
I have no idea when, or even if, it will be merged. It seems that development on this project has slowed down quite a bit over the last month or two, so I don't have a good sense of when this issue and associated PR will be on the SK team's radar. Hopefully the pace picks back up after .NET 10 is released. There's a fairly straightforward work-around though. The OpenAI Responses api is designed to be stateful, so you can pass the responseId and it will use the stored history. Example is in ManageConversationStateWithResponseIdAsync() (important note: this example uses the agent thread instead of stored history, but it will work by setting |
|
The problem with your workaround is that it only works from "scratch". if you reload an agent with previous history, or with history coming from another agent to start with (which is the case in our multi agentic framework using SK), then the trick of enabling the store doesn't really work. Hope the SK guys come wit ha solution really soon or I'm going to have to implement OpenAI directly for response API... which kind of defeats the purpose of SK all together |
There was a problem hiding this comment.
Pull Request Overview
This PR addresses issue #13154 by adding role-aware content part conversion to properly differentiate between input and output text content parts based on the author role. The changes ensure that text content from assistant messages is converted to OutputText parts while other roles create InputText parts.
- Added optional
AuthorRole? roleparameter toToResponseContentPartmethods inKernelContentExtensions - Updated text content conversion logic to create
OutputTextparts for assistant role andInputTextparts for others - Modified tests to validate correct content part types based on author role
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| KernelContentExtensions.cs | Added role parameter and logic to create appropriate text content part types |
| ChatContentMessageExtensions.cs | Updated to pass author role when converting message items to response content parts |
| ChatContentMessageExtensionsTests.cs | Enhanced test validation to check for correct content part types based on role |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…ns.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@markwallace-microsoft is there something else I need to do to get this merged? The associated bug is still a problem for a few of us. |
Motivation and Context
Fix #13154
Description
Introduce an optional
AuthorRole? roleparameter to theToResponseContentPartmethods inKernelContentExtensions. Update theToResponseItemmethod inChatContentMessageExtensionsto utilize this role for determining the correct content part type (Input or Output). Modify tests inChatContentMessageExtensionsTeststo ensure accurate validation of content part types based on the author role.Contribution Checklist