AI 시맨틱 프롬프트 가드 정책 구성 레퍼런스
AI 시맨틱 프롬프트 가드 정책 구성 레퍼런스 (AI Semantic Prompt Guard)
이 문서는 AI Gateway의 AI Semantic Prompt Guard 정책에서 설정할 수 있는 구성 옵션을 스키마 형태로 정리한 레퍼런스예요. 요청의 생성 AI 카테고리를 지정하는 genai_category, 탐지 후 요청을 막지 않고 계속 진행할지 정하는 continue_on_detection, 거부 응답 형식과 상태 코드를 제어하는 rejection_mode 같은 핵심 필드의 설명과 기본값을 확인할 수 있어요. 임베딩 관련 인증 설정도 함께 다루고 있어서 정책을 실제로 구성하거나 튜닝할 때 어떤 옵션을 어떤 값으로 넣어야 할지 빠르게 찾아보기 좋아요
출처: 문서
본문
{
"properties": {
"config": {
"type": "object",
"properties": {
"genai_category": {
"type": "string",
"enum": [
"audio/speech",
"audio/transcription",
"image/generation",
"realtime/generation",
"text/embeddings",
"text/generation"
],
"description": "Generative AI category of the request",
"default": "text/generation"
},
"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
},
"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"
},
"embeddings": {
"type": "object",
"properties": {
"auth": {
"type": "object",
"properties": {
"header_name": {
"type": "string",
"description": "If AI model requires authentication via Authorization or API key header, specify its name here.",
"x-referenceable": true
},
"azure_use_managed_identity": {
"type": "boolean",
"description": "Set true to use the Azure Cloud Managed Identity (or user-assigned identity) to authenticate with Azure-provider models.",
"default": false
},
"gcp_oauth_token_url": {
"type": "string",
"description": "Custom OAuth token URL for GCP authentication. Useful for restricted network environments or custom GCP endpoints. If null, Kong will use the default Google OAuth token endpoint.",
"x-referenceable": true
},
"gcp_metadata_url": {
"type": "string",
"description": "Custom metadata URL for GCP authentication. Useful for restricted network environments or custom GCP endpoints. If null, Kong will use the default Google metadata endpoint.",
"x-referenceable": true
},
"aws_access_key_id": {
"type": "string",
"description": "Set this if you are using an AWS provider (Bedrock) and you are authenticating using static IAM User credentials. Setting this will override the AWS_ACCESS_KEY_ID environment variable for this policy instance.",
"x-encrypted": true,
"x-referenceable": true
},
"aws_secret_access_key": {
"type": "string",
"description": "Set this if you are using an AWS provider (Bedrock) and you are authenticating using static IAM User credentials. Setting this will override the AWS_SECRET_ACCESS_KEY environment variable for this policy instance.",
"x-referenceable": true,
"x-encrypted": true
},
"aws_session_token": {
"type": "string",
"description": "Set this if you are using an AWS provider (Bedrock) and you are authenticating using temporary IAM credentials (for example issued by AWS STS, Vault, or SSO/SAML). It is sent to AWS as the X-Amz-Security-Token header. Setting this will override the AWS_SESSION_TOKEN environment variable for this policy instance. Because temporary credentials are short-lived, reference this from a secrets backend so it is refreshed before it expires.",
"x-referenceable": true,
"x-encrypted": true
},
"allow_override": {
"type": "boolean",
"description": "If enabled, the authorization header or parameter can be overridden in the request by the value configured in the policy.",
"default": false
},
"param_name": {
"type": "string",
"description": "If AI model requires authentication via query parameter, specify its name here.",
"x-referenceable": true
},
"param_value": {
"type": "string",
"description": "Specify the full parameter value for 'param_name'.",
"x-encrypted": true,
"x-referenceable": true
},
"azure_client_id": {
"type": "string",
"description": "If azure_use_managed_identity is set to true, and you need to use a different user-assigned identity for this LLM instance, set the client ID.",
"x-referenceable": true
},
"azure_client_secret": {
"type": "string",
"description": "If azure_use_managed_identity is set to true, and you need to use a different user-assigned identity for this LLM instance, set the client secret.",
"x-referenceable": true,
"x-encrypted": true
},
"gcp_use_service_account": {
"type": "boolean",
"description": "Use service account auth for GCP-based providers and models.",
"default": false
},
"gcp_workload_identity_federation_source": {
"type": "string",
"enum": [
"aws_iam",
"off"
],
"description": "Set this if you are using an GCP provider (Gemini) and you are authenticating using Workload Identity Federation. This is the source identity provider/system."
},
"gcp_workload_identity_federation_auth_json": {
"type": "string",
"description": "Set this if you are using an GCP provider (Gemini) and you are authenticating using Workload Identity Federation. This is the JSON string configuration for the federation operation. If unset, Kong will attempt to read the file path from the `GOOGLE_APPLICATION_CREDENTIALS` environment variable, which should subsequently point to a Workfload Identity auth JSON file.",
"x-referenceable": true,
"x-encrypted": true
},
"header_value": {
"type": "string",
"description": "Specify the full auth header value for 'header_name', for example 'Bearer key' or just 'key'.",
"x-referenceable": true,
"x-encrypted": true
},
"param_location": {
"type": "string",
"enum": [
"body",
"query"
],
"description": "Specify whether the 'param_name' and 'param_value' options go in a query string, or the POST form/JSON body."
},
"azure_tenant_id": {
"type": "string",
"description": "If azure_use_managed_identity is set to true, and you need to use a different user-assigned identity for this LLM instance, set the tenant ID.",
"x-referenceable": true
},
"gcp_service_account_json": {
"type": "string",
"description": "Set this field to the full JSON of the GCP service account to authenticate, if required. If null (and gcp_use_service_account is true), Kong will attempt to read from environment variable `GCP_SERVICE_ACCOUNT`.",
"x-referenceable": true,
"x-encrypted": true
}
}
},
"model": {
"type": "object",
"properties": {
"provider": {
"type": "string",
"enum": [
"azure",
"bedrock",
"databricks",
"gemini",
"huggingface",
"mistral",
"ollama",
"openai",
"vercel"
],
"description": "AI provider format to use for embeddings API"
},
"name": {
"type": "string",
"description": "Model name to execute."
},
"options": {
"type": "object",
"properties": {
"bedrock": {
"type": "object",
"properties": {
"aws_region": {
"type": "string",
"description": "If using AWS providers (Bedrock) you can override the `AWS_REGION` environment variable by setting this option."
},
"aws_assume_role_arn": {
"type": "string",
"description": "If using AWS providers (Bedrock) you can assume a different role after authentication with the current IAM context is successful."
},
"embeddings_normalize": {
"type": "boolean",
"description": "If using AWS providers (Bedrock), set to true to normalize the embeddings.",
"default": false
},
"batch_bucket_prefix": {
"type": "string",
"description": "S3 URI prefix (s3://bucket/prefix/) where Bedrock will get input files from and store results to for native batch API."
},
"batch_role_arn": {
"type": "string",
"description": "AWS role arn used for calling batch API. Try to get the value from request if ommited."
},
"aws_role_session_name": {
"type": "string",
"description": "If using AWS providers (Bedrock), set the identifier of the assumed role session."
},
"aws_sts_endpoint_url": {
"type": "string",
"description": "If using AWS providers (Bedrock), override the STS endpoint URL when assuming a different role."
},
"performance_config_latency": {
"type": "string",
"description": "Force the client's performance configuration 'latency' for all requests. Leave empty to let the consumer select the performance configuration."
},
"video_output_s3_uri": {
"type": "string",
"description": "S3 URI (s3://bucket/prefix) where Bedrock will store generated video files. Required for video generation."
}
}
},
"gemini": {
"type": "object",
"properties": {
"api_endpoint": {
"type": "string",
"description": "If running Gemini on Vertex, specify the regional API endpoint (hostname only)."
},
"project_id": {
"type": "string",
"description": "If running Gemini on Vertex, specify the project ID."
},
"location_id": {
"type": "string",
"description": "If running Gemini on Vertex, specify the location ID."
}
}
},
"huggingface": {
"type": "object",
"properties": {
"use_cache": {
"type": "boolean",
"description": "Use the cache layer on the inference API"
},
"wait_for_model": {
"type": "boolean",
"description": "Wait for the model if it is not ready"
}
}
},
"databricks": {
"type": "object",
"properties": {
"workspace_instance_id": {
"type": "string",
"description": "Workspace Instance ID ('dbc-xxx-yyy') for Databricks model serving."
}
}
},
"upstream_url": {
"type": "string",
"description": "upstream url for the embeddings"
},
"azure": {
"type": "object",
"properties": {
"instance": {
"type": "string",
"description": "Instance name for Azure OpenAI hosted models."
},
"api_version": {
"type": "string",
"description": "'api-version' for Azure OpenAI instances.",
"default": "2023-05-15"
},
"deployment_id": {
"type": "string",
"description": "Deployment ID for Azure OpenAI instances."
}
}
}
},
"description": "Key/value settings for the model"
}
},
"required": [
"name",
"provider"
]
}
},
"required": [
"model"
]
},
"vectordb": {
"type": "object",
"properties": {
"strategy": {
"type": "string",
"enum": [
"pgvector",
"redis"
],
"description": "which vector database driver to use"
},
"dimensions": {
"type": "integer",
"description": "the desired dimensionality for the vectors"
},
"threshold": {
"type": "number",
"description": "the default similarity threshold for accepting semantic search results (float). Higher threshold means more results are considered similar."
},
"distance_metric": {
"type": "string",
"enum": [
"cosine",
"euclidean"
],
"description": "the distance metric to use for vector searches"
},
"redis": {
"type": "object",
"properties": {
"cluster_nodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ip": {
"type": "string",
"description": "A string representing a host name, such as example.com.",
"default": "127.0.0.1"
},
"port": {
"type": "integer",
"maximum": 65535,
"minimum": 0,
"description": "An integer representing a port number between 0 and 65535, inclusive.",
"default": 6379
}
}
},
"minLength": 1,
"description": "Cluster addresses to use for Redis connections when the `redis` strategy is defined. Defining this field implies using a Redis Cluster. The minimum length of the array is 1 element."
},
"server_name": {
"type": "string",
"description": "A string representing an SNI (server name indication) value for TLS.",
"x-referenceable": true
},
"cluster_max_redirections": {
"type": "integer",
"description": "Maximum retry attempts for redirection.",
"default": 5
},
"connect_timeout": {
"type": "integer",
"maximum": 2147483646,
"minimum": 0,
"description": "An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.",
"default": 2000
},
"read_timeout": {
"type": "integer",
"maximum": 2147483646,
"minimum": 0,
"description": "An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.",
"default": 2000
},
"password": {
"type": "string",
"description": "Password to use for Redis connections. If undefined, no AUTH commands are sent to Redis.",
"x-referenceable": true,
"x-encrypted": true
},
"sentinel_username": {
"type": "string",
"description": "Sentinel username to authenticate with a Redis Sentinel instance. If undefined, ACL authentication won't be performed. This requires Redis v6.2.0+.",
"x-referenceable": true
},
"sentinel_password": {
"type": "string",
"description": "Sentinel password to authenticate with a Redis Sentinel instance. If undefined, no AUTH commands are sent to Redis Sentinels.",
"x-referenceable": true,
"x-encrypted": true
},
"database": {
"type": "integer",
"description": "Database to use for the Redis connection when using the `redis` strategy",
"default": 0
},
"keepalive_pool_size": {
"type": "integer",
"maximum": 2147483646,
"minimum": 1,
"description": "The size limit for every cosocket connection pool associated with every remote server, per worker process. If neither `keepalive_pool_size` nor `keepalive_backlog` is specified, no pool is created. If `keepalive_pool_size` isn't specified but `keepalive_backlog` is specified, then the pool uses the default value. Try to increase (e.g. 512) this value if latency is high or throughput is low.",
"default": 256
},
"sentinel_role": {
"type": "string",
"enum": [
"any",
"master",
"slave"
],
"description": "Sentinel role to use for Redis connections when the `redis` strategy is defined. Defining this value implies using Redis Sentinel."
},
"host": {
"type": "string",
"description": "A string representing a host name, such as example.com.",
"default": "127.0.0.1",
"x-referenceable": true
},
"keepalive_backlog": {
"type": "integer",
"maximum": 2147483646,
"minimum": 0,
"description": "Limits the total number of opened connections for a pool. If the connection pool is full, connection queues above the limit go into the backlog queue. If the backlog queue is full, subsequent connect operations fail and return `nil`. Queued operations (subject to set timeouts) resume once the number of connections in the pool is less than `keepalive_pool_size`. If latency is high or throughput is low, try increasing this value. Empirically, this value is larger than `keepalive_pool_size`."
},
"sentinel_nodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"host": {
"type": "string",
"description": "A string representing a host name, such as example.com.",
"default": "127.0.0.1"
},
"port": {
"type": "integer",
"maximum": 65535,
"minimum": 0,
"description": "An integer representing a port number between 0 and 65535, inclusive.",
"default": 6379
}
}
},
"minLength": 1,
"description": "Sentinel node addresses to use for Redis connections when the `redis` strategy is defined. Defining this field implies using a Redis Sentinel. The minimum length of the array is 1 element."
},
"ssl": {
"type": "boolean",
"description": "If set to true, uses SSL to connect to Redis.",
"default": false
},
"connection_is_proxied": {
"type": "boolean",
"description": "If the connection to Redis is proxied (e.g. Envoy), set it `true`. Set the `host` and `port` to point to the proxy address.",
"default": false
},
"username": {
"type": "string",
"description": "Username to use for Redis connections. If undefined, ACL authentication won't be performed. This requires Redis v6.0.0+. To be compatible with Redis v5.x.y, you can set it to `default`.",
"x-referenceable": true
},
"cloud_authentication": {
"type": "object",
"properties": {
"azure_tenant_id": {
"type": "string",
"description": "Azure Tenant ID to be used for authentication when `auth_provider` is set to `azure`.",
"x-encrypted": true,
"x-referenceable": true
},
"aws_is_serverless": {
"type": "boolean",
"description": "This flag specifies whether the cluster is serverless when auth_provider is set to `aws`.",
"default": true
},
"aws_access_key_id": {
"type": "string",
"description": "AWS Access Key ID to be used for authentication when `auth_provider` is set to `aws`.",
"x-referenceable": true,
"x-encrypted": true
},
"aws_secret_access_key": {
"type": "string",
"description": "AWS Secret Access Key to be used for authentication when `auth_provider` is set to `aws`.",
"x-referenceable": true,
"x-encrypted": true
},
"aws_assume_role_arn": {
"type": "string",
"description": "The ARN of the IAM role to assume for generating ElastiCache IAM authentication tokens.",
"x-referenceable": true,
"x-encrypted": true
},
"aws_role_session_name": {
"type": "string",
"description": "The session name for the temporary credentials when assuming the IAM role.",
"x-referenceable": true,
"x-encrypted": true
},
"azure_client_id": {
"type": "string",
"description": "Azure Client ID to be used for authentication when `auth_provider` is set to `azure`.",
"x-referenceable": true,
"x-encrypted": true
},
"azure_client_secret": {
"type": "string",
"description": "Azure Client Secret to be used for authentication when `auth_provider` is set to `azure`.",
"x-referenceable": true,
"x-encrypted": true
},
"auth_provider": {
"type": "string",
"enum": [
"aws",
"azure",
"gcp"
],
"description": "Auth providers to be used to authenticate to a Cloud Provider's Redis instance.",
"x-referenceable": true
},
"aws_cache_name": {
"type": "string",
"description": "The name of the AWS Elasticache cluster when `auth_provider` is set to `aws`.",
"x-referenceable": true
},
"aws_region": {
"type": "string",
"description": "The region of the AWS ElastiCache cluster when `auth_provider` is set to `aws`.",
"x-referenceable": true
},
"gcp_service_account_json": {
"type": "string",
"description": "GCP Service Account JSON to be used for authentication when `auth_provider` is set to `gcp`.",
"x-referenceable": true,
"x-encrypted": true
}
},
"description": "Cloud auth related configs for connecting to a Cloud Provider's Redis instance."
},
"ssl_verify": {
"type": "boolean",
"description": "If set to true, verifies the validity of the server SSL certificate. If setting this parameter, also configure `lua_ssl_trusted_certificate` in `kong.conf` to specify the CA (or server) certificate used by your Redis server. You may also need to configure `lua_ssl_verify_depth` accordingly.",
"default": true
},
"port": {
"type": "integer",
"maximum": 65535,
"minimum": 0,
"description": "An integer representing a port number between 0 and 65535, inclusive.",
"default": 6379,
"x-referenceable": true
},
"send_timeout": {
"type": "integer",
"maximum": 2147483646,
"minimum": 0,
"description": "An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.",
"default": 2000
},
"sentinel_master": {
"type": "string",
"description": "Sentinel master to use for Redis connections. Defining this value implies using Redis Sentinel."
}
}
},
"pgvector": {
"type": "object",
"properties": {
"database": {
"type": "string",
"description": "the database of the pgvector database",
"default": "kong-pgvector"
},
"ssl_version": {
"type": "string",
"enum": [
"any",
"tlsv1_2",
"tlsv1_3"
],
"description": "the ssl version to use for the pgvector database",
"default": "tlsv1_2"
},
"ssl_cert": {
"type": "string",
"description": "the path of ssl cert to use for the pgvector database"
},
"ssl_cert_key": {
"type": "string",
"description": "the path of ssl cert key to use for the pgvector database"
},
"host": {
"type": "string",
"description": "the host of the pgvector database",
"default": "127.0.0.1"
},
"port": {
"type": "integer",
"description": "the port of the pgvector database",
"default": 5432
},
"user": {
"type": "string",
"description": "the user of the pgvector database",
"default": "postgres",
"x-referenceable": true
},
"password": {
"type": "string",
"description": "the password of the pgvector database",
"x-referenceable": true,
"x-encrypted": true
},
"timeout": {
"type": "number",
"description": "the timeout of the pgvector database",
"default": 5000
},
"ssl": {
"type": "boolean",
"description": "whether to use ssl for the pgvector database",
"default": false
},
"ssl_required": {
"type": "boolean",
"description": "whether ssl is required for the pgvector database",
"default": false
},
"ssl_verify": {
"type": "boolean",
"description": "whether to verify ssl for the pgvector database",
"default": true
}
}
}
},
"required": [
"dimensions",
"distance_metric",
"strategy"
]
},
"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."
}
}
},
"search": {
"type": "object",
"properties": {
"threshold": {
"type": "number",
"description": "Threshold for the similarity score to be considered a match.",
"default": 0.5
}
}
},
"rules": {
"type": "object",
"properties": {
"match_all_conversation_history": {
"type": "boolean",
"description": "If false, will ignore all previous chat prompts from the conversation history.",
"default": false
},
"allow_prompts": {
"type": "array",
"items": {
"type": "string",
"maxLength": 500,
"minLength": 1
},
"maxLength": 100,
"description": "List of prompts to allow."
},
"deny_prompts": {
"type": "array",
"items": {
"type": "string",
"maxLength": 500,
"minLength": 1
},
"maxLength": 100,
"description": "List of prompts to deny."
},
"match_all_roles": {
"type": "boolean",
"description": "If true, will match all roles in addition to 'user' role in conversation history.",
"default": false
}
}
}
},
"required": [
"embeddings",
"vectordb"
]
}
}
}
번역할 문서 내용이 아직 도착하지 않았어요. 메시지에 Kong 문서 조각이 포함되어 있지 않네요.
번역할 마크다운 원문을 붙여넣어 주세요. 받는 즉시 규칙에 따라—산문만 해요체로 번역하고, 코드 블록 자리표([[CODE_n]]), 인라인 코드, 식별자, 링크 URL, 마크다운 구조는 그대로 유지한 채—전체를 번역해 드릴게요.
관련 리소스
더 알아보기 (Learn more)
- 프롬프트 가드 정책의 개념과 전체적인 사용 방법을 먼저 익히고 싶을 때 참고해요 — AI Prompt Guard AI Policy
- 임베딩 기반 유사도 매칭이 AI Gateway 정책에서 어떻게 동작하는지 이해할 수 있어요 — Embedding-based similarity matching in AI Gateway AI Policies
- 이 정책과 함께 자주 언급되는 시맨틱 캐시 정책의 구성도 살펴봐요 — AI Semantic Cache AI Policy
- 정책 설정에서 참조되는 AI 모델 엔티티를 구성하고 관리하는 방법을 확인해요 — AI Model
- AI Gateway를 처음 접하는 분이라면 시작 가이드부터 훑어보는 것도 좋아요 — Get started with AI Gateway