AI Semantic Prompt Guard

AI License Required

Allow and deny messages using Valkeyv3.14+

Allow messages about a topic as long as they don’t contain information about another topic.

For example, only allow questions about DevOps that aren’t related to exploiting vulnerabilities. Topics on the deny list take precedence over the allowed topics.

Valkey is automatically detected when using the redis vectordb strategy. Kong Gateway queries the server and uses the Valkey-specific driver when it detects a Valkey backend.

For a detailed walkthrough, see Use AI Semantic Prompt Guard plugin to govern your LLM traffic.

If you use the text-embedding-ada-002 as an embedding model, you must set a fixed dimension of 1536, as required by the official model specification. Alternatively, use the text-embedding-3-small model, which supports dynamic dimensions and works without specifying a fixed value.

Prerequisites

Environment variables

  • OPENAI_API_KEY: Your OpenAI API key

  • VALKEY_HOST: The host where your Valkey instance runs

Set up the plugin

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!