Files
agent-framework/dotnet/samples/GettingStarted/External/MEAI.Abstractions/NewHostedCodeInterpreterTool.cs
T
Roger Barreto fef4fd2c18 .Net: Update Code Interpreter Sample as a Step. (#148)
* Updating code interpreter samples

* Small adjustments to ensure it works as expected

* Update dotnet/samples/GettingStarted/Steps/Step03_ChatClientAgent_UsingCodeInterpreterTools.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Address xmldoc

* Addressing PR coment, external implementaions + ChatClients update, removing RawRepresentationFactory requirement

* Address warnings

* Update Fix warnings

* Proposed changes for the OpenAIAssistantChatClient

* Address PR comments

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
2025-07-10 15:26:41 +00:00

36 lines
1.5 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Extensions.AI;
namespace OpenAI.Assistants;
/// <summary>
/// Proposal for abstraction updates based on the common code interpreter tool properties.
/// Based on the decision, the <see cref="HostedCodeInterpreterTool"/> abstraction can be updated in M.E.AI directly.
/// </summary>
public class NewHostedCodeInterpreterTool : HostedCodeInterpreterTool
{
// Usage of an internal dictionary is temporary and only used here because the MEAI.Abstractions does not have this specialization yet and the
// ChatClients must rely on the AdditionalProperties to check and set correctly the Code Interpreter Resource avoiding a customized RawRepresentationFactory implementation.
private readonly Dictionary<string, object?> _additionalProperties = [];
/// <summary>Gets or sets the list of file IDs that the code interpreter tool can access.</summary>
public IList<string> FileIds
{
get
{
// Only create the property in the dictionary when it is actually used
if (!this._additionalProperties.TryGetValue("fileIds", out var value) || value is null)
{
value = new List<string>();
this._additionalProperties["fileIds"] = value;
}
return (IList<string>)value;
}
}
/// <inheritdoc/>
public override IReadOnlyDictionary<string, object?> AdditionalProperties => this._additionalProperties;
}