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

AI Azure Content Safety 정책 구성 참조

원문 보기 위키 갱신

AI Azure Content Safety 정책 구성 참조 (AI Azure Content Safety Policy Configuration Reference)

이 문서는 Kong Gateway의 AI Azure Content Safety 정책에서 사용하는 구성 옵션을 스키마 형태로 정리해 준 참조 자료예요. content_safety_key나 halt_on_blocklist_hit 같은 기본 설정부터 text_source 선택 옵션, 프록시 관련 설정까지 각 필드의 타입과 기본값, 동작 방식을 한눈에 확인할 수 있어요. 정책을 처음 설정하거나 기존 구성을 조정할 때 어떤 값을 넣어야 할지 궁금할 때마다 여기서 찾아보면 좋아요

출처: 문서

본문

{
  "properties": {
    "config": {
      "type": "object",
      "properties": {
        "content_safety_key": {
          "type": "string",
          "description": "If `azure_use_managed_identity` is true, set the API key to call Content Safety.",
          "x-referenceable": true,
          "x-encrypted": true
        },
        "halt_on_blocklist_hit": {
          "type": "boolean",
          "description": "Tells Azure to reject the request if any blocklist filter is hit.",
          "default": true
        },
        "text_source": {
          "type": "string",
          "enum": [
            "concatenate_all_content",
            "concatenate_user_content",
            "last_message"
          ],
          "description": "Select where to pick the 'text' for the guardrail service request.",
          "default": "concatenate_all_content"
        },
        "proxy_config": {
          "type": "object",
          "properties": {
            "http_proxy_port": {
              "type": "integer",
              "maximum": 65535,
              "minimum": 0,
              "description": "An integer representing a port number between 0 and 65535, inclusive."
            },
            "https_proxy_host": {
              "type": "string",
              "description": "A string representing a host name, such as example.com."
            },
            "https_proxy_port": {
              "type": "integer",
              "maximum": 65535,
              "minimum": 0,
              "description": "An integer representing a port number between 0 and 65535, inclusive."
            },
            "proxy_scheme": {
              "type": "string",
              "enum": [
                "http"
              ],
              "description": "The proxy scheme to use when connecting. Only `http` is supported.",
              "default": "http"
            },
            "auth_username": {
              "type": "string",
              "description": "The username to authenticate with, if the forward proxy is protected by basic authentication.",
              "x-referenceable": true
            },
            "auth_password": {
              "type": "string",
              "description": "The password to authenticate with, if the forward proxy is protected by basic authentication.",
              "x-referenceable": true,
              "x-encrypted": true
            },
            "no_proxy": {
              "type": "string",
              "description": "Comma-separated list of hosts that should not be proxied."
            },
            "http_proxy_host": {
              "type": "string",
              "description": "A string representing a host name, such as example.com."
            }
          }
        },
        "content_safety_url": {
          "type": "string",
          "description": "Full URL, inc protocol, of the Azure Content Safety instance.",
          "x-referenceable": true
        },
        "azure_use_managed_identity": {
          "type": "boolean",
          "description": "If checked, uses (if set) `azure_client_id`, `azure_client_secret`, and/or `azure_tenant_id` for Azure authentication, via Managed or User-assigned identity",
          "default": false
        },
        "azure_client_id": {
          "type": "string",
          "description": "If `azure_use_managed_identity` is true, set the client ID if required."
        },
        "azure_tenant_id": {
          "type": "string",
          "description": "If `azure_use_managed_identity` is true, set the tenant ID if required."
        },
        "ssl_verify": {
          "type": "boolean",
          "description": "Whether to verify the SSL certificate of the guardrail service endpoint.",
          "default": true
        },
        "continue_on_detection": {
          "type": "boolean",
          "description": "If true, the guardrail will not block the request or response. Block data and details will still be visible via kong logs. You can expect this field to work coherently with `guarding_mode` parameter.",
          "default": false
        },
        "azure_client_secret": {
          "type": "string",
          "description": "If `azure_use_managed_identity` is true, set the client secret if required.",
          "x-encrypted": true
        },
        "categories": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "rejection_level": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "rejection_level"
            ]
          },
          "description": "Array of categories, and their thresholds, to measure on."
        },
        "output_type": {
          "type": "string",
          "enum": [
            "EightSeverityLevels",
            "FourSeverityLevels"
          ],
          "description": "See https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/content-filter#content-filtering-categories",
          "default": "FourSeverityLevels"
        },
        "stop_on_error": {
          "type": "boolean",
          "description": "Stop processing if an error occurs.",
          "default": true
        },
        "log_blocked_content": {
          "type": "boolean",
          "description": "Whether to log prompts and responses that are blocked by the guardrail.",
          "default": false
        },
        "azure_api_version": {
          "type": "string",
          "minLength": 1,
          "description": "Sets the ?api-version URL parameter, used for defining the Azure Content Services interchange format.",
          "default": "2023-10-01"
        },
        "reveal_failure_reason": {
          "type": "boolean",
          "description": "Set true to tell the caller why their request was rejected, if so.",
          "default": true
        },
        "blocklist_names": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Use these configured blocklists (in Azure Content Services) when inspecting content."
        },
        "guarding_mode": {
          "type": "string",
          "enum": [
            "BOTH",
            "INPUT",
            "OUTPUT"
          ],
          "description": "The guardrail mode to use for the request.",
          "default": "INPUT"
        },
        "response_buffer_size": {
          "type": "number",
          "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.",
          "default": 100
        },
        "rejection_mode": {
          "type": "string",
          "enum": [
            "none",
            "stealth",
            "verbose"
          ],
          "description": "Controls block response format and status code. 'none' returns 400 with plain text block reason, 'stealth' 403 without details and 'verbose' returns 403 with rich JSON details. In streaming mode, the final SSE chunk includes finish_reason='blocked_by_guard' and 'verbose' will include a 'guardrail_result' metadata entry under 'data.choices[0]' in OpenAI format.",
          "default": "none"
        }
      },
      "required": [
        "content_safety_url"
      ]
    }
  }
}

더 알아보기 (Learn more)

이 문서에는 원문에서 추출한 별도의 관련 문서 링크가 없어요.