AI Semantic Cache Policy

Enable exact-match caching with a custom TTL

Configure the AI Semantic Cache policy to check for an exact match before it searches by similarity, and to keep cached entries for 10 minutes. Exact-match caching increases the size of the vector database.

Prerequisites

  • An existing AI Model.

  • An OpenAI account.

  • A Redis instance.

  • Port 6379, or your custom Redis port, is open and reachable from AI Gateway.

Environment variables

  • OPENAI_API_KEY: Your OpenAI API key

  • REDIS_HOST: The host where your Redis instance runs

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!