Skip to content

Commit dbc1851

Browse files
authored
.Net Agents - Identify assistant code-interpreter response with metadata (#7882)
### 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. --> ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Align with same pattern introduced in Python: #7854 In response to customer input: #7601 ### 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 😄
1 parent 8a32fca commit dbc1851

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

dotnet/src/Agents/OpenAI/AssistantThreadActions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ private static ChatMessageContent GenerateCodeInterpreterContent(string agentNam
408408
])
409409
{
410410
AuthorName = agentName,
411+
Metadata = new Dictionary<string, object?> { { OpenAIAssistantAgent.CodeInterpreterMetadataKey, true } },
411412
};
412413
}
413414

dotnet/src/Agents/OpenAI/OpenAIAssistantAgent.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ namespace Microsoft.SemanticKernel.Agents.OpenAI;
1818
/// <summary>
1919
/// A <see cref="KernelAgent"/> specialization based on Open AI Assistant / GPT.
2020
/// </summary>
21-
public sealed partial class OpenAIAssistantAgent : KernelAgent
21+
public sealed class OpenAIAssistantAgent : KernelAgent
2222
{
23+
/// <summary>
24+
/// Metadata key that identifies code-interpreter content.
25+
/// </summary>
26+
public const string CodeInterpreterMetadataKey = "code";
27+
2328
private readonly Assistant _assistant;
2429
private readonly AssistantsClient _client;
2530
private readonly OpenAIAssistantConfiguration _config;

0 commit comments

Comments
 (0)