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] refactor over streaming version api #2461

Merged
merged 4 commits into from
May 5, 2024
Merged

[.Net] refactor over streaming version api #2461

merged 4 commits into from
May 5, 2024

Conversation

LittleLittleCloud
Copy link
Collaborator

@LittleLittleCloud LittleLittleCloud commented Apr 20, 2024

Why are these changes needed?

This PR creates a more clear and easy-to-follow pattern between the non-streaming and streaming api.

For non-streaming, we have the following definition

  • IAgent: agent interface
  • IMiddleware: middleware interface that extends an agent's behavior
  • MiddlewareAgent and MiddlewareAgent<TAgent>: A built-in agent that implements IAgent and work with middleware

And corresponding streaming is below. Note that IStreamingAgent is also an IAgent and IStreamingMiddleware is also an IMiddleware.

  • IStreamingAgent: IAgent + streaming api
  • IStreamingMiddleware: IMiddleware + streaming api
  • StreamingMiddlewareAgent and StreamingMiddlewareAgent<TAgent>: MiddlewareAgent | MiddlewareAgent<TAgent> + streaming api, which implements IStreamingAgent

And below is the relationship table around middleware, agent and MiddlewareAgent

register IAgent IStreamingAgent
IMiddleware MiddlewareAgent<IAgent> MiddlewareAgent<IStreamingAgent>
IStreamingMiddleware MiddlewareAgent<IAgent> MiddlewareStreamingAgent<IStreamingAgent>

Here's a bit explanation:

  • IAgent + IMiddleware: MiddlewareAgent<Agent>
  • IStreamingAgent + IStreamingMiddleware: StreamingMiddlewareAgent<StreamingAgent>
  • IAgent + IStreamingMiddleware: This will be equivalent to IAgent + IMiddleware where IStreamingMiddleware be converted to IMiddleware
  • IStreamingAgent + IMiddleware: This will be equivalent to IAgent + IMiddleware where IStreamingAgent be converted to IAgent

Note

Only IStreamingAgent + IStreamingMiddleware combination results to IStreamingAgent. For all other combination, the new agent will be IAgent and doesn't support streaming

Related issue number

Checks

@LittleLittleCloud LittleLittleCloud changed the base branch from main to dotnet April 20, 2024 07:18
@LittleLittleCloud LittleLittleCloud changed the base branch from dotnet to main April 26, 2024 16:38
Copy link

gitguardian bot commented Apr 26, 2024

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
Once a secret has been leaked into a git repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@LittleLittleCloud LittleLittleCloud changed the base branch from main to dotnet April 26, 2024 16:39
@LittleLittleCloud LittleLittleCloud changed the base branch from dotnet to main April 28, 2024 18:24
@LittleLittleCloud LittleLittleCloud marked this pull request as ready for review April 30, 2024 18:45
@sonichi sonichi added this pull request to the merge queue May 5, 2024
Merged via the queue into main with commit e878be5 May 5, 2024
21 checks passed
@sonichi sonichi deleted the u/xiaoyun/0419 branch May 5, 2024 14:54
jayralencar pushed a commit to jayralencar/autogen that referenced this pull request May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants