Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.11] [8.11] Adds knowledge base and Amazon Bedrock to AI Assistant docs (backport #4149) #4202

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 45 additions & 8 deletions docs/assistant/security-assistant.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down Expand Up @@ -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.