The AI Prompt Guard Policy lets you configure a series of PCRE-compatible regular expressions as allow or deny lists, to guard against misuse of text completion requests.
You can use this AI Policy to allow or block specific prompts, words, phrases, or otherwise have more control over how an LLM model is used when called via AI Gateway.
It does this by scanning all chat messages where the role is user for the specific expressions set.
You can use a combination of allow and deny rules to preserve integrity and compliance when serving an LLM model using AI Gateway.
-
For
llm/v1/chattype models: You can optionally configure the Policy to ignore existing chat history, wherein it will only scan the trailingusermessage. -
For
llm/v1/completionstype models: There is only onepromptfield, thus the whole prompt is scanned on every request.