Execute Model Call • AI Agent SDK
execute_model_call: Execute a model call with all hooks and middleware.
execute_model_call
Method
</div>
This is a method of the MiddlewareManager class in the middleware module.
Execute a model call with all hooks and middleware.
Order:
- before_model hooks (in order)
- wrap_model_call middleware chain
- actual model call
- after_model hooks (in reverse order)
Signature
def execute_model_call(request: ModelRequest, model_fn: Callable[[ModelRequest], ModelResponse]) -> ModelResponseParameters
ParamField
ModelRequestNo description available.
ParamField
CallableNo description available.
Returns
ResponseField
ModelResponseThe result of the operation.
Uses
model_fnrun_before_modelrun_after_modelexecute
Source
View on GitHubpraisonaiagents/hooks/middleware.py at line 469