본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

AI Custom Guardrail 플러그인 구성 참조

원문 보기 위키 갱신

AI Custom Guardrail 플러그인 구성 참조 (AI Custom Guardrail Plugin Configuration Reference)

이 문서는 Kong Gateway의 AI Custom Guardrail 플러그인에서 설정할 수 있는 모든 구성 옵션을 스키마 형태로 정리한 참조 자료예요. 요청·응답 마스킹 허용 여부, 가드레일 동작 모드(INPUT, OUTPUT, BOTH), 커스텀 메트릭, Lua 표현식 기반 파라미터, 인증 설정 같은 필드별 기본값과 설명을 한눈에 확인할 수 있어요. 플러그인 구성을 작성하거나 검토할 때 필요한 값을 빠르게 찾아보는 용도로 딱이에요

출처: 문서

본문

{
  "properties": {
    "config": {
      "properties": {
        "allow_masking": {
          "default": false,
          "description": "Allow to masking the request/response instead of blocking it. Streaming will be disabled if this is enabled.",
          "type": "boolean"
        },
        "custom_metrics": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "A list of custom metrics to be recorded.",
          "type": "object"
        },
        "functions": {
          "additionalProperties": {
            "type": "string",
            "x-lua-required": true
          },
          "description": "Custom functions to be used in expression templates.",
          "type": "object"
        },
        "guarding_mode": {
          "default": "INPUT",
          "description": "The guardrail mode to use for the request",
          "enum": [
            "BOTH",
            "INPUT",
            "OUTPUT"
          ],
          "type": "string"
        },
        "metrics": {
          "properties": {
            "block_detail": {
              "description": "Metric to indicate the detail for blocking the input.",
              "type": "string"
            },
            "block_reason": {
              "description": "Metric to indicate the reason for blocking the input.",
              "type": "string"
            },
            "masked": {
              "description": "Metric to indicate whether the input was masked.",
              "type": "string"
            }
          },
          "type": "object"
        },
        "params": {
          "additionalProperties": {
            "description": "\nThis field is [referenceable](/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).",
            "type": "string",
            "x-lua-required": true,
            "x-referenceable": true
          },
          "description": "Parameters to be used in the guardrail service request. Keys are the parameter name and values can be either Lua expressions in the form `$(some_lua_expression)`or string. For expression, it will be evaluated as the value for the corresponding key. For string, it will be attempted to be parsed as string in JSON format, otherwise it will be used as is. \nThis field is [referenceable](/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).",
          "type": "object"
        },
        "request": {
          "description": "Configuration specific to guardrail request.",
          "properties": {
            "auth": {
              "description": "Authentication configuration for HTTP request.",
              "properties": {
                "location": {
                  "default": "header",
                  "description": "Specify whether the 'param_name' and 'param_value' options go in a query string, or the POST form/JSON body.",
                  "enum": [
                    "body",
                    "header",
                    "query"
                  ],
                  "type": "string"
                },
                "name": {
                  "description": "Specify name here. \nThis field is [referenceable](/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).",
                  "type": "string",
                  "x-referenceable": true
                },
                "value": {
                  "description": "Specify the full token value for 'name'. \nThis field is [referenceable](/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault). \nThis field is [encrypted](/gateway/keyring/).",
                  "type": "string",
                  "x-encrypted": true,
                  "x-referenceable": true
                }
              },
              "type": "object"
            },
            "body": {
              "additionalProperties": {
                "description": "\nThis field is [referenceable](/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).",
                "type": "string",
                "x-referenceable": true
              },
              "description": "A map used to evaluate a JSON object. Keys are the field names in the new object, and values can be either Lua expressions in the form `$(some_lua_expression)`or string. For expression, it will be evaluated as the value for the corresponding key. For string, it will be decoded as string in JSON format or be used as is. \nThis field is [referenceable](/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).",
              "type": "object"
            },
            "headers": {
              "additionalProperties": {
                "description": "\nThis field is [referenceable](/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).",
                "type": "string",
                "x-referenceable": true
              },
              "description": "A map used to evaluate a JSON object. Keys are the field names in the new object, and values can be either Lua expressions in the form `$(some_lua_expression)`or string. For expression, it will be evaluated as the value for the corresponding key. For string, it will be decoded as string in JSON format or be used as is. \nThis field is [referenceable](/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).",
              "type": "object"
            },
            "queries": {
              "additionalProperties": {
                "description": "\nThis field is [referenceable](/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).",
                "type": "string",
                "x-referenceable": true
              },
              "description": "A map used to evaluate a JSON object. Keys are the field names in the new object, and values can be either Lua expressions in the form `$(some_lua_expression)`or string. For expression, it will be evaluated as the value for the corresponding key. For string, it will be decoded as string in JSON format or be used as is. \nThis field is [referenceable](/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).",
              "type": "object"
            },
            "url": {
              "description": "the url string or a template to generate one",
              "type": "string"
            }
          },
          "required": [
            "url"
          ],
          "type": "object"
        },
        "response": {
          "description": "Configuration specific to parse guardrail response.",
          "properties": {
            "block": {
              "description": "template or string to evaluate block field",
              "type": "string"
            },
            "block_message": {
              "description": "template or string to evaluate block_message field",
              "type": "string"
            }
          },
          "required": [
            "block",
            "block_message"
          ],
          "type": "object"
        },
        "response_buffer_size": {
          "default": 100,
          "description": "The amount of bytes receiving from upstream to be buffered before sending to the guardrail service. This only applies to the response content guard.",
          "type": "number"
        },
        "ssl_verify": {
          "default": true,
          "description": "Whether to verify SSL certificate when Kong makes request to guardrail service.",
          "type": "boolean"
        },
        "stop_on_error": {
          "default": true,
          "description": "Stop processing if an error occurs.",
          "type": "boolean"
        },
        "text_source": {
          "default": "last_message",
          "description": "Select where to pick the 'text' for the guardrail service request.",
          "enum": [
            "concatenate_all_content",
            "concatenate_user_content",
            "last_message"
          ],
          "type": "string"
        },
        "timeout": {
          "default": 10000,
          "description": "Connection timeout with the guardrail service",
          "type": "number"
        }
      },
      "required": [
        "request",
        "response"
      ],
      "type": "object"
    },
    "consumer": {
      "additionalProperties": false,
      "description": "If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to activate regardless of the authenticated Consumer.",
      "properties": {
        "id": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "consumer_group": {
      "additionalProperties": false,
      "description": "If set, the plugin will activate only for requests where the specified consumer group has been authenticated. (Note that some plugins can not be restricted to consumers groups this way.). Leave unset for the plugin to activate regardless of the authenticated Consumer Groups",
      "properties": {
        "id": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "expressions": {
      "additionalProperties": true,
      "type": "object"
    },
    "protocols": {
      "default": [
        "grpc",
        "grpcs",
        "http",
        "https"
      ],
      "description": "A set of strings representing HTTP protocols.",
      "items": {
        "enum": [
          "grpc",
          "grpcs",
          "http",
          "https"
        ],
        "type": "string"
      },
      "type": "array"
    },
    "route": {
      "additionalProperties": false,
      "description": "If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the route being used.",
      "properties": {
        "id": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "service": {
      "additionalProperties": false,
      "description": "If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched.",
      "properties": {
        "id": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "required": [
    "config"
  ]
}

관련 리소스

더 알아보기 (Learn more)