Skip to main content

no_model_requests

Function
This function is defined in the guard module.
Block real model requests for the duration of the with block. Composes with a suite-wide :func:allow_model_requests call and with other no_model_requests blocks. Rather than saving and restoring the global flag — which lets an inner or cross-thread scope exiting first re-enable requests while an outer scope is still open — this increments a block counter, so requests stay blocked until every open scope has exited:: with no_model_requests(): agent.start(“hello”) # raises ModelRequestBlocked

Signature

Returns

Iterator[None]
The result of the operation.

Source

View on GitHub

praisonaiagents/model_harness/guard.py at line 140