From ce25bf505e936a3ff5a5b0100ab23a6f86005cab Mon Sep 17 00:00:00 2001 From: Angel Date: Mon, 19 Aug 2024 15:30:22 -0400 Subject: [PATCH 01/11] semantic prompt guard plugin bones --- .../ai-semantic-prompt-guard/_changelog.md | 5 +++++ .../_metadata/_index.yml | 21 ++++++++++++++++++ .../overview/_index.md | 5 +++++ .../ai-semantic-prompt-guard/versions.yml | 3 +++ .../hub/kong-inc_ai-semantic-prompt-guard.png | Bin 0 -> 13171 bytes 5 files changed, 34 insertions(+) create mode 100644 app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md create mode 100644 app/_hub/kong-inc/ai-semantic-prompt-guard/_metadata/_index.yml create mode 100644 app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md create mode 100644 app/_hub/kong-inc/ai-semantic-prompt-guard/versions.yml create mode 100644 app/assets/images/icons/hub/kong-inc_ai-semantic-prompt-guard.png diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md new file mode 100644 index 000000000000..946f14199e68 --- /dev/null +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md @@ -0,0 +1,5 @@ +## Changelog + +### {{site.base_gateway}} 3.8.0.0 + +* Introduced the new **AI-Semantic-Guard** plugin. \ No newline at end of file diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/_metadata/_index.yml b/app/_hub/kong-inc/ai-semantic-prompt-guard/_metadata/_index.yml new file mode 100644 index 000000000000..3e0cb3e4b366 --- /dev/null +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/_metadata/_index.yml @@ -0,0 +1,21 @@ +name: AI Semantic Prompt Guard +search_aliases: + - ai + - llm + - artificial + - intelligence + - language + - model + - semantic +dbless_compatible: yes +free: true +enterprise: true +paid: true +konnect: false +network_config_opts: All +notes: -- +categories: + - ai +publisher: Kong Inc. +desc: Semantically and intelligently create allow and deny lists of topics that can be requested across every LLM. +type: plugin \ No newline at end of file diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md new file mode 100644 index 000000000000..3545aa532ca2 --- /dev/null +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md @@ -0,0 +1,5 @@ +--- +nav_title: Overview +--- + +The Semantic Guard Plugin \ No newline at end of file diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/versions.yml b/app/_hub/kong-inc/ai-semantic-prompt-guard/versions.yml new file mode 100644 index 000000000000..629ede91a3f1 --- /dev/null +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/versions.yml @@ -0,0 +1,3 @@ +strategy: gateway +releases: + minimum_version: '3.8.x' \ No newline at end of file diff --git a/app/assets/images/icons/hub/kong-inc_ai-semantic-prompt-guard.png b/app/assets/images/icons/hub/kong-inc_ai-semantic-prompt-guard.png new file mode 100644 index 0000000000000000000000000000000000000000..fefa08648ae062bb14db0283cd178584f4161290 GIT binary patch literal 13171 zcmV-(GmOlMP)b4A9WfP~H=XH0ZI|G9xO=p&8{+P#6OUXxoIQw-*P4+Zr1i z+c5@kjU?5zwX1X;7YGBZ3}6)$6viE5n}D%Rc(9?ZrR7Dqgse!y5~H&>bPF9`4+9NQ zP?$Jqq|W`K&x7x_w6ruL3uHu+I5`aQEkLPK3KJXD$sf*!ENPRZvSu1fjyn`N6mkv% zcN}kR`7Y8#$|Paw(bW@rG?~321ZjeX0R@E|K%?J-3)7J*o>V?mQ!{;8C=z*r4wpee zA-7Q;GsN`;B_;iRJ>9RTa>1x1kzOkUPtjp56cq9UL2@)*R#03FBFamneRxEYRMpg8 zM_SZoc~b?2{KKkLh%zimSjEzTO;7|;$ZxD7)vIG9)hnstURzt+5RQRukOn9yOaf>I zE^KQ{9)Q%6olKV??A=mO$Ytn4Jj%i$*?U7sQaPpeb|?v=FzH~FM`HMSvUdj9B+R6k zE)8`Bg~^D9!lL2>eZAe=oF@lJ5@OQrP*9k}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^k~xkd!%1U5`{d15ZidCK{pSw0qblm zNjf8{TD(I3zFY=Le0UL&R3>kt+!kNFlY7In% zyn?aWK9VHSqk)GrRk?J-pa7ySQ&JQZ@&%fK4e?|Ck5w+(Z9oQy5J`H-vlUV#QOFkv zG}@{bBOYh5kYC@kqGHeH5PZz=>76!HWQlN1?3 zlB7Mns;2e@QlC~qL1D6h)GS@Yh3zdZjf3AxnkpZQ1h3+Ykm~)FG*QTL=!WO2WCUR( zB?-HPnN_LUCx-HDDdaGOjvLyKell#<$*_~Im{sH!zEBzR3V97O)Q=r&d3dCcj5srq z*(Hf0vY(ixpfKTJh;JWnYq?{zkELWxl-JfaXgXdX)-^yuA?G35HN&{d8C4$%o>V@> zuHk^MdV>(L0;1J4wJBov-sS)R002ovPDHLkV1mS1KV<*_ literal 0 HcmV?d00001 From b2461a7866cd8b2d720317b775b854a588521053 Mon Sep 17 00:00:00 2001 From: Lucie Milan Date: Mon, 2 Sep 2024 17:10:43 +0200 Subject: [PATCH 02/11] added some content to overview and how-to --- .../ai-semantic-prompt-guard/_changelog.md | 2 +- .../ai-semantic-prompt-guard/how-to/_index.md | 17 +++++++++++++ .../overview/_index.md | 25 ++++++++++++++++++- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md index 946f14199e68..b438de87d33f 100644 --- a/app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md @@ -2,4 +2,4 @@ ### {{site.base_gateway}} 3.8.0.0 -* Introduced the new **AI-Semantic-Guard** plugin. \ No newline at end of file +* Introduced the new **AI Semantic Prompt Guard** plugin. \ No newline at end of file diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md new file mode 100644 index 000000000000..1a16e59c58d5 --- /dev/null +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md @@ -0,0 +1,17 @@ +--- +nav_title: Using the AI Semantic Prompt Guard plugin +title: Using the AI Semantic Prompt Guard plugin +--- + +The AI Semantic Prompt Guard configuration takes two arrays of objects: one for `allow` prompts, and +one for `deny` prompts. + +## Prerequisites + +First, as in the [AI Proxy](/hub/kong-inc/ai-proxy/) documentation, create a service, route, and `ai-proxy` plugin +that will serve as your LLM access point. + +You can now create the AI Semantic Prompt Guard plugin at the global, service, or route level, using the following examples. + +## Examples + diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md index 3545aa532ca2..eb181b3e60b8 100644 --- a/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md @@ -2,4 +2,27 @@ nav_title: Overview --- -The Semantic Guard Plugin \ No newline at end of file +The AI Semantic Prompt Guard plugin is an enhancement of the AI Prompt Guard plugin; it lets you to allow or block prompts based on a list of similar prompts, to guard against misuse of `llm/v1/chat` or `llm/v1/completions` requests. + +It does this by scanning all chat messages for the specific expressions set. + +You can use a combination of `allow` and `deny` rules to preserve integrity and compliance when serving an LLM service using {{site.base_gateway}}. + +{:.note} +> This plugin extends the functionality of the [AI Proxy plugin](/hub/kong-inc/ai-proxy/), and requires AI Proxy to be configured first. +Check out the [AI Gateway quickstart](/gateway/latest/get-started/ai-gateway/) to get an AI proxy up and running within minutes! + +## How it works + + + +## Get started with the AI Prompt Guard plugin + +* [AI Gateway quickstart: Set up AI Proxy](/gateway/latest/get-started/ai-gateway/) +* [Configuration reference](/hub/kong-inc/ai-semantic-prompt-guard/configuration/) +* [Basic configuration example](/hub/kong-inc/ai-semantic-prompt-guard/how-to/basic-example/) +* [Learn how to use the plugin](/hub/kong-inc/ai-semantic-prompt-guard/how-to/) + +### All AI Gateway plugins + +{% include_cached /md/ai-plugins-links.md release=page.release %} From 8845c80fa612031eaae9049d03fbc00f5e7b07e9 Mon Sep 17 00:00:00 2001 From: Lucie Milan Date: Tue, 3 Sep 2024 18:16:02 +0200 Subject: [PATCH 03/11] submodules updates --- app/_src/.repos/kong-plugins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/_src/.repos/kong-plugins b/app/_src/.repos/kong-plugins index 0e370387e44d..f627877bed31 160000 --- a/app/_src/.repos/kong-plugins +++ b/app/_src/.repos/kong-plugins @@ -1 +1 @@ -Subproject commit 0e370387e44d7a5570925f532a2f2ce77301b79c +Subproject commit f627877bed31fb126cf8d519c235e1cd5675056d From e771bbf28b70f156c4d728998d034d6753bfda47 Mon Sep 17 00:00:00 2001 From: Angel Date: Mon, 19 Aug 2024 15:30:22 -0400 Subject: [PATCH 04/11] semantic prompt guard plugin bones --- app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md index b438de87d33f..2896441b8039 100644 --- a/app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/_changelog.md @@ -2,4 +2,4 @@ ### {{site.base_gateway}} 3.8.0.0 -* Introduced the new **AI Semantic Prompt Guard** plugin. \ No newline at end of file +* Introduced the new **AI Semantic Prompt Guard** plugin. From a4a72d6f7fcb2fd07a46c9c6c52ab79394136242 Mon Sep 17 00:00:00 2001 From: Lucie Milan Date: Wed, 4 Sep 2024 15:39:13 +0200 Subject: [PATCH 05/11] added content for "how it works" and examples --- .../ai-semantic-prompt-guard/how-to/_index.md | 159 ++++++++++++++++++ .../overview/_index.md | 6 + 2 files changed, 165 insertions(+) diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md index 1a16e59c58d5..18004f53ebbc 100644 --- a/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md @@ -15,3 +15,162 @@ You can now create the AI Semantic Prompt Guard plugin at the global, service, o ## Examples +The following examples show how to configure allow and deny prompts, and the expected behavior when making requests. + +### Allow only + +To allow only message related to Kong, you can configure the following prompt: + +```yaml +allow_prompts: +- "Anything about Kong" +``` + +{% navtabs %} + +{% navtab Valid %} +```json +{ + "messages": [ + { + "role": "system", + "content": "You are an IT specialist." + }, + { + "role": "user", + "content": "What does Kong do?" + } + ] +} +``` +{% endnavtab %} + +{% navtab Invalid %} +```json +{ + "messages": [ + { + "role": "system", + "content": "You are an IT specialist." + }, + { + "role": "user", + "content": "What is GitHub?" + } + ] +} +``` +{% endnavtab %} + +{% endnavtabs %} + +### Deny only + +To deny any questions related to Microsoft, you can configure the following prompt: + +```yaml +deny_prompts: +- "Tell me something about Microsoft" +``` + +{% navtabs %} + +{% navtab Valid %} +```json +{ + "messages": [ + { + "role": "system", + "content": "You are an IT specialist." + }, + { + "role": "user", + "content": "What is an API?" + } + ] +} +``` +{% endnavtab %} + +{% navtab Invalid %} +```json +{ + "messages": [ + { + "role": "system", + "content": "You are an IT specialist." + }, + { + "role": "user", + "content": "When was Microsoft founded?" + } + ] +} +``` +{% endnavtab %} + +{% endnavtabs %} + +### Allow and deny + +To allow only questions about Kong that are not related to AWS, you can configure the following prompts: + +```yaml +allow_prompts: +- "Questions about Kong" +deny_prompts: +- "Anything related to AWS" +``` + +{% navtabs %} + +{% navtab Valid %} +```json +{ + "messages": [ + { + "role": "system", + "content": "You are an IT specialist." + }, + { + "role": "user", + "content": "What are Kong's products?" + } + ] +} +``` +{% endnavtab %} + +{% navtab Invalid %} +```json +{ + "messages": [ + { + "role": "system", + "content": "You are an IT specialist." + }, + { + "role": "user", + "content": "How to install Git?" + } + ] +} +``` + +```json +{ + "messages": [ + { + "role": "system", + "content": "You are an IT specialist." + }, + { + "role": "user", + "content": "Does Kong have an AWS plugin?" + } + ] +} +``` +{% endnavtab %} + +{% endnavtabs %} \ No newline at end of file diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md index eb181b3e60b8..1900f1b1b7e7 100644 --- a/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md @@ -14,7 +14,13 @@ Check out the [AI Gateway quickstart](/gateway/latest/get-started/ai-gateway/) t ## How it works +The plugin matches lists of prompts to requests through AI Proxy. +The matching behavior is as follows: +* If any `deny` prompts are set, and the request matches prompt in the `deny` list, the caller receives a 400 response. +* If any `allow` prompts are set, but the request matches none of the allowed prompts, the caller also receives a 400 response. +* If any `allow` prompts are set, and the request matches one of the `allow` prompts, the request passes through to the LLM. +* If there are both `deny` and `allow` prompts set, any request that doesn't match an entry on the `deny` list must then also match one `allow` prompt to be passed through to the LLM. ## Get started with the AI Prompt Guard plugin From 5e04c18d5ba0e58250cfb6f41950ecd6a71c8ec6 Mon Sep 17 00:00:00 2001 From: Lucie Milan Date: Wed, 4 Sep 2024 15:47:21 +0200 Subject: [PATCH 06/11] Revert "submodules updates" This reverts commit 8845c80fa612031eaae9049d03fbc00f5e7b07e9. --- app/_src/.repos/kong-plugins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/_src/.repos/kong-plugins b/app/_src/.repos/kong-plugins index f627877bed31..0e370387e44d 160000 --- a/app/_src/.repos/kong-plugins +++ b/app/_src/.repos/kong-plugins @@ -1 +1 @@ -Subproject commit f627877bed31fb126cf8d519c235e1cd5675056d +Subproject commit 0e370387e44d7a5570925f532a2f2ce77301b79c From 4bdee95cb43adee570f8c90fb1e11f380398719a Mon Sep 17 00:00:00 2001 From: Lucie Milan <32450552+lmilan@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:49:34 +0200 Subject: [PATCH 07/11] Apply suggestions from code review Co-authored-by: Angel --- .../kong-inc/ai-semantic-prompt-guard/how-to/_index.md | 4 ++-- .../kong-inc/ai-semantic-prompt-guard/overview/_index.md | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md index 18004f53ebbc..f0dc2b062dd7 100644 --- a/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md @@ -4,7 +4,7 @@ title: Using the AI Semantic Prompt Guard plugin --- The AI Semantic Prompt Guard configuration takes two arrays of objects: one for `allow` prompts, and -one for `deny` prompts. +one for `deny` prompts, which it uses to determine which prompts are permitted or blocked. ## Prerequisites @@ -19,7 +19,7 @@ The following examples show how to configure allow and deny prompts, and the exp ### Allow only -To allow only message related to Kong, you can configure the following prompt: +For example, to allow only message related to the topic Kong, configure the `allow_prompt` like this: ```yaml allow_prompts: diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md index 1900f1b1b7e7..4886f5991c1d 100644 --- a/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md @@ -2,15 +2,14 @@ nav_title: Overview --- -The AI Semantic Prompt Guard plugin is an enhancement of the AI Prompt Guard plugin; it lets you to allow or block prompts based on a list of similar prompts, to guard against misuse of `llm/v1/chat` or `llm/v1/completions` requests. +The AI Semantic Prompt Guard plugin enhances the AI Prompt Guard plugin by allowing you to permit or block prompts based on a list of similar prompts, helping to prevent misuse of `llm/v1/chat` or `llm/v1/completions` requests. -It does this by scanning all chat messages for the specific expressions set. -You can use a combination of `allow` and `deny` rules to preserve integrity and compliance when serving an LLM service using {{site.base_gateway}}. +You can use a combination of `allow` and `deny` rules to maintain integrity and compliance when serving an LLM service using {{site.base_gateway}}. {:.note} > This plugin extends the functionality of the [AI Proxy plugin](/hub/kong-inc/ai-proxy/), and requires AI Proxy to be configured first. -Check out the [AI Gateway quickstart](/gateway/latest/get-started/ai-gateway/) to get an AI proxy up and running within minutes! +Check out the [AI Gateway quickstart](/gateway/latest/get-started/ai-gateway/) to get an AI proxy up and running within minutes. ## How it works From 8a44f407b3b1a44f614491fd821db867cc997bae Mon Sep 17 00:00:00 2001 From: Lucie Milan Date: Mon, 9 Sep 2024 11:03:59 +0200 Subject: [PATCH 08/11] remove ai proxy prereq --- .../kong-inc/ai-semantic-prompt-guard/how-to/_index.md | 7 ------- .../kong-inc/ai-semantic-prompt-guard/overview/_index.md | 4 ---- 2 files changed, 11 deletions(-) diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md index f0dc2b062dd7..9d8b076a0300 100644 --- a/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/how-to/_index.md @@ -6,13 +6,6 @@ title: Using the AI Semantic Prompt Guard plugin The AI Semantic Prompt Guard configuration takes two arrays of objects: one for `allow` prompts, and one for `deny` prompts, which it uses to determine which prompts are permitted or blocked. -## Prerequisites - -First, as in the [AI Proxy](/hub/kong-inc/ai-proxy/) documentation, create a service, route, and `ai-proxy` plugin -that will serve as your LLM access point. - -You can now create the AI Semantic Prompt Guard plugin at the global, service, or route level, using the following examples. - ## Examples The following examples show how to configure allow and deny prompts, and the expected behavior when making requests. diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md index 4886f5991c1d..48cac0e03075 100644 --- a/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md @@ -7,10 +7,6 @@ The AI Semantic Prompt Guard plugin enhances the AI Prompt Guard plugin by allow You can use a combination of `allow` and `deny` rules to maintain integrity and compliance when serving an LLM service using {{site.base_gateway}}. -{:.note} -> This plugin extends the functionality of the [AI Proxy plugin](/hub/kong-inc/ai-proxy/), and requires AI Proxy to be configured first. -Check out the [AI Gateway quickstart](/gateway/latest/get-started/ai-gateway/) to get an AI proxy up and running within minutes. - ## How it works The plugin matches lists of prompts to requests through AI Proxy. From 65e6a881eb7122e29eebd96c088c6f95473caa43 Mon Sep 17 00:00:00 2001 From: Lucie Milan Date: Mon, 9 Sep 2024 11:16:04 +0200 Subject: [PATCH 09/11] clarify behavior with both allow and deny --- app/_hub/kong-inc/ai-prompt-guard/overview/_index.md | 2 +- app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/_hub/kong-inc/ai-prompt-guard/overview/_index.md b/app/_hub/kong-inc/ai-prompt-guard/overview/_index.md index 1803870f68b0..26ddc8864ef5 100644 --- a/app/_hub/kong-inc/ai-prompt-guard/overview/_index.md +++ b/app/_hub/kong-inc/ai-prompt-guard/overview/_index.md @@ -27,7 +27,7 @@ The matching behavior is as follows: * If any `deny` expressions are set, and the request matches any regex pattern in the `deny` list, the caller receives a 400 response. * If any `allow` expressions are set, but the request matches none of the allowed expressions, the caller also receives a 400 response. * If any `allow` expressions are set, and the request matches one of the `allow` expressions, the request passes through to the LLM. -* If there are both `deny` and `allow` expressions set, any request that doesn't match an entry on the `deny` must then also match one `allow` expression to be passed through to the LLM. +* If there are both `deny` and `allow` expressions set, the `deny` condition takes precedence over `allow`. Any request that matches an entry in the `deny` list will return a 400 response, even if it also matches an expression in the `allow` list. If the request does not match an expression in the `deny` list, then it must match an expression in the `allow` list to be passed through to the LLM ## Get started with the AI Prompt Guard plugin diff --git a/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md b/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md index 48cac0e03075..c12eb2b0c6a4 100644 --- a/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md +++ b/app/_hub/kong-inc/ai-semantic-prompt-guard/overview/_index.md @@ -15,7 +15,7 @@ The matching behavior is as follows: * If any `deny` prompts are set, and the request matches prompt in the `deny` list, the caller receives a 400 response. * If any `allow` prompts are set, but the request matches none of the allowed prompts, the caller also receives a 400 response. * If any `allow` prompts are set, and the request matches one of the `allow` prompts, the request passes through to the LLM. -* If there are both `deny` and `allow` prompts set, any request that doesn't match an entry on the `deny` list must then also match one `allow` prompt to be passed through to the LLM. +* If there are both `deny` and `allow` prompts set, the `deny` condition takes precedence over `allow`. Any request that matches a prompt in the `deny` list will return a 400 response, even if it also matches a prompt in the `allow` list. If the request does not match a prompt in the `deny` list, then it must match a prompt in the `allow` list to be passed through to the LLM ## Get started with the AI Prompt Guard plugin From 6d7814690e81f7daa2f9200125b431650cd2809b Mon Sep 17 00:00:00 2001 From: Lucie Milan Date: Mon, 9 Sep 2024 18:38:17 +0200 Subject: [PATCH 10/11] updated ai plugin list --- app/_src/gateway/ai-gateway/index.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/_src/gateway/ai-gateway/index.md b/app/_src/gateway/ai-gateway/index.md index 8225b63cea15..17ea98191d1e 100644 --- a/app/_src/gateway/ai-gateway/index.md +++ b/app/_src/gateway/ai-gateway/index.md @@ -111,11 +111,13 @@ experiences for your users. #### Data governance -AI Gateway provides the ability to govern outgoing AI prompts via the -[AI Prompt Guard](/hub/kong-inc/ai-prompt-guard). This plugin allows the configuration of regular expressions -following an allow/deny list configuration. Denied prompts result in `4xx` HTTP code responses to clients preventing +AI Gateway provides the ability to govern outgoing AI prompts via an allow/deny list configuration. Denied prompts result in `4xx` HTTP code responses to clients preventing the egress of offending requests. +* The [AI Prompt Guard](/hub/kong-inc/ai-prompt-guard) plugin allows the configuration of allow/deny lists using regular expressions. + +* The [AI Semantic Prompt Guard](/hub/kong-inc/ai-semantic-prompt-guard) plugin allows the configuration of allow/deny lists using semantically similar prompts. + #### Prompt engineering AI systems are built around prompts, and manipulating those prompts is important for successful adoption of the technologies. From f3d7709f5c526f72d23884ca9a69b0435e72a6b4 Mon Sep 17 00:00:00 2001 From: Lucie Milan Date: Tue, 10 Sep 2024 18:33:02 +0200 Subject: [PATCH 11/11] add version condition --- app/_src/gateway/ai-gateway/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/_src/gateway/ai-gateway/index.md b/app/_src/gateway/ai-gateway/index.md index 17ea98191d1e..933f82bf90fe 100644 --- a/app/_src/gateway/ai-gateway/index.md +++ b/app/_src/gateway/ai-gateway/index.md @@ -116,7 +116,9 @@ the egress of offending requests. * The [AI Prompt Guard](/hub/kong-inc/ai-prompt-guard) plugin allows the configuration of allow/deny lists using regular expressions. -* The [AI Semantic Prompt Guard](/hub/kong-inc/ai-semantic-prompt-guard) plugin allows the configuration of allow/deny lists using semantically similar prompts. +{% if_version gte:3.8.x %} +* The [AI Semantic Prompt Guard](/hub/kong-inc/ai-semantic-prompt-guard) plugin allows the configuration of allow/deny lists using semantically similar prompts. +{% endif_version %} #### Prompt engineering