From ddbd87094f02b7efeb33c5fc640ac0a3e075f93e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 21:13:50 -0800 Subject: [PATCH] [8.11] Adds knowledge base and Amazon Bedrock to AI Assistant docs (#4149) (#4202) * Adds knowledge base and Amazon Bedrock to AI Assistant docs * fixes broken links * update formatting * Update security-assistant.asciidoc * formatting tweak * test build error * adds JSON permissions blob * adds missing attribute * incorporates James' feedback * Update docs/assistant/security-assistant.asciidoc Co-authored-by: Joe Peeples * Update docs/assistant/security-assistant.asciidoc Co-authored-by: Joe Peeples * Update docs/assistant/security-assistant.asciidoc Co-authored-by: Joe Peeples * Update docs/assistant/security-assistant.asciidoc Co-authored-by: Joe Peeples * Update docs/assistant/security-assistant.asciidoc Co-authored-by: Joe Peeples * Update docs/assistant/security-assistant.asciidoc Co-authored-by: Joe Peeples * Update docs/assistant/security-assistant.asciidoc Co-authored-by: Joe Peeples * Update docs/assistant/security-assistant.asciidoc Co-authored-by: Joe Peeples * incorporates final feedback --------- Co-authored-by: Joe Peeples (cherry picked from commit 834fd2463cf35467f25c46109a695b716f4ab745) Co-authored-by: Benjamin Ironside Goldstein <91905639+benironside@users.noreply.github.com> --- docs/assistant/security-assistant.asciidoc | 53 ++++++++++++++++++---- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/docs/assistant/security-assistant.asciidoc b/docs/assistant/security-assistant.asciidoc index 04e80daa82..f815d5648e 100644 --- a/docs/assistant/security-assistant.asciidoc +++ b/docs/assistant/security-assistant.asciidoc @@ -52,15 +52,39 @@ NOTE: Elastic can automatically anonymize event data that you provide to AI Assi [[set-up-ai-assistant]] == Set up AI Assistant -You must complete these steps before you can use AI Assistant: +You must create a generative AI connector before you can use AI Assistant. -. Create an API key with your AI provider to authenticate requests from AI Assistant. You'll use this in the next step. Refer to the provider's documentation for generating API keys: -+ -* https://platform.openai.com/docs/api-reference[OpenAI] -* https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference[Azure OpenAI Service] +. Open AI Assistant *Cmd + ;* (or *Ctrl + ;* on Windows), and click **Connector** -> **Add new Connector**. +. Select either *Amazon Bedrock* or *OpenAI*. +. Enter the authentication details required for your chosen connector type, then click *Save*. + +For OpenAI and Azure OpenAI Service, you need to provide an API key. For Amazon Bedrock, you need to provide an access key and secret for an IAM user with at least the following permissions: + +.Click to expand permissions JSON +[%collapsible] +==== +``` +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "VisualEditor0", + "Effect": "Allow", + "Action": [ + "bedrock:InvokeModel", + "bedrock:InvokeModelWithResponseStream" + ], + "Resource": "*" + } + ] +} +``` +==== + +For Amazon Bedrock, only Anthropic models are supported: Claude and Claude Instant. You need to https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html#manage-model-access[enable them in AWS] before setting up an Amazon Bedrock connector. You can configure an Amazon Bedrock connector to use any https://docs.aws.amazon.com/general/latest/gr/bedrock.html[AWS region where Anthropic models are supported] by editing the *URL* field under *Connector settings*, for example by changing `us-west-2` to `eu-central-1`. + +For more information about setting up generative AI connectors, refer to {kibana-ref}/openai-action-type.html[OpenAI connector] or {kibana-ref}/bedrock-action-type.html[Amazon Bedrock connector]. -. Create an {kibana-ref}/openai-action-type.html[OpenAI connector] using the AI provider's API key and URL to authenticate communication between {elastic-sec} and the provider. -You can do this in {kib} from *{stack-manage-app}* -> *{connectors-ui}*, or from within AI Assistant. [discrete] [[start-chatting]] @@ -139,5 +163,18 @@ The fields on this list are among those most likely to provide relevant context image::images/add-alert-context.gif[A video that shows an alert being added as context to an AI Assistant chat message] + When you include a particular event as context, you can use a similar interface to adjust anonymization behavior. Be sure the anonymization behavior meets your specifications before sending a message with the event attached. - ++ The *Show anonymized* toggle controls whether you see the obfuscated or plaintext versions of the fields you sent to AI Assistant. It doesn't control what gets obfuscated — that's determined by the anonymization settings. It also doesn't affect how event fields appear _before_ being sent to AI Assistant. Instead, it controls how fields that were already sent and obfuscated appear to you. + +* **Knowledge base:** Use retrieval-augmented generation to provide specialized knowledge of the Elastic Search Query Language ({esql}) to AI Assistant. For example, with the knowledge base active, you can ask AI Assistant to help you write an {esql} query for a particular use case, or ask it to answer general questions about {esql} syntax and usage. Without the knowledge base enabled, AI Assistant will not be able to answer questions about {esql}. ++ +beta::[] ++ +To enable the knowledge base: ++ +. Enable the Elastic Learned Sparse EncodeR (ELSER). This model provides additional context to the third-party LLM. To learn more, refer to {ml-docs}/ml-nlp-elser.html#download-deploy-elser[Configure ELSER]. +. Initialize the knowledge base by clicking *Initialize*. +. Turn on the *Knowledge Base* option. +. Click *Save*. The knowledge base is now active. ++ +When the knowledge base is active, a quick prompt for {esql} queries becomes available. It provides a good starting point for your {esql} conversations and questions. \ No newline at end of file