-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Conversation
️✅ 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. 🦉 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. |
34a3d7c
to
88b7ae4
Compare
0e31f5d
to
8ea942c
Compare
* update * update * fix comment
Why are these changes needed?
This PR creates a more clear and easy-to-follow pattern between the
non-streaming
andstreaming
api.For
non-streaming
, we have the following definitionIAgent
: agent interfaceIMiddleware
: middleware interface that extends an agent's behaviorMiddlewareAgent
andMiddlewareAgent<TAgent>
: A built-in agent that implementsIAgent
and work with middlewareAnd corresponding
streaming
is below. Note thatIStreamingAgent
is also anIAgent
andIStreamingMiddleware
is also anIMiddleware
.IStreamingAgent
:IAgent
+ streaming apiIStreamingMiddleware
:IMiddleware
+ streaming apiStreamingMiddlewareAgent
andStreamingMiddlewareAgent<TAgent>
:MiddlewareAgent
|MiddlewareAgent<TAgent>
+ streaming api, which implementsIStreamingAgent
And below is the relationship table around
middleware
,agent
andMiddlewareAgent
register
MiddlewareAgent<IAgent>
MiddlewareAgent<IStreamingAgent>
MiddlewareAgent<IAgent>
MiddlewareStreamingAgent<IStreamingAgent>
Here's a bit explanation:
IAgent
+IMiddleware
:MiddlewareAgent<Agent>
IStreamingAgent
+IStreamingMiddleware
:StreamingMiddlewareAgent<StreamingAgent>
IAgent
+IStreamingMiddleware
: This will be equivalent toIAgent
+IMiddleware
whereIStreamingMiddleware
be converted toIMiddleware
IStreamingAgent
+IMiddleware
: This will be equivalent toIAgent
+IMiddleware
whereIStreamingAgent
be converted toIAgent
Note
Only
IStreamingAgent
+IStreamingMiddleware
combination results toIStreamingAgent
. For all other combination, the new agent will beIAgent
and doesn't support streamingRelated issue number
IStreamingAgent
andIStreamingMiddleware
from Task<IAsyncEnumerable<T>> to IAsyncEnumerable<T> #2470Checks