A programming framework for agentic AI
[.Net] Remove Azure.AI.OpenAI from AutoGen.DotnetInteractive package (#3274)
Xiaoyun Zhanga375d7ac38dd
diff --git a/dotnet/src/AutoGen.DotnetInteractive/AutoGen.DotnetInteractive.csproj b/dotnet/src/AutoGen.DotnetInteractive/AutoGen.DotnetInteractive.csprojindex 96b331f2d..5778761f0 100644--- a/dotnet/src/AutoGen.DotnetInteractive/AutoGen.DotnetInteractive.csproj+++ b/dotnet/src/AutoGen.DotnetInteractive/AutoGen.DotnetInteractive.csproj@@ -27,12 +27,9 @@<EmbeddedResource Include="RestoreInteractive.config" /></ItemGroup>- <ItemGroup>- <PackageReference Include="Azure.AI.OpenAI" Version="$(AzureOpenAIVersion)" />- </ItemGroup>-<ItemGroup><ProjectReference Include="..\AutoGen.Core\AutoGen.Core.csproj" />+ <ProjectReference Include="..\AutoGen.SourceGenerator\AutoGen.SourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" /></ItemGroup></Project>diff --git a/dotnet/src/AutoGen.DotnetInteractive/DotnetInteractiveFunction.cs b/dotnet/src/AutoGen.DotnetInteractive/DotnetInteractiveFunction.csindex bb5504cd5..c9b592034 100644--- a/dotnet/src/AutoGen.DotnetInteractive/DotnetInteractiveFunction.cs+++ b/dotnet/src/AutoGen.DotnetInteractive/DotnetInteractiveFunction.cs@@ -2,14 +2,12 @@// DotnetInteractiveFunction.csusing 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 class DotnetInteractiveFunction : IDisposable/// Run existing dotnet code from message. Don't modify the code, run it as is./// </summary>/// <param name="code">code.</param>+ [Function]public async Task<string> RunCode(string code){if (this._interactiveService == null)@@ -117,6 +116,7 @@ public class DotnetInteractiveFunction : IDisposable/// Install nuget packages./// </summary>/// <param name="nugetPackages">nuget package to install.</param>+ [Function]public async Task<string> InstallNugetPackages(string[] nugetPackages){if (this._interactiveService == null)@@ -173,105 +173,6 @@ public class DotnetInteractiveFunction : IDisposablewriteStream.Dispose();}- private class RunCodeSchema- {- public string code { get; set; } = string.Empty;- }-- public Task<string> RunCodeWrapper(string arguments)- {- var schema = JsonSerializer.Deserialize<RunCodeSchema>(- 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<string>();- }-- public Task<string> InstallNugetPackagesWrapper(string arguments)- {- var schema = JsonSerializer.Deserialize<InstallNugetPackagesSchema>(- 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.csindex 8eeb11714..b90d78be3 100644--- a/dotnet/src/AutoGen.SourceGenerator/Template/FunctionCallTemplate.cs+++ b/dotnet/src/AutoGen.SourceGenerator/Template/FunctionCallTemplate.cs@@ -36,7 +36,6 @@ using System.Text.Json.Serialization;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.ttindex dc41f0af9..e7ed476fd 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.txtindex f223d3124..ea5a8585c 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{