-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Connectors][GenAI] Inference Service Kibana connector (#189027)
## Summary Resolves #188043 This PR adds new connector which is define integration with Elastic Inference Endpoint via [Inference APIs](https://www.elastic.co/guide/en/elasticsearch/reference/current/inference-apis.html) The lifecycle of the Inference Endpoint are managed by the connector registered handlers: - `preSaveHook` - [create](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-inference-api.html) new Inference Endpoint in the connector create mode (`isEdit === false`) and [delete](https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-inference-api.html)+[create](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-inference-api.html) in the connector edit mode (`isEdit === true`) - `postSaveHook` - check if the connector SO was created/updated and if not removes Inference Endpoint from preSaveHook - `postDeleteHook` - [delete](https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-inference-api.html) Inference Endpoint if connector was deleted. In the Kibana Stack Management Connectors, its represented with the new card (Technical preview badge): <img width="1261" alt="Screenshot 2024-09-27 at 2 11 12 PM" src="https://github.com/user-attachments/assets/dcbcce1f-06e7-4d08-8b77-0ba4105354f8"> To simplify the future integration with AI Assistants, the Connector consists from the two main UI parts: provider selector and required provider settings, which will be always displayed <img width="862" alt="Screenshot 2024-10-07 at 7 59 09 AM" src="https://github.com/user-attachments/assets/87bae493-c642-479e-b28f-6150354608dd"> and Additional options, which contains optional provider settings and Task Type configuration: <img width="861" alt="Screenshot 2024-10-07 at 8 00 15 AM" src="https://github.com/user-attachments/assets/2341c034-6198-4731-8ce7-e22e6c6fb20f"> subActions corresponds to the different taskTypes Inference API supports. Each of the task type has its own Inference Perform params. Currently added: - completion & completionStream - rerank - text_embedding - sparse_embedding Follow up work: 1. Collapse/expand Additional options, when the connector flyout/modal has AI Assistant as a context (path through the extending context implementation on the connector framework level) 2. Add support for additional params for Completion subAction to be able to path functions 3. Add support for tokens usage Dashboard, when inference API will include the used tokens count in the response 4. Add functionality and UX for migration from existing specific AI connectors to the Inference connector with proper provider and completion task 5. Integrate Connector with the AI Assistants --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: István Zoltán Szabó <[email protected]> Co-authored-by: Liam Thompson <[email protected]> Co-authored-by: Steph Milovic <[email protected]>
- Loading branch information
1 parent
122647b
commit 288d41d
Showing
76 changed files
with
7,251 additions
and
16 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 126 additions & 0 deletions
126
docs/management/connectors/action-types/inference.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
[[inference-action-type]] | ||
== {infer-cap} connector and action | ||
++++ | ||
<titleabbrev>{inference}</titleabbrev> | ||
++++ | ||
:frontmatter-description: Add a connector that can send requests to {inference}. | ||
:frontmatter-tags-products: [kibana] | ||
:frontmatter-tags-content-type: [how-to] | ||
:frontmatter-tags-user-goals: [configure] | ||
|
||
|
||
The {infer} connector uses the {es} client to send requests to an {infer} service. The connector uses the <<execute-connector-api,run connector API>> to send the request. | ||
|
||
[float] | ||
[[define-inference-ui]] | ||
=== Create connectors in {kib} | ||
|
||
You can create connectors in *{stack-manage-app} > {connectors-ui}*. For example: | ||
|
||
[role="screenshot"] | ||
image::management/connectors/images/inference-connector.png[{inference} connector] | ||
// NOTE: This is an autogenerated screenshot. Do not edit it directly. | ||
|
||
[float] | ||
[[inference-connector-configuration]] | ||
==== Connector configuration | ||
|
||
{infer-cap} connectors have the following configuration properties: | ||
|
||
Name:: The name of the connector. | ||
Service:: The supported {infer} service provider. | ||
Task type:: The {infer} task type, it depends on the selected service. | ||
Inference ID:: The unique identifier of the {infer} endpoint. | ||
Provider configuration:: Settings for service configuration. | ||
Provider secrets:: Configuration for authentication. | ||
Task type configuration:: Settings for task type configuration. | ||
|
||
[float] | ||
[[inference-action-configuration]] | ||
=== Test connectors | ||
|
||
You can test connectors using the <<execute-connector-api,run connector API>> or | ||
while creating or editing the connector in {kib}. For example: | ||
|
||
[role="screenshot"] | ||
image::management/connectors/images/inference-completion-params.png[{infer} params test] | ||
// NOTE: This is an autogenerated screenshot. Do not edit it directly. | ||
[float] | ||
[[inference-connector-actions]] | ||
=== {infer-cap} connector actions | ||
|
||
The {infer} actions have the following configuration properties. Properties depend on the selected task type. | ||
|
||
[float] | ||
[[inference-connector-perform-completion]] | ||
==== Completion | ||
|
||
The following example performs a completion task on the example question. | ||
Input:: | ||
The text on which you want to perform the {infer} task. For example: | ||
+ | ||
[source,text] | ||
-- | ||
{ | ||
input: 'What is Elastic?' | ||
} | ||
-- | ||
|
||
[float] | ||
[[inference-connector-perform-text-embedding]] | ||
==== Text embedding | ||
|
||
The following example performs a text embedding task. | ||
Input:: | ||
The text on which you want to perform the {infer} task. For example: | ||
+ | ||
[source,text] | ||
-- | ||
{ | ||
input: 'The sky above the port was the color of television tuned to a dead channel.', | ||
task_settings: { | ||
input_type: 'ingest' | ||
} | ||
} | ||
-- | ||
Input type:: | ||
An optional string that overwrites the connector's default model. | ||
|
||
[float] | ||
[[inference-connector-perform-rerank]] | ||
==== Reranking | ||
|
||
The following example performs a reranking task on the example input. | ||
Input:: | ||
The text on which you want to perform the {infer} task. Should be a string array. For example: | ||
+ | ||
[source,text] | ||
-- | ||
{ | ||
input: ['luke', 'like', 'leia', 'chewy', 'r2d2', 'star', 'wars'], | ||
query: 'star wars main character' | ||
} | ||
-- | ||
Query:: | ||
The search query text. | ||
|
||
[float] | ||
[[inference-connector-perform-sparse-embedding]] | ||
==== Sparse embedding | ||
|
||
The following example performs a sparse embedding task on the example sentence. | ||
Input:: | ||
The text on which you want to perform the {infer} task. For example: | ||
+ | ||
[source,text] | ||
-- | ||
{ | ||
input: 'The sky above the port was the color of television tuned to a dead channel.' | ||
} | ||
-- | ||
|
||
[float] | ||
[[inference-connector-networking-configuration]] | ||
=== Connector networking configuration | ||
|
||
Use the <<action-settings, Action configuration settings>> to customize connector networking configurations, such as proxies, certificates, or TLS settings. You can apply these settings to all your connectors or use `xpack.actions.customHostSettings` to set per-host configurations. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
x-pack/plugins/actions/docs/openapi/components/schemas/inference_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
title: Connector request properties for an Inference API connector | ||
description: Defines properties for connectors when type is `.inference`. | ||
type: object | ||
required: | ||
- provider | ||
- taskType | ||
- inferenceId | ||
properties: | ||
provider: | ||
type: string | ||
description: The Inference API service provider. | ||
taskType: | ||
type: string | ||
description: The Inference task type supported by provider. | ||
providerConfig: | ||
type: object | ||
description: The provider settings. | ||
taskTypeConfig: | ||
type: object | ||
description: The task type settings. | ||
inferenceId: | ||
type: string | ||
description: The task type settings. |
9 changes: 9 additions & 0 deletions
9
x-pack/plugins/actions/docs/openapi/components/schemas/inference_secrets.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
title: Connector secrets properties for an AI Connector | ||
description: Defines secrets for connectors when type is `.inference`. | ||
type: object | ||
required: | ||
- providerSecrets | ||
properties: | ||
providerSecrets: | ||
type: object | ||
description: The service account credentials. The service account could have different type of properties to encode. |
Oops, something went wrong.