RAG injection with OpenAI and Redisv3.10+

Configure the AI RAG Injector plugin to inject content to use Redis as vector database and the OpenAI text-embedding-3-large model for embedding.

Prerequisites

Environment variables

  • OPENAI_API_KEY: The API key to use to connect to OpenAI.

  • REDIS_HOST: The Redis server’s host

Set up the plugin

Add this section to your declarative configuration file:

_format_version: "3.0"
plugins:
  - name: ai-rag-injector
    config:
      inject_template: |
        Only use the following information surrounded by <RAG></RAG>to and your existing knowledge to provide the best possible answer to the user.
        <RAG><CONTEXT></RAG>
        User's question: <PROMPT>
      embeddings:
        auth:
          header_name: Authorization
          header_value: Bearer ${{ env "DECK_OPENAI_API_KEY" }}
        model:
          provider: openai
          name: text-embedding-3-large
      vectordb:
        strategy: redis
        redis:
          host: ${{ env "DECK_REDIS_HOST" }}
          port: 6379
        distance_metric: cosine
        dimensions: 76
Copied to clipboard!

Did this doc help?

Something wrong?

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!