Skip to main content

LLMGuardRuntime

A runtime that evaluates the risk level of functions using a language model. Parameters:
  • prompt (str): The prompt to use for the language model. (default: :obj:GUARDPROMPT)
  • model (BaseModelBackend): The language model to use. (default: :obj: None)
  • verbose (bool): Whether to print verbose output. (default: :obj: False)

init

add

Add a function or list of functions to the runtime. Parameters:
  • funcs (FunctionTool or List[FunctionTool]): The function or list of functions to add.
  • threshold (int): The risk threshold for functions. (default: :obj:2)
Returns: LLMGuardRuntime: The current runtime.

cleanup

No-op; LLMGuardRuntime does not hold external resources.

reset

Resets the runtime to its initial state.