Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[.Net][Feature Request]: Consume SK Plugins in Agent #2593

Closed
1 of 2 tasks
LittleLittleCloud opened this issue May 5, 2024 · 0 comments
Closed
1 of 2 tasks

[.Net][Feature Request]: Consume SK Plugins in Agent #2593

LittleLittleCloud opened this issue May 5, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@LittleLittleCloud
Copy link
Collaborator

LittleLittleCloud commented May 5, 2024

Is your feature request related to a problem? Please describe.

semantic kernel allows user to use plugins to extend the ability of llm. In the meantime, semantic kernel also provides a lot of built-in plugins, like OpenAPI or BingSearch. It would greatly extend the ability of agents if those plugins can also be used in agent, in the similar way of tool call.

Describe the solution you'd like

We can provide a middleware in AutoGen.SemanticKernel to consume plugins

var getWeatherMethod = kernel.CreateFunctionFromMethod((string location) => $"The weather in {location} is sunny.", functionName: "GetWeather", description: "Get the weather for a location.");
        var createPersonObjectMethod = kernel.CreateFunctionFromMethod((string name, string email, int age) => new Person(name, email, age), functionName: "CreatePersonObject", description: "Creates a person object.");
var plugin = kernel.ImportPluginFromFunctions("plugin", [getWeatherMethod, createPersonObjectMethod]);
var kernelFunctionMiddleware = new KernelPluginMiddleware(kernel, plugin);

var agent = new OpenAIChatAgent(openaiClient, "assistant", modelName: "gpt-35-turbo-16k")
            .RegisterMessageConnector()
            .RegisterMiddleware(kernelFunctionMiddleware);

var reply = await agent.SendAsync("what's the weather in Seattle?");
reply.GetContent().Should().Be("The weather in Seattle is sunny.");

Additional context

No response

Tasks

  1. LittleLittleCloud
@LittleLittleCloud LittleLittleCloud added the enhancement New feature or request label May 5, 2024
@LittleLittleCloud LittleLittleCloud changed the title [.Net][Feature Request]: Consume SK functions in IAgent [.Net][Feature Request]: Consume SK Plugins in Agent May 5, 2024
@LittleLittleCloud LittleLittleCloud self-assigned this May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant