AI Gateway Enterprise: This plugin is only available as part of our AI Gateway Enterprise offering.
The AI Semantic Prompt Guard plugin extends the AI Prompt Guard plugin by allowing you to permit or block prompts based on a list of similar prompts, helping to prevent misuse of llm/v1/chat or llm/v1/completions requests.
You can use a combination of allow and deny rules to maintain integrity and compliance when serving an LLM service using Kong AI Gateway.
If any deny prompts are set and the request matches a prompt in the deny list, the caller receives a 400 response.
If any allow prompts are set, but the request matches none of the allowed prompts, the caller also receives a 400 response.
If any allow prompts are set and the request matches one of the allow prompts, the request passes through to the LLM.
If there are both deny and allow prompts set, the deny condition takes precedence over allow. Any request that matches a prompt in the deny list will return a 400 response, even if it also matches a prompt in the allow list. If the request doesn’t match a prompt in the deny list, then it must match a prompt in the allow list to be passed through to the LLM.
A vector database can be used to store vector embeddings, or numerical representations, of data items. For example, a response would be converted to a numerical representation and stored in the vector database so that it can compare new requests against the stored vectors to find relevant cached items.
The AI Semantic Prompt Guard plugin supports the following vector databases:
Using config.vectordb.strategy: redis and parameters in config.vectordb.redis:
Starting in Kong Gateway 3.13, you can authenticate with a cloud Redis provider for your Redis strategy. This allows you to seamlessly rotate credentials without relying on static passwords.
The following providers are supported:
AWS ElastiCache
Azure Managed Redis
Google Cloud Memorystore (with or without Valkey)
Each provider also supports an instance and cluster configuration.
Important: Kong Gateway open source plugins do not support any Redis cloud provider cluster configurations.
To configure cloud authentication with Redis, add the following parameters to your plugin configuration:
You need:
A running Redis instance on an AWS ElastiCache instance for Valkey 7.2 or later or ElastiCache for Redis OSS version 7.0 or later
Yes, the AI Semantic Prompt Guard plugin supports multilingual input—depending on the capabilities of the configured embedding model. The plugin sends raw UTF-8 text to the embedding provider supported by AI Gateway (such as Azure, Bedrock, Gemini, Hugging Face, Mistral, or OpenAI). As long as the model supports multiple languages, semantic comparisons and rule enforcement will work as expected without requiring additional plugin configuration.
failed to create memorydb instance failed to create index: LIMIT Number of indexes (11) exceeds the limit (10)
Copied!
This means that the hardcoded MemoryDB instance limit has been reached.
To resolve this, create more MemoryDB instances to handle multiple AI Semantic Prompt Guard plugin instances.