diff --git a/dotnet/src/AutoGen.DotnetInteractive/AutoGen.DotnetInteractive.csproj b/dotnet/src/AutoGen.DotnetInteractive/AutoGen.DotnetInteractive.csproj
index 96b331f2df3b..5778761f05da 100644
--- a/dotnet/src/AutoGen.DotnetInteractive/AutoGen.DotnetInteractive.csproj
+++ b/dotnet/src/AutoGen.DotnetInteractive/AutoGen.DotnetInteractive.csproj
@@ -27,12 +27,9 @@
-
-
-
-
+
diff --git a/dotnet/src/AutoGen.DotnetInteractive/DotnetInteractiveFunction.cs b/dotnet/src/AutoGen.DotnetInteractive/DotnetInteractiveFunction.cs
index bb5504cd5487..c9b59203462b 100644
--- a/dotnet/src/AutoGen.DotnetInteractive/DotnetInteractiveFunction.cs
+++ b/dotnet/src/AutoGen.DotnetInteractive/DotnetInteractiveFunction.cs
@@ -2,14 +2,12 @@
// DotnetInteractiveFunction.cs
using System.Text;
-using System.Text.Json;
-using Azure.AI.OpenAI;
using Microsoft.DotNet.Interactive.Documents;
using Microsoft.DotNet.Interactive.Documents.Jupyter;
namespace AutoGen.DotnetInteractive;
-public class DotnetInteractiveFunction : IDisposable
+public partial class DotnetInteractiveFunction : IDisposable
{
private readonly InteractiveService? _interactiveService = null;
private string _notebookPath;
@@ -71,6 +69,7 @@ public DotnetInteractiveFunction(InteractiveService interactiveService, string?
/// Run existing dotnet code from message. Don't modify the code, run it as is.
///
/// code.
+ [Function]
public async Task RunCode(string code)
{
if (this._interactiveService == null)
@@ -117,6 +116,7 @@ public async Task RunCode(string code)
/// Install nuget packages.
///
/// nuget package to install.
+ [Function]
public async Task InstallNugetPackages(string[] nugetPackages)
{
if (this._interactiveService == null)
@@ -173,105 +173,6 @@ private async Task AddCellAsync(string cellContent, string kernelName)
writeStream.Dispose();
}
- private class RunCodeSchema
- {
- public string code { get; set; } = string.Empty;
- }
-
- public Task RunCodeWrapper(string arguments)
- {
- var schema = JsonSerializer.Deserialize(
- arguments,
- new JsonSerializerOptions
- {
- PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
- });
-
- return RunCode(schema!.code);
- }
-
- public FunctionDefinition RunCodeFunction
- {
- get => new FunctionDefinition
- {
- Name = @"RunCode",
- Description = """
-Run existing dotnet code from message. Don't modify the code, run it as is.
-""",
- Parameters = BinaryData.FromObjectAsJson(new
- {
- Type = "object",
- Properties = new
- {
- code = new
- {
- Type = @"string",
- Description = @"code.",
- },
- },
- Required = new[]
- {
- "code",
- },
- },
- new JsonSerializerOptions
- {
- PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
- })
- };
- }
-
- private class InstallNugetPackagesSchema
- {
- public string[] nugetPackages { get; set; } = Array.Empty();
- }
-
- public Task InstallNugetPackagesWrapper(string arguments)
- {
- var schema = JsonSerializer.Deserialize(
- arguments,
- new JsonSerializerOptions
- {
- PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
- });
-
- return InstallNugetPackages(schema!.nugetPackages);
- }
-
- public FunctionDefinition InstallNugetPackagesFunction
- {
- get => new FunctionDefinition
- {
- Name = @"InstallNugetPackages",
- Description = """
-Install nuget packages.
-""",
- Parameters = BinaryData.FromObjectAsJson(new
- {
- Type = "object",
- Properties = new
- {
- nugetPackages = new
- {
- Type = @"array",
- Items = new
- {
- Type = @"string",
- },
- Description = @"nuget package to install.",
- },
- },
- Required = new[]
- {
- "nugetPackages",
- },
- },
- new JsonSerializerOptions
- {
- PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
- })
- };
- }
public void Dispose()
{
this._interactiveService?.Dispose();
diff --git a/dotnet/src/AutoGen.SourceGenerator/Template/FunctionCallTemplate.cs b/dotnet/src/AutoGen.SourceGenerator/Template/FunctionCallTemplate.cs
index 8eeb117141d8..b90d78be3f19 100644
--- a/dotnet/src/AutoGen.SourceGenerator/Template/FunctionCallTemplate.cs
+++ b/dotnet/src/AutoGen.SourceGenerator/Template/FunctionCallTemplate.cs
@@ -36,7 +36,6 @@ public virtual string TransformText()
using System.Threading.Tasks;
using System;
using AutoGen.Core;
-using AutoGen.OpenAI.Extension;
");
if (!String.IsNullOrEmpty(NameSpace)) {
diff --git a/dotnet/src/AutoGen.SourceGenerator/Template/FunctionCallTemplate.tt b/dotnet/src/AutoGen.SourceGenerator/Template/FunctionCallTemplate.tt
index dc41f0af9d70..e7ed476fde8b 100644
--- a/dotnet/src/AutoGen.SourceGenerator/Template/FunctionCallTemplate.tt
+++ b/dotnet/src/AutoGen.SourceGenerator/Template/FunctionCallTemplate.tt
@@ -13,7 +13,6 @@ using System.Text.Json.Serialization;
using System.Threading.Tasks;
using System;
using AutoGen.Core;
-using AutoGen.OpenAI.Extension;
<#if (!String.IsNullOrEmpty(NameSpace)) {#>
namespace <#=NameSpace#>
diff --git a/dotnet/test/AutoGen.SourceGenerator.Tests/ApprovalTests/FunctionCallTemplateTests.TestFunctionCallTemplate.approved.txt b/dotnet/test/AutoGen.SourceGenerator.Tests/ApprovalTests/FunctionCallTemplateTests.TestFunctionCallTemplate.approved.txt
index f223d3124ddd..ea5a8585cc2f 100644
--- a/dotnet/test/AutoGen.SourceGenerator.Tests/ApprovalTests/FunctionCallTemplateTests.TestFunctionCallTemplate.approved.txt
+++ b/dotnet/test/AutoGen.SourceGenerator.Tests/ApprovalTests/FunctionCallTemplateTests.TestFunctionCallTemplate.approved.txt
@@ -8,7 +8,6 @@ using System.Text.Json.Serialization;
using System.Threading.Tasks;
using System;
using AutoGen.Core;
-using AutoGen.OpenAI.Extension;
namespace AutoGen.SourceGenerator.Tests
{