Skip to content

Commit

Permalink
.Net Agents - Identify assistant code-interpreter response with metad…
Browse files Browse the repository at this point in the history
…ata (#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 😄
  • Loading branch information
crickman authored Aug 5, 2024
1 parent 8a32fca commit dbc1851
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions dotnet/src/Agents/OpenAI/AssistantThreadActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ private static ChatMessageContent GenerateCodeInterpreterContent(string agentNam
])
{
AuthorName = agentName,
Metadata = new Dictionary<string, object?> { { OpenAIAssistantAgent.CodeInterpreterMetadataKey, true } },
};
}

Expand Down
7 changes: 6 additions & 1 deletion dotnet/src/Agents/OpenAI/OpenAIAssistantAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ namespace Microsoft.SemanticKernel.Agents.OpenAI;
/// <summary>
/// A <see cref="KernelAgent"/> specialization based on Open AI Assistant / GPT.
/// </summary>
public sealed partial class OpenAIAssistantAgent : KernelAgent
public sealed class OpenAIAssistantAgent : KernelAgent
{
/// <summary>
/// Metadata key that identifies code-interpreter content.
/// </summary>
public const string CodeInterpreterMetadataKey = "code";

private readonly Assistant _assistant;
private readonly AssistantsClient _client;
private readonly OpenAIAssistantConfiguration _config;
Expand Down

0 comments on commit dbc1851

Please sign in to comment.