The AI Semantic Prompt Guard configuration takes two arrays of objects: one for allow
prompts, and
one for deny
prompts, which it uses to determine which prompts are permitted or blocked.
Prerequisites
- Create a service and a route
- Start a Redis instance in your environment
You can now create the AI Semantic Prompt Guard plugin at the global, service, or route level, using the following examples.
Examples
The following examples show how to configure allow and deny prompts, and the expected behavior when making requests.
Allow only
For example, to allow only message related to the topic Kong, configure the allow_prompt
like this:
allow_prompts:
- "Anything about Kong"
Deny only
To deny any questions related to Microsoft, you can configure the following prompt:
deny_prompts:
- "Tell me something about Microsoft"
Allow and deny
To allow only questions about Kong that are not related to AWS, you can configure the following prompts:
allow_prompts:
- "Questions about Kong"
deny_prompts:
- "Anything related to AWS"