AI Semantic Response Guard Policy

Allow and deny using pgvector as a vector database

The AI Semantic Response Guard policy analyzes the full response from an LLM service and filters it based on semantic similarity to configured allow or deny patterns.

Deny rules take precedence over allow rules. Responses matching a deny pattern are blocked, even if they also match an allow pattern. Responses not matching any allow pattern are blocked when allow rules are set.

Prerequisites

Environment variables

  • OPENAI_API_KEY: Your OpenAI API key

  • PGVECTOR_HOST: The host where your pgvector-enabled PostgreSQL instance runs

  • PGVECTOR_USER: Database user for pgvector

  • PGVECTOR_PASSWORD: Database password for pgvector

Set up the policy

Attach the policy

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!