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] Streaming support in IAgent, support for streaming middleware plus pulling out pretty-print, user-input and function-call as middleware for easier testing #1656

Merged
merged 11 commits into from
Feb 28, 2024

Conversation

LittleLittleCloud
Copy link
Collaborator

@LittleLittleCloud LittleLittleCloud commented Feb 13, 2024

Why are these changes needed?

This PR contains the following changes to the middleware pattern in AutoGen.Net

  • Streaming support for IAgent. Agent can implement IStreamingAgent to declare itself as streaming-support. One example for IStreamingAgent is GPTAgent. (Plus test coverage)
  • create IMiddleware and IStreamingMiddleware interfaces. These two interfaces will be the abstraction layer of all middlewares inside AutoGen.Net. The experience of registering middleware through lambda is reserved via DelegateMiddleware (for IMiddleware) and DelegateStreamingMiddleware (for IStreamingMiddleware)
  • extract pretty print, user input and function call into separate middleware component so that it's eaiser to add test coverage plus consuming by external user.

For example, with HumanInputMiddleware, it's possible to turn any IAgent into a user proxy

IAgent gpt, assistant;
var humanInputMiddleware = new HumanInputMiddleware();
agent = agent.RegisterMiddleware(humanInputMiddleware);

await gpt.SendAsync(assistant, "hello");

// Please give feedback: Press enter or type 'exit' to stop the conversation.
// ...user input

Related issue number

Checks

@LittleLittleCloud LittleLittleCloud added the dotnet issues related to AutoGen.Net label Feb 13, 2024
@LittleLittleCloud LittleLittleCloud changed the title [.Net] Pull out UserInput and FunctionCall into individual middleware and adding support for streaming middleware [.Net] Streaming support in IAgent, support for streaming middleware plus pulling out pretty-print, user-input and function-call as middleware for testable and sharable experience Feb 13, 2024
@LittleLittleCloud LittleLittleCloud changed the title [.Net] Streaming support in IAgent, support for streaming middleware plus pulling out pretty-print, user-input and function-call as middleware for testable and sharable experience [.Net] Streaming support in IAgent, support for streaming middleware plus pulling out pretty-print, user-input and function-call as middleware for easier testing Feb 21, 2024
@LittleLittleCloud LittleLittleCloud merged commit c28b0cc into dotnet Feb 28, 2024
8 checks passed
@LittleLittleCloud LittleLittleCloud deleted the u/xiaoyun/dotnet/middleware branch May 2, 2024 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet issues related to AutoGen.Net
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants