mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: [BREAKING] Renamed next middleware parameter to call_next (#3735)
* Renamed next middleware parameter to call_next * Resolved comments
This commit is contained in:
committed by
GitHub
Unverified
parent
977c3adfb2
commit
e4ca3e60f8
@@ -57,7 +57,7 @@ class MiddlewareContainer:
|
||||
async def call_counter_middleware(
|
||||
self,
|
||||
context: FunctionInvocationContext,
|
||||
next: Callable[[FunctionInvocationContext], Awaitable[None]],
|
||||
call_next: Callable[[FunctionInvocationContext], Awaitable[None]],
|
||||
) -> None:
|
||||
"""First middleware: increments call count in shared state."""
|
||||
# Increment the shared call count
|
||||
@@ -66,18 +66,18 @@ class MiddlewareContainer:
|
||||
print(f"[CallCounter] This is function call #{self.call_count}")
|
||||
|
||||
# Call the next middleware/function
|
||||
await next(context)
|
||||
await call_next(context)
|
||||
|
||||
async def result_enhancer_middleware(
|
||||
self,
|
||||
context: FunctionInvocationContext,
|
||||
next: Callable[[FunctionInvocationContext], Awaitable[None]],
|
||||
call_next: Callable[[FunctionInvocationContext], Awaitable[None]],
|
||||
) -> None:
|
||||
"""Second middleware: uses shared call count to enhance function results."""
|
||||
print(f"[ResultEnhancer] Current total calls so far: {self.call_count}")
|
||||
|
||||
# Call the next middleware/function
|
||||
await next(context)
|
||||
await call_next(context)
|
||||
|
||||
# After function execution, enhance the result using shared state
|
||||
if context.result:
|
||||
|
||||
Reference in New Issue
Block a user