mirror of https://github.com/microsoft/autogen.git
[.Net] Remove Azure.AI.OpenAI from AutoGen.DotnetInteractive package (#3274)
* remove Azure.AI.OpenAI dependencies * fix build error * revert change
This commit is contained in:
parent
3186bb7610
commit
a375d7ac38
|
@ -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>
|
||||
|
|
|
@ -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 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 : IDisposable
|
|||
writeStream.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();
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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#>
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue