From a754ca30f0cd8921fa1170a570bd47e0f4a89685 Mon Sep 17 00:00:00 2001 From: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Date: Thu, 28 Mar 2024 08:01:25 -0400 Subject: [PATCH 1/2] Apply suggestions from code review Co-authored-by: Nathan Bower Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> --- _ml-commons-plugin/api/model-apis/register-model.md | 4 ++-- _ml-commons-plugin/remote-models/guardrails.md | 8 ++++---- _ml-commons-plugin/remote-models/index.md | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/_ml-commons-plugin/api/model-apis/register-model.md b/_ml-commons-plugin/api/model-apis/register-model.md index ac61b35ad6..6f5eed12c0 100644 --- a/_ml-commons-plugin/api/model-apis/register-model.md +++ b/_ml-commons-plugin/api/model-apis/register-model.md @@ -251,7 +251,7 @@ OpenSearch responds with the `task_id` and task `status`. ### The `guardrails` parameter -Guardrails act like safety measures for large language models (LLMs). They provide a set of rules and boundaries that control how an LLM behaves and what kind of outputs it generates. +Guardrails are safety measures for large language models (LLMs). They provide a set of rules and boundaries that control how an LLM behaves and what kind of output it generates. To register an externally hosted model with guardrails, provide the `guardrails` parameter, which supports the following fields. All fields are optional. @@ -302,7 +302,7 @@ For an end-to-end example, see [Guardrails]({{site.url}}{{site.baseurl}}/ml-comm #### Example response -OpenSearch responds with the `task_id` and task `status`. +OpenSearch responds with the `task_id` and task `status`: ```json { diff --git a/_ml-commons-plugin/remote-models/guardrails.md b/_ml-commons-plugin/remote-models/guardrails.md index 9749f6794f..252b94277e 100644 --- a/_ml-commons-plugin/remote-models/guardrails.md +++ b/_ml-commons-plugin/remote-models/guardrails.md @@ -12,9 +12,9 @@ grand_parent: Integrating ML models **Introduced 2.13** {: .label .label-purple } -Guardrails can guide a large language model (LLM) toward desired behavior. They act as a filter, preventing the LLM from generating outputs that are harmful or violate ethical principles and facilitating a safer use of AI. Guardrails also steer the LLM to produce a more focused and relevant output. +Guardrails can guide a large language model (LLM) toward desired behavior. They act as a filter, preventing the LLM from generating output that is harmful or violates ethical principles and facilitating safer use of AI. Guardrails also cause the LLM to produce more focused and relevant output. -To configure guardrails for your LLM, you can provide a list of words that are prohibited in the input or output of the model. Alternatively, you can provide a regular expression against which the model input or output will be matched. +To configure guardrails for your LLM, you can provide a list of words to be prohibited in the input or output of the model. Alternatively, you can provide a regular expression against which the model input or output will be matched. ## Prerequisites @@ -22,7 +22,7 @@ Before you start, make sure you have fulfilled the [prerequisites]({{site.url}}{ ## Step 1: Create a guardrail index -To start, create an index that will hold the excluded words (_stopwords_). In the index settings, specify for the index to contain a `title` field, which will contain excluded words, and a `query` field, which is of the [percolator]({{site.url}}{{site.baseurl}}/field-types/supported-field-types/percolator/) type. The percolator query will be used to match the LLM input or output: +To start, create an index that will store the excluded words (_stopwords_). In the index settings, specify a `title` field, which will contain excluded words, and a `query` field of the [percolator]({{site.url}}{{site.baseurl}}/field-types/supported-field-types/percolator/) type. The percolator query will be used to match the LLM input or output: ```json PUT /words0 @@ -290,7 +290,7 @@ The response contains an error message because guardrails were triggered: } ``` -The guardrails are also triggered when a prompt matches the supplied regular expression. +Guardrails are also triggered when a prompt matches the supplied regular expression. ## Next steps diff --git a/_ml-commons-plugin/remote-models/index.md b/_ml-commons-plugin/remote-models/index.md index 05a8653aae..e3aef0dacc 100644 --- a/_ml-commons-plugin/remote-models/index.md +++ b/_ml-commons-plugin/remote-models/index.md @@ -317,4 +317,4 @@ To learn how to use the model for vector search, see [Using an ML model for neur - For more information about connector parameters, see [Connector blueprints]({{site.url}}{{site.baseurl}}/ml-commons-plugin/remote-models/blueprints/). - For more information about managing ML models in OpenSearch, see [Using ML models within OpenSearch]({{site.url}}{{site.baseurl}}/ml-commons-plugin/model-serving-framework/). - For more information about interacting with ML models in OpenSearch, see [Managing ML models in OpenSearch Dashboards]({{site.url}}{{site.baseurl}}/ml-commons-plugin/ml-dashboard/) -For steps to configure model guardrails, see [Guardrails]({{site.url}}{{site.baseurl}}/ml-commons-plugin/remote-models/guardrails/) +For instructions on how to configure model guardrails, see [Guardrails]({{site.url}}{{site.baseurl}}/ml-commons-plugin/remote-models/guardrails/). From 5475f8e15095423a6c4892a032201ed5abb2c123 Mon Sep 17 00:00:00 2001 From: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Date: Thu, 28 Mar 2024 08:02:43 -0400 Subject: [PATCH 2/2] Apply suggestions from code review Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> --- _ml-commons-plugin/api/model-apis/register-model.md | 2 +- _ml-commons-plugin/remote-models/guardrails.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_ml-commons-plugin/api/model-apis/register-model.md b/_ml-commons-plugin/api/model-apis/register-model.md index 6f5eed12c0..2f300e113b 100644 --- a/_ml-commons-plugin/api/model-apis/register-model.md +++ b/_ml-commons-plugin/api/model-apis/register-model.md @@ -298,7 +298,7 @@ POST /_plugins/_ml/models/_register ``` {% include copy-curl.html %} -For an end-to-end example, see [Guardrails]({{site.url}}{{site.baseurl}}/ml-commons-plugin/remote-models/guardrails/). +For a complete example, see [Guardrails]({{site.url}}{{site.baseurl}}/ml-commons-plugin/remote-models/guardrails/). #### Example response diff --git a/_ml-commons-plugin/remote-models/guardrails.md b/_ml-commons-plugin/remote-models/guardrails.md index 252b94277e..348183ad4d 100644 --- a/_ml-commons-plugin/remote-models/guardrails.md +++ b/_ml-commons-plugin/remote-models/guardrails.md @@ -97,7 +97,7 @@ To learn more about model groups, see [Model access control]({{site.url}}{{site. ## Step 4: Create a connector -Create a connector to the model. In this example, you'll create a connector to the Anthropic Claude model hosted on Amazon Bedrock: +Now you can create a connector for the model. In this example, you'll create a connector to the Anthropic Claude model hosted on Amazon Bedrock: ```json POST /_plugins/_ml/connectors/_create