mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.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>
This commit is contained in:
committed by
GitHub
Unverified
parent
01fd74a80c
commit
fef4fd2c18
+35
@@ -0,0 +1,35 @@
|
||||
// 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;
|
||||
}
|
||||
Reference in New Issue
Block a user