Check Model Request • AI Agent SDK
check_model_request: Raise :class:`ModelRequestBlocked` if real model requests are blocked.
check_model_request
Function
</div>
This function is defined in the guard module.
Raise :class:ModelRequestBlocked if real model requests are blocked.
Call this immediately before handing a request to a provider. When requests are allowed (the default) it is a single global read.
Signature
def check_model_request(model: Optional[str], provider: Optional[str]) -> NoneParameters
ParamField
Optional[str]Model id the request names, used in the error message.
ParamField
Optional[str]Short label for the request path being guarded, e.g. `"litellm.completion" or "openai.chat.completions"`.
Exceptions
ModelRequestBlocked
If requests are currently blocked.
Uses
ModelRequestBlocked
Source
View on GitHubpraisonaiagents/model_harness/guard.py at line 196