mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
Revert "[Security solution] Rename Generative AI connector to OpenAI (#167519)"
This reverts commit a81b620a41
.
This commit is contained in:
parent
46aecbee5a
commit
7dd352a65e
87 changed files with 303 additions and 257 deletions
6
.github/CODEOWNERS
vendored
6
.github/CODEOWNERS
vendored
|
@ -1212,9 +1212,9 @@ x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts @elastic/kib
|
||||||
/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users @elastic/security-threat-hunting-explore
|
/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users @elastic/security-threat-hunting-explore
|
||||||
|
|
||||||
## Explore owner connectors
|
## Explore owner connectors
|
||||||
/x-pack/plugins/stack_connectors/public/connector_types/openai @elastic/security-threat-hunting-explore
|
/x-pack/plugins/stack_connectors/public/connector_types/gen_ai @elastic/security-threat-hunting-explore
|
||||||
/x-pack/plugins/stack_connectors/server/connector_types/openai @elastic/security-threat-hunting-explore
|
/x-pack/plugins/stack_connectors/server/connector_types/gen_ai @elastic/security-threat-hunting-explore
|
||||||
/x-pack/plugins/stack_connectors/common/openai @elastic/security-threat-hunting-explore
|
/x-pack/plugins/stack_connectors/common/gen_ai @elastic/security-threat-hunting-explore
|
||||||
|
|
||||||
## Defend Workflows owner connectors
|
## Defend Workflows owner connectors
|
||||||
/x-pack/plugins/stack_connectors/public/connector_types/sentinelone @elastic/security-defend-workflows
|
/x-pack/plugins/stack_connectors/public/connector_types/sentinelone @elastic/security-defend-workflows
|
||||||
|
|
|
@ -5273,10 +5273,10 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"parentPluginId": "actions",
|
"parentPluginId": "actions",
|
||||||
"id": "def-common.GenerativeAIConnectorFeatureId",
|
"id": "def-common.GeneralConnectorFeatureId",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"label": "GenerativeAIConnectorFeatureId",
|
"label": "GeneralConnectorFeatureId",
|
||||||
"description": [],
|
"description": [],
|
||||||
"signature": [
|
"signature": [
|
||||||
"\"general\""
|
"\"general\""
|
||||||
|
@ -5613,10 +5613,10 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"parentPluginId": "actions",
|
"parentPluginId": "actions",
|
||||||
"id": "def-common.GenerativeAIFeature",
|
"id": "def-common.GeneralFeature",
|
||||||
"type": "Object",
|
"type": "Object",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"label": "GenerativeAIFeature",
|
"label": "GeneralFeature",
|
||||||
"description": [],
|
"description": [],
|
||||||
"path": "x-pack/plugins/actions/common/connector_feature_config.ts",
|
"path": "x-pack/plugins/actions/common/connector_feature_config.ts",
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
|
@ -5624,7 +5624,7 @@
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"parentPluginId": "actions",
|
"parentPluginId": "actions",
|
||||||
"id": "def-common.GenerativeAIFeature.id",
|
"id": "def-common.GeneralFeature.id",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"label": "id",
|
"label": "id",
|
||||||
|
@ -5635,7 +5635,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"parentPluginId": "actions",
|
"parentPluginId": "actions",
|
||||||
"id": "def-common.GenerativeAIFeature.name",
|
"id": "def-common.GeneralFeature.name",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"label": "name",
|
"label": "name",
|
||||||
|
@ -5646,7 +5646,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"parentPluginId": "actions",
|
"parentPluginId": "actions",
|
||||||
"id": "def-common.GenerativeAIFeature.compatibility",
|
"id": "def-common.GeneralFeature.compatibility",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"label": "compatibility",
|
"label": "compatibility",
|
||||||
|
@ -5769,4 +5769,4 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1004,7 +1004,7 @@ Any modifications made to this file will be overwritten.
|
||||||
<li><a href="#config_properties_cases_webhook"><code>config_properties_cases_webhook</code> - Connector request properties for Webhook - Case Management connector</a></li>
|
<li><a href="#config_properties_cases_webhook"><code>config_properties_cases_webhook</code> - Connector request properties for Webhook - Case Management connector</a></li>
|
||||||
<li><a href="#config_properties_d3security"><code>config_properties_d3security</code> - Connector request properties for a D3 Security connector</a></li>
|
<li><a href="#config_properties_d3security"><code>config_properties_d3security</code> - Connector request properties for a D3 Security connector</a></li>
|
||||||
<li><a href="#config_properties_email"><code>config_properties_email</code> - Connector request properties for an email connector</a></li>
|
<li><a href="#config_properties_email"><code>config_properties_email</code> - Connector request properties for an email connector</a></li>
|
||||||
<li><a href="#config_properties_genai"><code>config_properties_genai</code> - Connector request properties for an OpenAI connector</a></li>
|
<li><a href="#config_properties_genai"><code>config_properties_genai</code> - Connector request properties for a generative AI connector</a></li>
|
||||||
<li><a href="#config_properties_genai_oneOf"><code>config_properties_genai_oneOf</code> - </a></li>
|
<li><a href="#config_properties_genai_oneOf"><code>config_properties_genai_oneOf</code> - </a></li>
|
||||||
<li><a href="#config_properties_genai_oneOf_1"><code>config_properties_genai_oneOf_1</code> - </a></li>
|
<li><a href="#config_properties_genai_oneOf_1"><code>config_properties_genai_oneOf_1</code> - </a></li>
|
||||||
<li><a href="#config_properties_index"><code>config_properties_index</code> - Connector request properties for an index connector</a></li>
|
<li><a href="#config_properties_index"><code>config_properties_index</code> - Connector request properties for an index connector</a></li>
|
||||||
|
@ -1044,7 +1044,7 @@ Any modifications made to this file will be overwritten.
|
||||||
<li><a href="#create_connector_request_cases_webhook"><code>create_connector_request_cases_webhook</code> - Create Webhook - Case Managment connector request</a></li>
|
<li><a href="#create_connector_request_cases_webhook"><code>create_connector_request_cases_webhook</code> - Create Webhook - Case Managment connector request</a></li>
|
||||||
<li><a href="#create_connector_request_d3security"><code>create_connector_request_d3security</code> - Create D3 Security connector request</a></li>
|
<li><a href="#create_connector_request_d3security"><code>create_connector_request_d3security</code> - Create D3 Security connector request</a></li>
|
||||||
<li><a href="#create_connector_request_email"><code>create_connector_request_email</code> - Create email connector request</a></li>
|
<li><a href="#create_connector_request_email"><code>create_connector_request_email</code> - Create email connector request</a></li>
|
||||||
<li><a href="#create_connector_request_genai"><code>create_connector_request_genai</code> - Create OpenAI connector request</a></li>
|
<li><a href="#create_connector_request_genai"><code>create_connector_request_genai</code> - Create generative AI connector request</a></li>
|
||||||
<li><a href="#create_connector_request_index"><code>create_connector_request_index</code> - Create index connector request</a></li>
|
<li><a href="#create_connector_request_index"><code>create_connector_request_index</code> - Create index connector request</a></li>
|
||||||
<li><a href="#create_connector_request_jira"><code>create_connector_request_jira</code> - Create Jira connector request</a></li>
|
<li><a href="#create_connector_request_jira"><code>create_connector_request_jira</code> - Create Jira connector request</a></li>
|
||||||
<li><a href="#create_connector_request_opsgenie"><code>create_connector_request_opsgenie</code> - Create Opsgenie connector request</a></li>
|
<li><a href="#create_connector_request_opsgenie"><code>create_connector_request_opsgenie</code> - Create Opsgenie connector request</a></li>
|
||||||
|
@ -1100,7 +1100,7 @@ Any modifications made to this file will be overwritten.
|
||||||
<li><a href="#secrets_properties_cases_webhook"><code>secrets_properties_cases_webhook</code> - Connector secrets properties for Webhook - Case Management connector</a></li>
|
<li><a href="#secrets_properties_cases_webhook"><code>secrets_properties_cases_webhook</code> - Connector secrets properties for Webhook - Case Management connector</a></li>
|
||||||
<li><a href="#secrets_properties_d3security"><code>secrets_properties_d3security</code> - Connector secrets properties for a D3 Security connector</a></li>
|
<li><a href="#secrets_properties_d3security"><code>secrets_properties_d3security</code> - Connector secrets properties for a D3 Security connector</a></li>
|
||||||
<li><a href="#secrets_properties_email"><code>secrets_properties_email</code> - Connector secrets properties for an email connector</a></li>
|
<li><a href="#secrets_properties_email"><code>secrets_properties_email</code> - Connector secrets properties for an email connector</a></li>
|
||||||
<li><a href="#secrets_properties_genai"><code>secrets_properties_genai</code> - Connector secrets properties for an OpenAI connector</a></li>
|
<li><a href="#secrets_properties_genai"><code>secrets_properties_genai</code> - Connector secrets properties for a generative AI connector</a></li>
|
||||||
<li><a href="#secrets_properties_jira"><code>secrets_properties_jira</code> - Connector secrets properties for a Jira connector</a></li>
|
<li><a href="#secrets_properties_jira"><code>secrets_properties_jira</code> - Connector secrets properties for a Jira connector</a></li>
|
||||||
<li><a href="#secrets_properties_opsgenie"><code>secrets_properties_opsgenie</code> - Connector secrets properties for an Opsgenie connector</a></li>
|
<li><a href="#secrets_properties_opsgenie"><code>secrets_properties_opsgenie</code> - Connector secrets properties for an Opsgenie connector</a></li>
|
||||||
<li><a href="#secrets_properties_pagerduty"><code>secrets_properties_pagerduty</code> - Connector secrets properties for a PagerDuty connector</a></li>
|
<li><a href="#secrets_properties_pagerduty"><code>secrets_properties_pagerduty</code> - Connector secrets properties for a PagerDuty connector</a></li>
|
||||||
|
@ -1432,7 +1432,7 @@ Any modifications made to this file will be overwritten.
|
||||||
</div> <!-- field-items -->
|
</div> <!-- field-items -->
|
||||||
</div>
|
</div>
|
||||||
<div class="model">
|
<div class="model">
|
||||||
<h3><a name="config_properties_genai"><code>config_properties_genai</code> - Connector request properties for an OpenAI connector</a> <a class="up" href="#__Models">Up</a></h3>
|
<h3><a name="config_properties_genai"><code>config_properties_genai</code> - Connector request properties for a generative AI connector</a> <a class="up" href="#__Models">Up</a></h3>
|
||||||
<div class='model-description'>Defines properties for connectors when type is <code>.gen-ai</code>.</div>
|
<div class='model-description'>Defines properties for connectors when type is <code>.gen-ai</code>.</div>
|
||||||
<div class="field-items">
|
<div class="field-items">
|
||||||
<div class="param">apiProvider </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The OpenAI API provider. </div>
|
<div class="param">apiProvider </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The OpenAI API provider. </div>
|
||||||
|
@ -1958,8 +1958,8 @@ Any modifications made to this file will be overwritten.
|
||||||
</div> <!-- field-items -->
|
</div> <!-- field-items -->
|
||||||
</div>
|
</div>
|
||||||
<div class="model">
|
<div class="model">
|
||||||
<h3><a name="create_connector_request_genai"><code>create_connector_request_genai</code> - Create OpenAI connector request</a> <a class="up" href="#__Models">Up</a></h3>
|
<h3><a name="create_connector_request_genai"><code>create_connector_request_genai</code> - Create generative AI connector request</a> <a class="up" href="#__Models">Up</a></h3>
|
||||||
<div class='model-description'>The OpenAI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.</div>
|
<div class='model-description'>The generative AI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.</div>
|
||||||
<div class="field-items">
|
<div class="field-items">
|
||||||
<div class="param">config </div><div class="param-desc"><span class="param-type"><a href="#config_properties_genai">config_properties_genai</a></span> </div>
|
<div class="param">config </div><div class="param-desc"><span class="param-type"><a href="#config_properties_genai">config_properties_genai</a></span> </div>
|
||||||
<div class="param">connector_type_id </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The type of connector. </div>
|
<div class="param">connector_type_id </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The type of connector. </div>
|
||||||
|
@ -2535,7 +2535,7 @@ Any modifications made to this file will be overwritten.
|
||||||
</div> <!-- field-items -->
|
</div> <!-- field-items -->
|
||||||
</div>
|
</div>
|
||||||
<div class="model">
|
<div class="model">
|
||||||
<h3><a name="secrets_properties_genai"><code>secrets_properties_genai</code> - Connector secrets properties for an OpenAI connector</a> <a class="up" href="#__Models">Up</a></h3>
|
<h3><a name="secrets_properties_genai"><code>secrets_properties_genai</code> - Connector secrets properties for a generative AI connector</a> <a class="up" href="#__Models">Up</a></h3>
|
||||||
<div class='model-description'>Defines secrets for connectors when type is <code>.gen-ai</code>.</div>
|
<div class='model-description'>Defines secrets for connectors when type is <code>.gen-ai</code>.</div>
|
||||||
<div class="field-items">
|
<div class="field-items">
|
||||||
<div class="param">apiKey (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The OpenAI API key. </div>
|
<div class="param">apiKey (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The OpenAI API key. </div>
|
||||||
|
|
|
@ -35,7 +35,7 @@ a| <<teams-action-type,Microsoft Teams>>
|
||||||
|
|
||||||
| Send a message to a Microsoft Teams channel.
|
| Send a message to a Microsoft Teams channel.
|
||||||
|
|
||||||
a| <<openai-action-type,OpenAI>>
|
a| <<gen-ai-action-type,OpenAI>>
|
||||||
|
|
||||||
| Send a request to OpenAI.
|
| Send a request to OpenAI.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[[openai-action-type]]
|
[[gen-ai-action-type]]
|
||||||
== OpenAI connector and action
|
== Generative AI connector and action
|
||||||
++++
|
++++
|
||||||
<titleabbrev>OpenAI</titleabbrev>
|
<titleabbrev>Generative AI</titleabbrev>
|
||||||
++++
|
++++
|
||||||
:frontmatter-description: Add a connector that can send requests to an OpenAI provider.
|
:frontmatter-description: Add a connector that can send requests to an OpenAI provider.
|
||||||
:frontmatter-tags-products: [kibana]
|
:frontmatter-tags-products: [kibana]
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
:frontmatter-tags-user-goals: [configure]
|
:frontmatter-tags-user-goals: [configure]
|
||||||
|
|
||||||
|
|
||||||
The OpenAI connector uses https://github.com/axios/axios[axios] to send a POST request to an OpenAI provider, either OpenAI or Azure OpenAI. The connector uses the <<execute-connector-api,run connector API>> to send the request.
|
The Generative AI connector uses https://github.com/axios/axios[axios] to send a POST request to an OpenAI provider, either OpenAI or Azure OpenAI. The connector uses the <<execute-connector-api,run connector API>> to send the request.
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
[[define-gen-ai-ui]]
|
[[define-gen-ai-ui]]
|
||||||
|
@ -18,14 +18,14 @@ The OpenAI connector uses https://github.com/axios/axios[axios] to send a POST r
|
||||||
You can create connectors in *{stack-manage-app} > {connectors-ui}*. For example:
|
You can create connectors in *{stack-manage-app} > {connectors-ui}*. For example:
|
||||||
|
|
||||||
[role="screenshot"]
|
[role="screenshot"]
|
||||||
image::management/connectors/images/gen-ai-connector.png[OpenAI connector]
|
image::management/connectors/images/gen-ai-connector.png[Generative AI connector]
|
||||||
// NOTE: This is an autogenerated screenshot. Do not edit it directly.
|
// NOTE: This is an autogenerated screenshot. Do not edit it directly.
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
[[openai-connector-configuration]]
|
[[gen-ai-connector-configuration]]
|
||||||
==== Connector configuration
|
==== Connector configuration
|
||||||
|
|
||||||
OpenAI connectors have the following configuration properties:
|
Generative AI connectors have the following configuration properties:
|
||||||
|
|
||||||
Name:: The name of the connector.
|
Name:: The name of the connector.
|
||||||
OpenAI provider:: The OpenAI API provider, either OpenAI or Azure OpenAI.
|
OpenAI provider:: The OpenAI API provider, either OpenAI or Azure OpenAI.
|
||||||
|
@ -41,10 +41,10 @@ You can test connectors with the <<execute-connector-api,run connector API>> or
|
||||||
as you're creating or editing the connector in {kib}. For example:
|
as you're creating or editing the connector in {kib}. For example:
|
||||||
|
|
||||||
[role="screenshot"]
|
[role="screenshot"]
|
||||||
image::management/connectors/images/gen-ai-params-test.png[OpenAI params test]
|
image::management/connectors/images/gen-ai-params-test.png[Generative AI params test]
|
||||||
// NOTE: This is an autogenerated screenshot. Do not edit it directly.
|
// NOTE: This is an autogenerated screenshot. Do not edit it directly.
|
||||||
|
|
||||||
The OpenAI actions have the following configuration properties.
|
The Generative AI actions have the following configuration properties.
|
||||||
|
|
||||||
Body:: A JSON payload sent to the OpenAI API URL. For example:
|
Body:: A JSON payload sent to the OpenAI API URL. For example:
|
||||||
+
|
+
|
||||||
|
@ -61,15 +61,15 @@ Body:: A JSON payload sent to the OpenAI API URL. For example:
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
[float]
|
[float]
|
||||||
[[openai-connector-networking-configuration]]
|
[[gen-ai-connector-networking-configuration]]
|
||||||
=== 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 set configurations that apply to all your connectors or use `xpack.actions.customHostSettings` to set per-host configurations.
|
Use the <<action-settings, Action configuration settings>> to customize connector networking configurations, such as proxies, certificates, or TLS settings. You can set configurations that apply to all your connectors or use `xpack.actions.customHostSettings` to set per-host configurations.
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
[[openai-connector-token-dashboard]]
|
[[gen-ai-connector-token-dashboard]]
|
||||||
=== Token usage dashboard
|
=== Token usage dashboard
|
||||||
|
|
||||||
Once you've created a OpenAI connector, you can monitor its token usage using the *OpenAI Token Usage* dashboard. Select the connector in *{stack-manage-app}* > *{connectors-ui}* to view its details, then click the *View OpenAI Usage Dashboard for "_<Name>_" Connector* link to open the dashboard.
|
Once you've created a Generative AI connector, you can monitor its token usage using the *Generative AI Token Usage* dashboard. Select the connector in *{stack-manage-app}* > *{connectors-ui}* to view its details, then click the *View OpenAI Usage Dashboard for "_<Name>_" Connector* link to open the dashboard.
|
||||||
|
|
||||||
NOTE: To view the dashboard, you need at least `read` and `view_index_metadata` privileges for the `.kibana-event-log-*` index and the `Read` feature privilege for {kib}. You can set up a role with these minimum privileges and assign it to non-admin users who need to view this dashboard.
|
NOTE: To view the dashboard, you need at least `read` and `view_index_metadata` privileges for the `.kibana-event-log-*` index and the `Read` feature privilege for {kib}. You can set up a role with these minimum privileges and assign it to non-admin users who need to view this dashboard.
|
|
@ -1,11 +1,11 @@
|
||||||
include::action-types/bedrock.asciidoc[leveloffset=+1]
|
include::action-types/bedrock.asciidoc[leveloffset=+1]
|
||||||
include::action-types/d3security.asciidoc[leveloffset=+1]
|
include::action-types/d3security.asciidoc[leveloffset=+1]
|
||||||
include::action-types/email.asciidoc[leveloffset=+1]
|
include::action-types/email.asciidoc[leveloffset=+1]
|
||||||
|
include::action-types/gen-ai.asciidoc[leveloffset=+1]
|
||||||
include::action-types/resilient.asciidoc[leveloffset=+1]
|
include::action-types/resilient.asciidoc[leveloffset=+1]
|
||||||
include::action-types/index.asciidoc[leveloffset=+1]
|
include::action-types/index.asciidoc[leveloffset=+1]
|
||||||
include::action-types/jira.asciidoc[leveloffset=+1]
|
include::action-types/jira.asciidoc[leveloffset=+1]
|
||||||
include::action-types/teams.asciidoc[leveloffset=+1]
|
include::action-types/teams.asciidoc[leveloffset=+1]
|
||||||
include::action-types/openai.asciidoc[leveloffset=+1]
|
|
||||||
include::action-types/opsgenie.asciidoc[leveloffset=+1]
|
include::action-types/opsgenie.asciidoc[leveloffset=+1]
|
||||||
include::action-types/pagerduty.asciidoc[leveloffset=+1]
|
include::action-types/pagerduty.asciidoc[leveloffset=+1]
|
||||||
include::action-types/server-log.asciidoc[leveloffset=+1]
|
include::action-types/server-log.asciidoc[leveloffset=+1]
|
||||||
|
|
|
@ -282,15 +282,15 @@ secrets:
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
[[preconfigured-gen-ai-configuration]]
|
[[preconfigured-gen-ai-configuration]]
|
||||||
==== OpenAI connectors
|
==== Generative AI connectors
|
||||||
|
|
||||||
The following example creates a <<openai-action-type,OpenAI connector>>:
|
The following example creates a <<gen-ai-action-type,generative AI connector>>:
|
||||||
|
|
||||||
[source,text]
|
[source,text]
|
||||||
--
|
--
|
||||||
xpack.actions.preconfigured:
|
xpack.actions.preconfigured:
|
||||||
my-open-ai:
|
my-gen-ai:
|
||||||
name: preconfigured-openai-connector-type
|
name: preconfigured-gen-ai-connector-type
|
||||||
actionTypeId: .gen-ai
|
actionTypeId: .gen-ai
|
||||||
config:
|
config:
|
||||||
apiUrl: https://api.openai.com/v1/chat/completions <1>
|
apiUrl: https://api.openai.com/v1/chat/completions <1>
|
||||||
|
|
|
@ -422,8 +422,3 @@ This page has been deleted. Refer to <<alerting-getting-started>>.
|
||||||
== Enhancements and bug fixes for 8.10.0
|
== Enhancements and bug fixes for 8.10.0
|
||||||
|
|
||||||
This content has moved. Refer to <<enhancements-and-bug-fixes-v8.10.0-revised>> for 8.10.0.
|
This content has moved. Refer to <<enhancements-and-bug-fixes-v8.10.0-revised>> for 8.10.0.
|
||||||
|
|
||||||
[role="exclude",id="gen-ai-action-type"]
|
|
||||||
== Generative AI connector and action
|
|
||||||
|
|
||||||
This connector was renamed. Refer to <<openai-action-type>>.
|
|
|
@ -261,13 +261,13 @@ For example: `.email`, `.index`, `.opsgenie`, `.server-log`, `.resilient`, `.sla
|
||||||
The configuration details, which are specific to the type of preconfigured connector.
|
The configuration details, which are specific to the type of preconfigured connector.
|
||||||
|
|
||||||
`xpack.actions.preconfigured.<connector-id>.config.apiProvider`::
|
`xpack.actions.preconfigured.<connector-id>.config.apiProvider`::
|
||||||
For a <<openai-action-type,OpenAI connector>>, specifies the OpenAI API provider, either `OpenAI` or `Azure OpenAI`.
|
For a <<gen-ai-action-type,generative AI connector>>, specifies the OpenAI API provider, either `OpenAI` or `Azure OpenAI`.
|
||||||
|
|
||||||
`xpack.actions.preconfigured.<connector-id>.config.apiUrl`::
|
`xpack.actions.preconfigured.<connector-id>.config.apiUrl`::
|
||||||
A configuration URL that varies by connector:
|
A configuration URL that varies by connector:
|
||||||
+
|
+
|
||||||
--
|
--
|
||||||
* For a <<openai-action-type,OpenAI connector>>, specifies the OpenAI request URL.
|
* For a <<gen-ai-action-type,generative AI connector>>, specifies the OpenAI request URL.
|
||||||
* For a <<resilient-action-type,{ibm-r} connector>>, specifies the {ibm-r} instance URL.
|
* For a <<resilient-action-type,{ibm-r} connector>>, specifies the {ibm-r} instance URL.
|
||||||
* For a <<jira-action-type,Jira connector>>, specifies the Jira instance URL.
|
* For a <<jira-action-type,Jira connector>>, specifies the Jira instance URL.
|
||||||
* For an <<opsgenie-action-type,{opsgenie} connector>>, specifies the {opsgenie} URL. For example, `https://api.opsgenie.com` or `https://api.eu.opsgenie.com`.
|
* For an <<opsgenie-action-type,{opsgenie} connector>>, specifies the {opsgenie} URL. For example, `https://api.opsgenie.com` or `https://api.eu.opsgenie.com`.
|
||||||
|
@ -321,7 +321,7 @@ NOTE: If you are using the `xpack.actions.allowedHosts` setting, make sure the h
|
||||||
For a <<cases-webhook-action-type,{webhook-cm} connector>>, specifies a string from the response body of the create case method that corresponds to the external service identifier.
|
For a <<cases-webhook-action-type,{webhook-cm} connector>>, specifies a string from the response body of the create case method that corresponds to the external service identifier.
|
||||||
|
|
||||||
`xpack.actions.preconfigured.<connector-id>.config.defaultModel`::
|
`xpack.actions.preconfigured.<connector-id>.config.defaultModel`::
|
||||||
For a <<openai-action-type,OpenAI connector>>, specifies the default model to use for requests. It is optional and applicable only when `xpack.actions.preconfigured.<connector-id>.config.apiProvider` is `OpenAI`.
|
For a <<gen-ai-action-type,generative AI connector>>, specifies the default model to use for requests. It is optional and applicable only when `xpack.actions.preconfigured.<connector-id>.config.apiProvider` is `OpenAI`.
|
||||||
|
|
||||||
`xpack.actions.preconfigured.<connector-id>.config.executionTimeField`::
|
`xpack.actions.preconfigured.<connector-id>.config.executionTimeField`::
|
||||||
For an <<index-action-type,index connector>>, a field that indicates when the document was indexed.
|
For an <<index-action-type,index connector>>, a field that indicates when the document was indexed.
|
||||||
|
@ -448,7 +448,7 @@ TIP: Sensitive properties, such as passwords, should be stored in the <<creating
|
||||||
An API key secret that varies by connector:
|
An API key secret that varies by connector:
|
||||||
+
|
+
|
||||||
--
|
--
|
||||||
* For a <<openai-action-type,OpenAI connector>>, specifies the OpenAI or Azure OpenAI API key for authentication.
|
* For a <<gen-ai-action-type,generative AI connector>>, specifies the OpenAI or Azure OpenAI API key for authentication.
|
||||||
* For an <<opsgenie-action-type,{opsgenie} connector>>, specifies the {opsgenie} API authentication key for HTTP basic authentication.
|
* For an <<opsgenie-action-type,{opsgenie} connector>>, specifies the {opsgenie} API authentication key for HTTP basic authentication.
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
## OpenAI Connector Streaming Response Example
|
## Generative AI Connector Streaming Response Example
|
||||||
|
|
||||||
This example plugin shows you how to stream a response from a OpenAI connector.
|
This example plugin shows you how to stream a response from a Generative AI connector.
|
||||||
|
|
||||||
To run this example, use the command `yarn start --run-examples`.
|
To run this example, use the command `yarn start --run-examples`.
|
|
@ -52,7 +52,7 @@ export const ListConnectors = ({
|
||||||
label={i18n.translate(
|
label={i18n.translate(
|
||||||
'genAiStreamingResponseExample.app.component.selectConnectorLabel',
|
'genAiStreamingResponseExample.app.component.selectConnectorLabel',
|
||||||
{
|
{
|
||||||
defaultMessage: 'Select an OpenAI Connector',
|
defaultMessage: 'Select a Generative AI Connector',
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
labelAppend={
|
labelAppend={
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { OpenAILogo } from '@kbn/stack-connectors-plugin/public/common';
|
import { GenAiLogo } from '@kbn/stack-connectors-plugin/public/common';
|
||||||
import { EuiFlexGroup, EuiCard, EuiFlexItem, EuiIcon } from '@elastic/eui';
|
import { EuiFlexGroup, EuiCard, EuiFlexItem, EuiIcon } from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
|
@ -20,11 +20,11 @@ export const SetupConnector = ({ setIsConnectorModalVisible }: SetupConnectorPro
|
||||||
<EuiFlexItem grow={false}>
|
<EuiFlexItem grow={false}>
|
||||||
<EuiCard
|
<EuiCard
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
icon={<EuiIcon size="xl" type={OpenAILogo} />}
|
icon={<EuiIcon size="xl" type={GenAiLogo} />}
|
||||||
title={i18n.translate(
|
title={i18n.translate(
|
||||||
'genAiStreamingResponseExample.app.component.addConnectorCardTitle',
|
'genAiStreamingResponseExample.app.component.addConnectorCardTitle',
|
||||||
{
|
{
|
||||||
defaultMessage: 'Add OpenAI Connector',
|
defaultMessage: 'Add Generative AI Connector',
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
description={i18n.translate(
|
description={i18n.translate(
|
||||||
|
|
|
@ -65,7 +65,7 @@ export const GenAiStreamingResponseExampleApp = ({
|
||||||
minimumLicenseRequired: 'platinum',
|
minimumLicenseRequired: 'platinum',
|
||||||
supportedFeatureIds: ['general'],
|
supportedFeatureIds: ['general'],
|
||||||
id: '.gen-ai',
|
id: '.gen-ai',
|
||||||
name: 'OpenAI',
|
name: 'Generative AI',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
});
|
});
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
|
|
|
@ -37,7 +37,7 @@ export class GenAiStreamingResponseExamplePlugin
|
||||||
) {
|
) {
|
||||||
core.application.register({
|
core.application.register({
|
||||||
id: 'GenAiStreamingResponseExample',
|
id: 'GenAiStreamingResponseExample',
|
||||||
title: 'OpenAI Streaming Response Example',
|
title: 'Generative AI Streaming Response Example',
|
||||||
navLinkStatus: AppNavLinkStatus.hidden,
|
navLinkStatus: AppNavLinkStatus.hidden,
|
||||||
async mount(params: AppMountParameters) {
|
async mount(params: AppMountParameters) {
|
||||||
const [coreStart, depsStart] = await core.getStartServices();
|
const [coreStart, depsStart] = await core.getStartServices();
|
||||||
|
@ -48,8 +48,9 @@ export class GenAiStreamingResponseExamplePlugin
|
||||||
|
|
||||||
developerExamples.register({
|
developerExamples.register({
|
||||||
appId: 'GenAiStreamingResponseExample',
|
appId: 'GenAiStreamingResponseExample',
|
||||||
title: 'OpenAI Streaming Response Example',
|
title: 'Generative AI Streaming Response Example',
|
||||||
description: 'This example demonstrates how to stream a response from an OpenAI connector',
|
description:
|
||||||
|
'This example demonstrates how to stream a response from a Generative AI connector',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ export class GenAiStreamingResponseExamplePlugin implements Plugin<void, void> {
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
throw Boom.badRequest(
|
throw Boom.badRequest(
|
||||||
`Invalid OpenAI connector selected - ${connector.config?.apiProvider} is not a valid provider`
|
`Invalid generative AI connector selected - ${connector.config?.apiProvider} is not a valid provider`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import {
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
import { DocLinksStart } from '@kbn/core-doc-links-browser';
|
import { DocLinksStart } from '@kbn/core-doc-links-browser';
|
||||||
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants';
|
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants';
|
||||||
import { Conversation } from '../../..';
|
import { Conversation } from '../../..';
|
||||||
import { AssistantTitle } from '../assistant_title';
|
import { AssistantTitle } from '../assistant_title';
|
||||||
import { ConversationSelector } from '../conversations/conversation_selector';
|
import { ConversationSelector } from '../conversations/conversation_selector';
|
||||||
|
|
|
@ -19,7 +19,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import useEvent from 'react-use/lib/useEvent';
|
import useEvent from 'react-use/lib/useEvent';
|
||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
|
|
||||||
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants';
|
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants';
|
||||||
import { Conversation } from '../../../..';
|
import { Conversation } from '../../../..';
|
||||||
import { useAssistantContext } from '../../../assistant_context';
|
import { useAssistantContext } from '../../../assistant_context';
|
||||||
import * as i18n from './translations';
|
import * as i18n from './translations';
|
||||||
|
|
|
@ -18,7 +18,7 @@ import {
|
||||||
import React, { useCallback, useMemo, useState } from 'react';
|
import React, { useCallback, useMemo, useState } from 'react';
|
||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
|
|
||||||
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants';
|
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants';
|
||||||
import { Conversation, Prompt } from '../../../..';
|
import { Conversation, Prompt } from '../../../..';
|
||||||
import { UseAssistantContext } from '../../../assistant_context';
|
import { UseAssistantContext } from '../../../assistant_context';
|
||||||
import * as i18n from './translations';
|
import * as i18n from './translations';
|
||||||
|
|
|
@ -29,7 +29,7 @@ import {
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
|
|
||||||
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants';
|
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants';
|
||||||
import { ActionConnectorProps } from '@kbn/triggers-actions-ui-plugin/public/types';
|
import { ActionConnectorProps } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||||
import { ChatSend } from './chat_send';
|
import { ChatSend } from './chat_send';
|
||||||
import { BlockBotCallToAction } from './block_bot/cta';
|
import { BlockBotCallToAction } from './block_bot/cta';
|
||||||
|
|
|
@ -23,7 +23,7 @@ import {
|
||||||
// eslint-disable-next-line @kbn/eslint/module_migration
|
// eslint-disable-next-line @kbn/eslint/module_migration
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants';
|
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants';
|
||||||
import { Conversation, Prompt, QuickPrompt } from '../../..';
|
import { Conversation, Prompt, QuickPrompt } from '../../..';
|
||||||
import * as i18n from './translations';
|
import * as i18n from './translations';
|
||||||
import { useAssistantContext } from '../../assistant_context';
|
import { useAssistantContext } from '../../assistant_context';
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { EuiButtonIcon, EuiToolTip } from '@elastic/eui';
|
import { EuiButtonIcon, EuiToolTip } from '@elastic/eui';
|
||||||
|
|
||||||
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants';
|
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants';
|
||||||
import { Conversation } from '../../..';
|
import { Conversation } from '../../..';
|
||||||
import { AssistantSettings, CONVERSATIONS_TAB } from './assistant_settings';
|
import { AssistantSettings, CONVERSATIONS_TAB } from './assistant_settings';
|
||||||
import * as i18n from './translations';
|
import * as i18n from './translations';
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants';
|
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants';
|
||||||
|
|
||||||
export type ConversationRole = 'system' | 'user' | 'assistant';
|
export type ConversationRole = 'system' | 'user' | 'assistant';
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { EuiCard, EuiFlexGroup, EuiFlexItem, EuiIcon } from '@elastic/eui';
|
import { EuiCard, EuiFlexGroup, EuiFlexItem, EuiIcon } from '@elastic/eui';
|
||||||
|
|
||||||
import { OpenAILogo } from '@kbn/stack-connectors-plugin/public/common';
|
import { GenAiLogo } from '@kbn/stack-connectors-plugin/public/common';
|
||||||
import * as i18n from '../translations';
|
import * as i18n from '../translations';
|
||||||
import { useAssistantContext } from '../../assistant_context';
|
import { useAssistantContext } from '../../assistant_context';
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ export const ConnectorButton: React.FC<ConnectorButtonProps> = React.memo<Connec
|
||||||
<EuiCard
|
<EuiCard
|
||||||
data-test-subj="connectorButton"
|
data-test-subj="connectorButton"
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
icon={<EuiIcon size="xl" type={OpenAILogo} />}
|
icon={<EuiIcon size="xl" type={GenAiLogo} />}
|
||||||
title={title}
|
title={title}
|
||||||
description={description}
|
description={description}
|
||||||
onClick={assistantAvailability.hasConnectorsAllPrivilege ? onClick : undefined}
|
onClick={assistantAvailability.hasConnectorsAllPrivilege ? onClick : undefined}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import type { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
|
import type { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
|
||||||
import { ActionConnectorProps } from '@kbn/triggers-actions-ui-plugin/public/types';
|
import { ActionConnectorProps } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||||
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants';
|
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants';
|
||||||
import { ActionTypeModel } from '@kbn/triggers-actions-ui-plugin/public';
|
import { ActionTypeModel } from '@kbn/triggers-actions-ui-plugin/public';
|
||||||
|
|
||||||
interface GenAiConfig {
|
interface GenAiConfig {
|
||||||
|
@ -20,7 +20,7 @@ interface GenAiConfig {
|
||||||
* Returns the GenAiConfig for a given ActionConnector. Note that if the connector is preconfigured,
|
* Returns the GenAiConfig for a given ActionConnector. Note that if the connector is preconfigured,
|
||||||
* the config will be undefined as the connector is neither available nor editable.
|
* the config will be undefined as the connector is neither available nor editable.
|
||||||
*
|
*
|
||||||
* TODO: Extract and use separate types from GenAiConfig from '@kbn/stack-connectors-plugin/common/openai/types'
|
* TODO: Extract and use separate types from GenAiConfig from '@kbn/stack-connectors-plugin/common/gen_ai/types'
|
||||||
*
|
*
|
||||||
* @param connector
|
* @param connector
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,7 +15,7 @@ import type { IHttpFetchError } from '@kbn/core-http-browser';
|
||||||
import type { ActionType } from '@kbn/actions-plugin/common';
|
import type { ActionType } from '@kbn/actions-plugin/common';
|
||||||
import { HttpSetup } from '@kbn/core-http-browser';
|
import { HttpSetup } from '@kbn/core-http-browser';
|
||||||
import { IToasts } from '@kbn/core-notifications-browser';
|
import { IToasts } from '@kbn/core-notifications-browser';
|
||||||
import { GenerativeAIConnectorFeatureId } from '@kbn/actions-plugin/common';
|
import { GeneralConnectorFeatureId } from '@kbn/actions-plugin/common';
|
||||||
import * as i18n from '../translations';
|
import * as i18n from '../translations';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,10 +37,7 @@ export const useLoadActionTypes = ({
|
||||||
QUERY_KEY,
|
QUERY_KEY,
|
||||||
|
|
||||||
async () => {
|
async () => {
|
||||||
const queryResult = await loadActionTypes({
|
const queryResult = await loadActionTypes({ http, featureId: GeneralConnectorFeatureId });
|
||||||
http,
|
|
||||||
featureId: GenerativeAIConnectorFeatureId,
|
|
||||||
});
|
|
||||||
const sortedData = queryResult.sort((a, b) => a.name.localeCompare(b.name));
|
const sortedData = queryResult.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
|
||||||
return sortedData;
|
return sortedData;
|
||||||
|
|
|
@ -19,7 +19,7 @@ export const WELCOME_GENERAL_2 = i18n.translate(
|
||||||
'xpack.elasticAssistant.securityAssistant.content.prompts.welcome.welcomeGeneral2Prompt',
|
'xpack.elasticAssistant.securityAssistant.content.prompts.welcome.welcomeGeneral2Prompt',
|
||||||
{
|
{
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
"First things first, we'll need to set up a Generative AI Connector to get this chat experience going! With the Generative AI Connector, you'll be able to configure access to either an OpenAI service or an AWS Bedrock service, but you better believe you'll be able to deploy your own models within your Elastic Cloud instance and use those here in the future... 😉",
|
"First things first, we'll need to set up a Generative AI Connector to get this chat experience going! With the Generative AI Connector, you'll be able to configure access to either an Azure OpenAI Service or OpenAI API account, but you better believe you'll be able to deploy your own models within your Elastic Cloud instance and use those here in the future... 😉",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants';
|
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants';
|
||||||
import { Conversation } from '../..';
|
import { Conversation } from '../..';
|
||||||
|
|
||||||
export const alertConvo: Conversation = {
|
export const alertConvo: Conversation = {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
|
|
||||||
describe('areValidFeatures', () => {
|
describe('areValidFeatures', () => {
|
||||||
it('returns true when all inputs are valid features', () => {
|
it('returns true when all inputs are valid features', () => {
|
||||||
expect(areValidFeatures(['alerting', 'cases', 'generativeAI'])).toBeTruthy();
|
expect(areValidFeatures(['alerting', 'cases', 'general'])).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns true when only one input and it is a valid feature', () => {
|
it('returns true when only one input and it is a valid feature', () => {
|
||||||
|
@ -42,9 +42,11 @@ describe('getConnectorFeatureName', () => {
|
||||||
|
|
||||||
describe('getConnectorCompatibility', () => {
|
describe('getConnectorCompatibility', () => {
|
||||||
it('returns the compatibility list for valid feature ids', () => {
|
it('returns the compatibility list for valid feature ids', () => {
|
||||||
expect(
|
expect(getConnectorCompatibility(['alerting', 'cases', 'uptime', 'siem', 'general'])).toEqual([
|
||||||
getConnectorCompatibility(['alerting', 'cases', 'uptime', 'siem', 'generativeAI'])
|
'Alerting Rules',
|
||||||
).toEqual(['Alerting Rules', 'Cases', 'Generative AI']);
|
'Cases',
|
||||||
|
'General',
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('skips invalid feature ids', () => {
|
it('skips invalid feature ids', () => {
|
||||||
|
|
|
@ -25,12 +25,12 @@ export const AlertingConnectorFeatureId = 'alerting';
|
||||||
export const CasesConnectorFeatureId = 'cases';
|
export const CasesConnectorFeatureId = 'cases';
|
||||||
export const UptimeConnectorFeatureId = 'uptime';
|
export const UptimeConnectorFeatureId = 'uptime';
|
||||||
export const SecurityConnectorFeatureId = 'siem';
|
export const SecurityConnectorFeatureId = 'siem';
|
||||||
export const GenerativeAIConnectorFeatureId = 'generativeAI';
|
export const GeneralConnectorFeatureId = 'general';
|
||||||
|
|
||||||
const compatibilityGenerativeAI = i18n.translate(
|
const compatibilityGeneral = i18n.translate(
|
||||||
'xpack.actions.availableConnectorFeatures.compatibility.generativeAI',
|
'xpack.actions.availableConnectorFeatures.compatibility.general',
|
||||||
{
|
{
|
||||||
defaultMessage: 'Generative AI',
|
defaultMessage: 'General',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -80,10 +80,10 @@ export const SecuritySolutionFeature: ConnectorFeatureConfig = {
|
||||||
compatibility: compatibilityAlertingRules,
|
compatibility: compatibilityAlertingRules,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const GenerativeAIFeature: ConnectorFeatureConfig = {
|
export const GeneralFeature: ConnectorFeatureConfig = {
|
||||||
id: GenerativeAIConnectorFeatureId,
|
id: GeneralConnectorFeatureId,
|
||||||
name: compatibilityGenerativeAI,
|
name: compatibilityGeneral,
|
||||||
compatibility: compatibilityGenerativeAI,
|
compatibility: compatibilityGeneral,
|
||||||
};
|
};
|
||||||
|
|
||||||
const AllAvailableConnectorFeatures = {
|
const AllAvailableConnectorFeatures = {
|
||||||
|
@ -91,7 +91,7 @@ const AllAvailableConnectorFeatures = {
|
||||||
[CasesConnectorFeature.id]: CasesConnectorFeature,
|
[CasesConnectorFeature.id]: CasesConnectorFeature,
|
||||||
[UptimeConnectorFeature.id]: UptimeConnectorFeature,
|
[UptimeConnectorFeature.id]: UptimeConnectorFeature,
|
||||||
[SecuritySolutionFeature.id]: SecuritySolutionFeature,
|
[SecuritySolutionFeature.id]: SecuritySolutionFeature,
|
||||||
[GenerativeAIFeature.id]: GenerativeAIFeature,
|
[GeneralFeature.id]: GeneralFeature,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function areValidFeatures(ids: string[]) {
|
export function areValidFeatures(ids: string[]) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ export {
|
||||||
CasesConnectorFeatureId,
|
CasesConnectorFeatureId,
|
||||||
UptimeConnectorFeatureId,
|
UptimeConnectorFeatureId,
|
||||||
SecurityConnectorFeatureId,
|
SecurityConnectorFeatureId,
|
||||||
GenerativeAIConnectorFeatureId,
|
GeneralConnectorFeatureId,
|
||||||
} from './connector_feature_config';
|
} from './connector_feature_config';
|
||||||
export interface ActionType {
|
export interface ActionType {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
|
@ -1768,7 +1768,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"config_properties_genai": {
|
"config_properties_genai": {
|
||||||
"title": "Connector request properties for an OpenAI connector",
|
"title": "Connector request properties for a generative AI connector",
|
||||||
"description": "Defines properties for connectors when type is `.gen-ai`.",
|
"description": "Defines properties for connectors when type is `.gen-ai`.",
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
{
|
{
|
||||||
|
@ -1821,7 +1821,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"secrets_properties_genai": {
|
"secrets_properties_genai": {
|
||||||
"title": "Connector secrets properties for an OpenAI connector",
|
"title": "Connector secrets properties for a generative AI connector",
|
||||||
"description": "Defines secrets for connectors when type is `.gen-ai`.",
|
"description": "Defines secrets for connectors when type is `.gen-ai`.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -1832,8 +1832,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"create_connector_request_genai": {
|
"create_connector_request_genai": {
|
||||||
"title": "Create OpenAI connector request",
|
"title": "Create generative AI connector request",
|
||||||
"description": "The OpenAI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.\n",
|
"description": "The generative AI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.\n",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"config",
|
"config",
|
||||||
|
@ -5722,4 +5722,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1031,14 +1031,14 @@ components:
|
||||||
type: boolean
|
type: boolean
|
||||||
host:
|
host:
|
||||||
description: |
|
description: |
|
||||||
The host name of the service provider. If the `service` is `elastic_cloud` (for Elastic Cloud notifications) or one of Nodemailer's well-known email service providers, this property is ignored. If `service` is `other`, this property must be defined.
|
The host name of the service provider. If the `service` is `elastic_cloud` (for Elastic Cloud notifications) or one of Nodemailer's well-known email service providers, this property is ignored. If `service` is `other`, this property must be defined.
|
||||||
type: string
|
type: string
|
||||||
oauthTokenUrl:
|
oauthTokenUrl:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
port:
|
port:
|
||||||
description: |
|
description: |
|
||||||
The port to connect to on the service provider. If the `service` is `elastic_cloud` (for Elastic Cloud notifications) or one of Nodemailer's well-known email service providers, this property is ignored. If `service` is `other`, this property must be defined.
|
The port to connect to on the service provider. If the `service` is `elastic_cloud` (for Elastic Cloud notifications) or one of Nodemailer's well-known email service providers, this property is ignored. If `service` is `other`, this property must be defined.
|
||||||
type: integer
|
type: integer
|
||||||
secure:
|
secure:
|
||||||
description: |
|
description: |
|
||||||
|
@ -1103,7 +1103,7 @@ components:
|
||||||
secrets:
|
secrets:
|
||||||
$ref: '#/components/schemas/secrets_properties_email'
|
$ref: '#/components/schemas/secrets_properties_email'
|
||||||
config_properties_genai:
|
config_properties_genai:
|
||||||
title: Connector request properties for an OpenAI connector
|
title: Connector request properties for a generative AI connector
|
||||||
description: Defines properties for connectors when type is `.gen-ai`.
|
description: Defines properties for connectors when type is `.gen-ai`.
|
||||||
oneOf:
|
oneOf:
|
||||||
- type: object
|
- type: object
|
||||||
|
@ -1138,7 +1138,7 @@ components:
|
||||||
discriminator:
|
discriminator:
|
||||||
propertyName: apiProvider
|
propertyName: apiProvider
|
||||||
secrets_properties_genai:
|
secrets_properties_genai:
|
||||||
title: Connector secrets properties for an OpenAI connector
|
title: Connector secrets properties for a generative AI connector
|
||||||
description: Defines secrets for connectors when type is `.gen-ai`.
|
description: Defines secrets for connectors when type is `.gen-ai`.
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -1146,9 +1146,9 @@ components:
|
||||||
type: string
|
type: string
|
||||||
description: The OpenAI API key.
|
description: The OpenAI API key.
|
||||||
create_connector_request_genai:
|
create_connector_request_genai:
|
||||||
title: Create OpenAI connector request
|
title: Create generative AI connector request
|
||||||
description: |
|
description: |
|
||||||
The OpenAI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.
|
The generative AI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
- config
|
- config
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
title: Connector request properties for an OpenAI connector
|
title: Connector request properties for a generative AI connector
|
||||||
description: Defines properties for connectors when type is `.gen-ai`.
|
description: Defines properties for connectors when type is `.gen-ai`.
|
||||||
oneOf:
|
oneOf:
|
||||||
- type: object
|
- type: object
|
||||||
|
@ -29,4 +29,4 @@ oneOf:
|
||||||
type: string
|
type: string
|
||||||
description: The default model to use for requests.
|
description: The default model to use for requests.
|
||||||
discriminator:
|
discriminator:
|
||||||
propertyName: apiProvider
|
propertyName: apiProvider
|
|
@ -1,4 +1,4 @@
|
||||||
title: Connector response properties for an OpenAI connector
|
title: Connector response properties for a generative AI connector
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
- config
|
- config
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
title: Create OpenAI connector request
|
title: Create generative AI connector request
|
||||||
description: >
|
description: >
|
||||||
The OpenAI connector uses axios to send a POST request to either
|
The generative AI connector uses axios to send a POST request to either
|
||||||
OpenAI or Azure OpenAPI.
|
OpenAI or Azure OpenAPI.
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
|
@ -22,4 +22,4 @@ properties:
|
||||||
description: The display name for the connector.
|
description: The display name for the connector.
|
||||||
example: my-connector
|
example: my-connector
|
||||||
secrets:
|
secrets:
|
||||||
$ref: 'secrets_properties_genai.yaml'
|
$ref: 'secrets_properties_genai.yaml'
|
|
@ -1,7 +1,7 @@
|
||||||
title: Connector secrets properties for an OpenAI connector
|
title: Connector secrets properties for a generative AI connector
|
||||||
description: Defines secrets for connectors when type is `.gen-ai`.
|
description: Defines secrets for connectors when type is `.gen-ai`.
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
apiKey:
|
apiKey:
|
||||||
type: string
|
type: string
|
||||||
description: The OpenAI API key.
|
description: The OpenAI API key.
|
|
@ -1,4 +1,4 @@
|
||||||
title: Update OpenAI connector request
|
title: Update generative AI connector request
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
- config
|
- config
|
||||||
|
@ -10,4 +10,4 @@ properties:
|
||||||
type: string
|
type: string
|
||||||
description: The display name for the connector.
|
description: The display name for the connector.
|
||||||
secrets:
|
secrets:
|
||||||
$ref: 'secrets_properties_genai.yaml'
|
$ref: 'secrets_properties_genai.yaml'
|
|
@ -1766,7 +1766,7 @@ test('writes to event log for execute and execute start when consumer and relate
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('writes usage data to event log for OpenAI events', async () => {
|
test('writes usage data to event log for gen ai events', async () => {
|
||||||
const executorMock = setupActionExecutorMock('.gen-ai');
|
const executorMock = setupActionExecutorMock('.gen-ai');
|
||||||
const mockGenAi = {
|
const mockGenAi = {
|
||||||
id: 'chatcmpl-7LztF5xsJl2z5jcNpJKvaPm4uWt8x',
|
id: 'chatcmpl-7LztF5xsJl2z5jcNpJKvaPm4uWt8x',
|
||||||
|
|
|
@ -286,8 +286,8 @@ export class ActionExecutor {
|
||||||
|
|
||||||
event.event = event.event || {};
|
event.event = event.event || {};
|
||||||
|
|
||||||
// start openai extension
|
// start gen_ai extension
|
||||||
// add event.kibana.action.execution.openai to event log when OpenAI Connector is executed
|
// add event.kibana.action.execution.gen_ai to event log when GenerativeAi Connector is executed
|
||||||
if (result.status === 'ok' && actionTypeId === '.gen-ai') {
|
if (result.status === 'ok' && actionTypeId === '.gen-ai') {
|
||||||
const data = result.data as unknown as {
|
const data = result.data as unknown as {
|
||||||
usage: { prompt_tokens?: number; completion_tokens?: number; total_tokens?: number };
|
usage: { prompt_tokens?: number; completion_tokens?: number; total_tokens?: number };
|
||||||
|
@ -311,7 +311,7 @@ export class ActionExecutor {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// end openai extension
|
// end gen_ai extension
|
||||||
|
|
||||||
const currentUser = security?.authc.getCurrentUser(request);
|
const currentUser = security?.authc.getCurrentUser(request);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ This document gives an overview of the features of the Observability AI Assistan
|
||||||
|
|
||||||
#### **1.1. Configuration**
|
#### **1.1. Configuration**
|
||||||
|
|
||||||
Users can connect to an LLM using [connectors](https://www.elastic.co/guide/en/kibana/current/action-types.html) - specifically the [OpenAI connector](https://www.elastic.co/guide/en/kibana/current/openai-action-type.html), which currently supports both OpenAI and Azure OpenAI as providers. The connector is Enterprise-only. Users can also leverage [preconfigured connectors](https://www.elastic.co/guide/en/kibana/current/pre-configured-connectors.html), in which case the following should be added to `kibana.yml`:
|
Users can connect to an LLM using [connectors](https://www.elastic.co/guide/en/kibana/current/action-types.html) - specifically the [Generative AI connector](https://www.elastic.co/guide/en/kibana/current/gen-ai-action-type.html), which currently supports both OpenAI and Azure OpenAI as providers. The connector is Enterprise-only. Users can also leverage [preconfigured connectors](https://www.elastic.co/guide/en/kibana/current/pre-configured-connectors.html), in which case the following should be added to `kibana.yml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
xpack.actions.preconfigured:
|
xpack.actions.preconfigured:
|
||||||
|
|
|
@ -143,7 +143,7 @@ export function InitialSetupPanel({
|
||||||
{i18n.translate(
|
{i18n.translate(
|
||||||
'xpack.observabilityAiAssistant.initialSetupPanel.setupConnector.description1',
|
'xpack.observabilityAiAssistant.initialSetupPanel.setupConnector.description1',
|
||||||
{
|
{
|
||||||
defaultMessage: 'Set up an OpenAI connector with your AI provider.',
|
defaultMessage: 'Set up a Generative AI connector with your AI provider.',
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
|
@ -153,7 +153,7 @@ export function InitialSetupPanel({
|
||||||
'xpack.observabilityAiAssistant.initialSetupPanel.setupConnector.description2',
|
'xpack.observabilityAiAssistant.initialSetupPanel.setupConnector.description2',
|
||||||
{
|
{
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
'The OpenAI model needs to support function calls. We strongly recommend using GPT4.',
|
'The Generative AI model needs to support function calls. We strongly recommend using GPT4.',
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
<EuiBetaBadge
|
<EuiBetaBadge
|
||||||
|
@ -197,7 +197,7 @@ export function InitialSetupPanel({
|
||||||
{i18n.translate(
|
{i18n.translate(
|
||||||
'xpack.observabilityAiAssistant.initialSetupPanel.setupConnector.buttonLabel',
|
'xpack.observabilityAiAssistant.initialSetupPanel.setupConnector.buttonLabel',
|
||||||
{
|
{
|
||||||
defaultMessage: 'Set up OpenAI connector',
|
defaultMessage: 'Set up Generative AI connector',
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
</EuiButton>
|
</EuiButton>
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
export const OPENAI_TITLE = i18n.translate(
|
export const OPEN_AI_TITLE = i18n.translate(
|
||||||
'xpack.stackConnectors.components.genAi.connectorTypeTitle',
|
'xpack.stackConnectors.components.genAi.connectorTypeTitle',
|
||||||
{
|
{
|
||||||
defaultMessage: 'OpenAI',
|
defaultMessage: 'OpenAI',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
export const OPENAI_CONNECTOR_ID = '.gen-ai';
|
export const GEN_AI_CONNECTOR_ID = '.gen-ai';
|
||||||
export enum SUB_ACTION {
|
export enum SUB_ACTION {
|
||||||
RUN = 'run',
|
RUN = 'run',
|
||||||
INVOKE_AI = 'invokeAI',
|
INVOKE_AI = 'invokeAI',
|
|
@ -5,7 +5,7 @@
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import OpenAILogo from '../connector_types/openai/logo';
|
import GenAiLogo from '../connector_types/gen_ai/logo';
|
||||||
|
|
||||||
export { OPENAI_CONNECTOR_ID, OpenAiProviderType } from '../../common/openai/constants';
|
export { GEN_AI_CONNECTOR_ID, OpenAiProviderType } from '../../common/gen_ai/constants';
|
||||||
export { OpenAILogo };
|
export { GenAiLogo };
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import { lazy } from 'react';
|
import { lazy } from 'react';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { GenericValidationResult } from '@kbn/triggers-actions-ui-plugin/public/types';
|
import { GenericValidationResult } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||||
import { SUB_ACTION } from '../../../common/d3security/constants';
|
import { SUB_ACTION } from '../../../common/gen_ai/constants';
|
||||||
import { D3SecurityActionParams, D3SecurityConnector } from './types';
|
import { D3SecurityActionParams, D3SecurityConnector } from './types';
|
||||||
import { D3_SECURITY_CONNECTOR_ID } from '../../../common/d3security/constants';
|
import { D3_SECURITY_CONNECTOR_ID } from '../../../common/d3security/constants';
|
||||||
interface ValidationErrors {
|
interface ValidationErrors {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import { httpServiceMock } from '@kbn/core-http-browser-mocks';
|
import { httpServiceMock } from '@kbn/core-http-browser-mocks';
|
||||||
import { getDashboard } from './api';
|
import { getDashboard } from './api';
|
||||||
import { SUB_ACTION } from '../../../common/openai/constants';
|
import { SUB_ACTION } from '../../../common/gen_ai/constants';
|
||||||
const response = {
|
const response = {
|
||||||
available: true,
|
available: true,
|
||||||
};
|
};
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import { HttpSetup } from '@kbn/core-http-browser';
|
import { HttpSetup } from '@kbn/core-http-browser';
|
||||||
import { ActionTypeExecutorResult, BASE_ACTION_API_PATH } from '@kbn/actions-plugin/common';
|
import { ActionTypeExecutorResult, BASE_ACTION_API_PATH } from '@kbn/actions-plugin/common';
|
||||||
import { SUB_ACTION } from '../../../common/openai/constants';
|
import { SUB_ACTION } from '../../../common/gen_ai/constants';
|
||||||
import { ConnectorExecutorResult, rewriteResponseToCamelCase } from '../lib/rewrite_response_body';
|
import { ConnectorExecutorResult, rewriteResponseToCamelCase } from '../lib/rewrite_response_body';
|
||||||
|
|
||||||
export async function getDashboard({
|
export async function getDashboard({
|
|
@ -6,11 +6,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ConnectorFields from './connector';
|
import GenerativeAiConnectorFields from './connector';
|
||||||
import { ConnectorFormTestProvider } from '../lib/test_utils';
|
import { ConnectorFormTestProvider } from '../lib/test_utils';
|
||||||
import { act, fireEvent, render, waitFor } from '@testing-library/react';
|
import { act, fireEvent, render, waitFor } from '@testing-library/react';
|
||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/openai/constants';
|
import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/gen_ai/constants';
|
||||||
import { useKibana } from '@kbn/triggers-actions-ui-plugin/public';
|
import { useKibana } from '@kbn/triggers-actions-ui-plugin/public';
|
||||||
import { useGetDashboard } from './use_get_dashboard';
|
import { useGetDashboard } from './use_get_dashboard';
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ const useKibanaMock = useKibana as jest.Mocked<typeof useKibana>;
|
||||||
const mockDashboard = useGetDashboard as jest.Mock;
|
const mockDashboard = useGetDashboard as jest.Mock;
|
||||||
const openAiConnector = {
|
const openAiConnector = {
|
||||||
actionTypeId: '.gen-ai',
|
actionTypeId: '.gen-ai',
|
||||||
name: 'OpenAI',
|
name: 'genAi',
|
||||||
id: '123',
|
id: '123',
|
||||||
config: {
|
config: {
|
||||||
apiUrl: 'https://openaiurl.com',
|
apiUrl: 'https://openaiurl.com',
|
||||||
|
@ -46,7 +46,7 @@ const azureConnector = {
|
||||||
|
|
||||||
const navigateToUrl = jest.fn();
|
const navigateToUrl = jest.fn();
|
||||||
|
|
||||||
describe('ConnectorFields renders', () => {
|
describe('GenerativeAiConnectorFields renders', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
useKibanaMock().services.application.navigateToUrl = navigateToUrl;
|
useKibanaMock().services.application.navigateToUrl = navigateToUrl;
|
||||||
|
@ -57,7 +57,11 @@ describe('ConnectorFields renders', () => {
|
||||||
test('open ai connector fields are rendered', async () => {
|
test('open ai connector fields are rendered', async () => {
|
||||||
const { getAllByTestId } = render(
|
const { getAllByTestId } = render(
|
||||||
<ConnectorFormTestProvider connector={openAiConnector}>
|
<ConnectorFormTestProvider connector={openAiConnector}>
|
||||||
<ConnectorFields readOnly={false} isEdit={false} registerPreSubmitValidator={() => {}} />
|
<GenerativeAiConnectorFields
|
||||||
|
readOnly={false}
|
||||||
|
isEdit={false}
|
||||||
|
registerPreSubmitValidator={() => {}}
|
||||||
|
/>
|
||||||
</ConnectorFormTestProvider>
|
</ConnectorFormTestProvider>
|
||||||
);
|
);
|
||||||
expect(getAllByTestId('config.apiUrl-input')[0]).toBeInTheDocument();
|
expect(getAllByTestId('config.apiUrl-input')[0]).toBeInTheDocument();
|
||||||
|
@ -73,7 +77,11 @@ describe('ConnectorFields renders', () => {
|
||||||
test('azure ai connector fields are rendered', async () => {
|
test('azure ai connector fields are rendered', async () => {
|
||||||
const { getAllByTestId } = render(
|
const { getAllByTestId } = render(
|
||||||
<ConnectorFormTestProvider connector={azureConnector}>
|
<ConnectorFormTestProvider connector={azureConnector}>
|
||||||
<ConnectorFields readOnly={false} isEdit={false} registerPreSubmitValidator={() => {}} />
|
<GenerativeAiConnectorFields
|
||||||
|
readOnly={false}
|
||||||
|
isEdit={false}
|
||||||
|
registerPreSubmitValidator={() => {}}
|
||||||
|
/>
|
||||||
</ConnectorFormTestProvider>
|
</ConnectorFormTestProvider>
|
||||||
);
|
);
|
||||||
expect(getAllByTestId('config.apiUrl-input')[0]).toBeInTheDocument();
|
expect(getAllByTestId('config.apiUrl-input')[0]).toBeInTheDocument();
|
||||||
|
@ -90,7 +98,11 @@ describe('ConnectorFields renders', () => {
|
||||||
it('Does not render if isEdit is false and dashboardUrl is defined', async () => {
|
it('Does not render if isEdit is false and dashboardUrl is defined', async () => {
|
||||||
const { queryByTestId } = render(
|
const { queryByTestId } = render(
|
||||||
<ConnectorFormTestProvider connector={openAiConnector}>
|
<ConnectorFormTestProvider connector={openAiConnector}>
|
||||||
<ConnectorFields readOnly={false} isEdit={false} registerPreSubmitValidator={() => {}} />
|
<GenerativeAiConnectorFields
|
||||||
|
readOnly={false}
|
||||||
|
isEdit={false}
|
||||||
|
registerPreSubmitValidator={() => {}}
|
||||||
|
/>
|
||||||
</ConnectorFormTestProvider>
|
</ConnectorFormTestProvider>
|
||||||
);
|
);
|
||||||
expect(queryByTestId('link-gen-ai-token-dashboard')).not.toBeInTheDocument();
|
expect(queryByTestId('link-gen-ai-token-dashboard')).not.toBeInTheDocument();
|
||||||
|
@ -101,7 +113,11 @@ describe('ConnectorFields renders', () => {
|
||||||
}));
|
}));
|
||||||
const { queryByTestId } = render(
|
const { queryByTestId } = render(
|
||||||
<ConnectorFormTestProvider connector={openAiConnector}>
|
<ConnectorFormTestProvider connector={openAiConnector}>
|
||||||
<ConnectorFields readOnly={false} isEdit={false} registerPreSubmitValidator={() => {}} />
|
<GenerativeAiConnectorFields
|
||||||
|
readOnly={false}
|
||||||
|
isEdit={false}
|
||||||
|
registerPreSubmitValidator={() => {}}
|
||||||
|
/>
|
||||||
</ConnectorFormTestProvider>
|
</ConnectorFormTestProvider>
|
||||||
);
|
);
|
||||||
expect(queryByTestId('link-gen-ai-token-dashboard')).not.toBeInTheDocument();
|
expect(queryByTestId('link-gen-ai-token-dashboard')).not.toBeInTheDocument();
|
||||||
|
@ -109,7 +125,11 @@ describe('ConnectorFields renders', () => {
|
||||||
it('Renders if isEdit is true and dashboardUrl is defined', async () => {
|
it('Renders if isEdit is true and dashboardUrl is defined', async () => {
|
||||||
const { getByTestId } = render(
|
const { getByTestId } = render(
|
||||||
<ConnectorFormTestProvider connector={openAiConnector}>
|
<ConnectorFormTestProvider connector={openAiConnector}>
|
||||||
<ConnectorFields readOnly={false} isEdit={true} registerPreSubmitValidator={() => {}} />
|
<GenerativeAiConnectorFields
|
||||||
|
readOnly={false}
|
||||||
|
isEdit={true}
|
||||||
|
registerPreSubmitValidator={() => {}}
|
||||||
|
/>
|
||||||
</ConnectorFormTestProvider>
|
</ConnectorFormTestProvider>
|
||||||
);
|
);
|
||||||
expect(getByTestId('link-gen-ai-token-dashboard')).toBeInTheDocument();
|
expect(getByTestId('link-gen-ai-token-dashboard')).toBeInTheDocument();
|
||||||
|
@ -117,7 +137,11 @@ describe('ConnectorFields renders', () => {
|
||||||
it('On click triggers redirect with correct saved object id', async () => {
|
it('On click triggers redirect with correct saved object id', async () => {
|
||||||
const { getByTestId } = render(
|
const { getByTestId } = render(
|
||||||
<ConnectorFormTestProvider connector={openAiConnector}>
|
<ConnectorFormTestProvider connector={openAiConnector}>
|
||||||
<ConnectorFields readOnly={false} isEdit={true} registerPreSubmitValidator={() => {}} />
|
<GenerativeAiConnectorFields
|
||||||
|
readOnly={false}
|
||||||
|
isEdit={true}
|
||||||
|
registerPreSubmitValidator={() => {}}
|
||||||
|
/>
|
||||||
</ConnectorFormTestProvider>
|
</ConnectorFormTestProvider>
|
||||||
);
|
);
|
||||||
fireEvent.click(getByTestId('link-gen-ai-token-dashboard'));
|
fireEvent.click(getByTestId('link-gen-ai-token-dashboard'));
|
||||||
|
@ -134,7 +158,11 @@ describe('ConnectorFields renders', () => {
|
||||||
it('connector validation succeeds when connector config is valid', async () => {
|
it('connector validation succeeds when connector config is valid', async () => {
|
||||||
const { getByTestId } = render(
|
const { getByTestId } = render(
|
||||||
<ConnectorFormTestProvider connector={openAiConnector} onSubmit={onSubmit}>
|
<ConnectorFormTestProvider connector={openAiConnector} onSubmit={onSubmit}>
|
||||||
<ConnectorFields readOnly={false} isEdit={false} registerPreSubmitValidator={() => {}} />
|
<GenerativeAiConnectorFields
|
||||||
|
readOnly={false}
|
||||||
|
isEdit={false}
|
||||||
|
registerPreSubmitValidator={() => {}}
|
||||||
|
/>
|
||||||
</ConnectorFormTestProvider>
|
</ConnectorFormTestProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -163,7 +191,11 @@ describe('ConnectorFields renders', () => {
|
||||||
|
|
||||||
const res = render(
|
const res = render(
|
||||||
<ConnectorFormTestProvider connector={connector} onSubmit={onSubmit}>
|
<ConnectorFormTestProvider connector={connector} onSubmit={onSubmit}>
|
||||||
<ConnectorFields readOnly={false} isEdit={false} registerPreSubmitValidator={() => {}} />
|
<GenerativeAiConnectorFields
|
||||||
|
readOnly={false}
|
||||||
|
isEdit={false}
|
||||||
|
registerPreSubmitValidator={() => {}}
|
||||||
|
/>
|
||||||
</ConnectorFormTestProvider>
|
</ConnectorFormTestProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -192,7 +224,11 @@ describe('ConnectorFields renders', () => {
|
||||||
|
|
||||||
const res = render(
|
const res = render(
|
||||||
<ConnectorFormTestProvider connector={connector} onSubmit={onSubmit}>
|
<ConnectorFormTestProvider connector={connector} onSubmit={onSubmit}>
|
||||||
<ConnectorFields readOnly={false} isEdit={false} registerPreSubmitValidator={() => {}} />
|
<GenerativeAiConnectorFields
|
||||||
|
readOnly={false}
|
||||||
|
isEdit={false}
|
||||||
|
registerPreSubmitValidator={() => {}}
|
||||||
|
/>
|
||||||
</ConnectorFormTestProvider>
|
</ConnectorFormTestProvider>
|
||||||
);
|
);
|
||||||
|
|
|
@ -19,8 +19,8 @@ import {
|
||||||
} from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
} from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||||
import { useKibana } from '@kbn/triggers-actions-ui-plugin/public';
|
import { useKibana } from '@kbn/triggers-actions-ui-plugin/public';
|
||||||
import { fieldValidators } from '@kbn/es-ui-shared-plugin/static/forms/helpers';
|
import { fieldValidators } from '@kbn/es-ui-shared-plugin/static/forms/helpers';
|
||||||
import { OpenAiProviderType } from '../../../common/openai/constants';
|
|
||||||
import { useGetDashboard } from './use_get_dashboard';
|
import { useGetDashboard } from './use_get_dashboard';
|
||||||
|
import { OpenAiProviderType } from '../../../common/gen_ai/constants';
|
||||||
import * as i18n from './translations';
|
import * as i18n from './translations';
|
||||||
import {
|
import {
|
||||||
azureAiConfig,
|
azureAiConfig,
|
||||||
|
@ -31,7 +31,10 @@ import {
|
||||||
} from './constants';
|
} from './constants';
|
||||||
const { emptyField } = fieldValidators;
|
const { emptyField } = fieldValidators;
|
||||||
|
|
||||||
const ConnectorFields: React.FC<ActionConnectorFieldsProps> = ({ readOnly, isEdit }) => {
|
const GenerativeAiConnectorFields: React.FC<ActionConnectorFieldsProps> = ({
|
||||||
|
readOnly,
|
||||||
|
isEdit,
|
||||||
|
}) => {
|
||||||
const { getFieldDefaultValue } = useFormContext();
|
const { getFieldDefaultValue } = useFormContext();
|
||||||
const [{ config, id, name }] = useFormData({
|
const [{ config, id, name }] = useFormData({
|
||||||
watch: ['config.apiProvider'],
|
watch: ['config.apiProvider'],
|
||||||
|
@ -114,4 +117,4 @@ const ConnectorFields: React.FC<ActionConnectorFieldsProps> = ({ readOnly, isEdi
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export { ConnectorFields as default };
|
export { GenerativeAiConnectorFields as default };
|
|
@ -9,7 +9,7 @@ import React from 'react';
|
||||||
import { ConfigFieldSchema, SecretsFieldSchema } from '@kbn/triggers-actions-ui-plugin/public';
|
import { ConfigFieldSchema, SecretsFieldSchema } from '@kbn/triggers-actions-ui-plugin/public';
|
||||||
import { FormattedMessage } from '@kbn/i18n-react';
|
import { FormattedMessage } from '@kbn/i18n-react';
|
||||||
import { EuiLink } from '@elastic/eui';
|
import { EuiLink } from '@elastic/eui';
|
||||||
import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/openai/constants';
|
import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/gen_ai/constants';
|
||||||
import * as i18n from './translations';
|
import * as i18n from './translations';
|
||||||
|
|
||||||
export const DEFAULT_URL = 'https://api.openai.com/v1/chat/completions' as const;
|
export const DEFAULT_URL = 'https://api.openai.com/v1/chat/completions' as const;
|
||||||
|
@ -46,7 +46,7 @@ export const openAiConfig: ConfigFieldSchema[] = [
|
||||||
href="https://platform.openai.com/docs/api-reference"
|
href="https://platform.openai.com/docs/api-reference"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
{`${i18n.OPENAI} ${i18n.DOCUMENTATION}`}
|
{`${i18n.OPEN_AI} ${i18n.DOCUMENTATION}`}
|
||||||
</EuiLink>
|
</EuiLink>
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
|
@ -108,7 +108,7 @@ export const openAiSecrets: SecretsFieldSchema[] = [
|
||||||
href="https://platform.openai.com/account/api-keys"
|
href="https://platform.openai.com/account/api-keys"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
{`${i18n.OPENAI} ${i18n.DOCUMENTATION}`}
|
{`${i18n.OPEN_AI} ${i18n.DOCUMENTATION}`}
|
||||||
</EuiLink>
|
</EuiLink>
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
|
@ -145,8 +145,8 @@ export const azureAiSecrets: SecretsFieldSchema[] = [
|
||||||
export const providerOptions = [
|
export const providerOptions = [
|
||||||
{
|
{
|
||||||
value: OpenAiProviderType.OpenAi,
|
value: OpenAiProviderType.OpenAi,
|
||||||
text: i18n.OPENAI,
|
text: i18n.OPEN_AI,
|
||||||
label: i18n.OPENAI,
|
label: i18n.OPEN_AI,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: OpenAiProviderType.AzureAi,
|
value: OpenAiProviderType.AzureAi,
|
|
@ -9,7 +9,7 @@ import { TypeRegistry } from '@kbn/triggers-actions-ui-plugin/public/application
|
||||||
import { registerConnectorTypes } from '..';
|
import { registerConnectorTypes } from '..';
|
||||||
import type { ActionTypeModel } from '@kbn/triggers-actions-ui-plugin/public/types';
|
import type { ActionTypeModel } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||||
import { registrationServicesMock } from '../../mocks';
|
import { registrationServicesMock } from '../../mocks';
|
||||||
import { SUB_ACTION } from '../../../common/openai/constants';
|
import { SUB_ACTION } from '../../../common/gen_ai/constants';
|
||||||
|
|
||||||
const ACTION_TYPE_ID = '.gen-ai';
|
const ACTION_TYPE_ID = '.gen-ai';
|
||||||
let actionTypeModel: ActionTypeModel;
|
let actionTypeModel: ActionTypeModel;
|
||||||
|
@ -26,12 +26,12 @@ beforeAll(() => {
|
||||||
describe('actionTypeRegistry.get() works', () => {
|
describe('actionTypeRegistry.get() works', () => {
|
||||||
test('connector type static data is as expected', () => {
|
test('connector type static data is as expected', () => {
|
||||||
expect(actionTypeModel.id).toEqual(ACTION_TYPE_ID);
|
expect(actionTypeModel.id).toEqual(ACTION_TYPE_ID);
|
||||||
expect(actionTypeModel.selectMessage).toBe('Send a request to OpenAI systems.');
|
expect(actionTypeModel.selectMessage).toBe('Send a request to generative AI systems.');
|
||||||
expect(actionTypeModel.actionTypeTitle).toBe('OpenAI');
|
expect(actionTypeModel.actionTypeTitle).toBe('OpenAI');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('OpenAI action params validation', () => {
|
describe('gen ai action params validation', () => {
|
||||||
test('action params validation succeeds when action params is valid', async () => {
|
test('action params validation succeeds when action params is valid', async () => {
|
||||||
const actionParams = {
|
const actionParams = {
|
||||||
subAction: SUB_ACTION.RUN,
|
subAction: SUB_ACTION.RUN,
|
|
@ -8,24 +8,24 @@
|
||||||
import { lazy } from 'react';
|
import { lazy } from 'react';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import type { GenericValidationResult } from '@kbn/triggers-actions-ui-plugin/public/types';
|
import type { GenericValidationResult } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||||
import { SUB_ACTION } from '../../../common/openai/constants';
|
import { SUB_ACTION } from '../../../common/gen_ai/constants';
|
||||||
import { OPENAI_CONNECTOR_ID, OPENAI_TITLE } from '../../../common/openai/constants';
|
import { GEN_AI_CONNECTOR_ID, OPEN_AI_TITLE } from '../../../common/gen_ai/constants';
|
||||||
import { ActionParams, OpenAIConnector } from './types';
|
import { GenerativeAiActionParams, GenerativeAiConnector } from './types';
|
||||||
|
|
||||||
interface ValidationErrors {
|
interface ValidationErrors {
|
||||||
subAction: string[];
|
subAction: string[];
|
||||||
body: string[];
|
body: string[];
|
||||||
}
|
}
|
||||||
export function getConnectorType(): OpenAIConnector {
|
export function getConnectorType(): GenerativeAiConnector {
|
||||||
return {
|
return {
|
||||||
id: OPENAI_CONNECTOR_ID,
|
id: GEN_AI_CONNECTOR_ID,
|
||||||
iconClass: lazy(() => import('./logo')),
|
iconClass: lazy(() => import('./logo')),
|
||||||
selectMessage: i18n.translate('xpack.stackConnectors.components.genAi.selectMessageText', {
|
selectMessage: i18n.translate('xpack.stackConnectors.components.genAi.selectMessageText', {
|
||||||
defaultMessage: 'Send a request to OpenAI systems.',
|
defaultMessage: 'Send a request to generative AI systems.',
|
||||||
}),
|
}),
|
||||||
actionTypeTitle: OPENAI_TITLE,
|
actionTypeTitle: OPEN_AI_TITLE,
|
||||||
validateParams: async (
|
validateParams: async (
|
||||||
actionParams: ActionParams
|
actionParams: GenerativeAiActionParams
|
||||||
): Promise<GenericValidationResult<ValidationErrors>> => {
|
): Promise<GenericValidationResult<ValidationErrors>> => {
|
||||||
const { subAction, subActionParams } = actionParams;
|
const { subAction, subActionParams } = actionParams;
|
||||||
const translations = await import('./translations');
|
const translations = await import('./translations');
|
|
@ -5,4 +5,4 @@
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export { getConnectorType as getOpenAIConnectorType } from './openai';
|
export { getConnectorType as getGenerativeAiConnectorType } from './gen_ai';
|
|
@ -7,9 +7,9 @@
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { fireEvent, render } from '@testing-library/react';
|
import { fireEvent, render } from '@testing-library/react';
|
||||||
import ParamsFields from './params';
|
import GenerativeAiParamsFields from './params';
|
||||||
import { MockCodeEditor } from '@kbn/triggers-actions-ui-plugin/public/application/code_editor.mock';
|
import { MockCodeEditor } from '@kbn/triggers-actions-ui-plugin/public/application/code_editor.mock';
|
||||||
import { OpenAiProviderType, SUB_ACTION } from '../../../common/openai/constants';
|
import { OpenAiProviderType, SUB_ACTION } from '../../../common/gen_ai/constants';
|
||||||
import { DEFAULT_BODY, DEFAULT_BODY_AZURE, DEFAULT_URL } from './constants';
|
import { DEFAULT_BODY, DEFAULT_BODY_AZURE, DEFAULT_URL } from './constants';
|
||||||
|
|
||||||
const kibanaReactPath = '../../../../../../src/plugins/kibana_react/public';
|
const kibanaReactPath = '../../../../../../src/plugins/kibana_react/public';
|
||||||
|
@ -34,7 +34,7 @@ const messageVariables = [
|
||||||
describe('Gen AI Params Fields renders', () => {
|
describe('Gen AI Params Fields renders', () => {
|
||||||
test('all params fields are rendered', () => {
|
test('all params fields are rendered', () => {
|
||||||
const { getByTestId } = render(
|
const { getByTestId } = render(
|
||||||
<ParamsFields
|
<GenerativeAiParamsFields
|
||||||
actionParams={{
|
actionParams={{
|
||||||
subAction: SUB_ACTION.RUN,
|
subAction: SUB_ACTION.RUN,
|
||||||
subActionParams: { body: '{"message": "test"}' },
|
subActionParams: { body: '{"message": "test"}' },
|
||||||
|
@ -67,14 +67,14 @@ describe('Gen AI Params Fields renders', () => {
|
||||||
isPreconfigured: false,
|
isPreconfigured: false,
|
||||||
isSystemAction: false as const,
|
isSystemAction: false as const,
|
||||||
isDeprecated: false,
|
isDeprecated: false,
|
||||||
name: 'My OpenAI Connector',
|
name: 'My GenAI Connector',
|
||||||
config: {
|
config: {
|
||||||
apiProvider,
|
apiProvider,
|
||||||
apiUrl: DEFAULT_URL,
|
apiUrl: DEFAULT_URL,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
render(
|
render(
|
||||||
<ParamsFields
|
<GenerativeAiParamsFields
|
||||||
actionParams={actionParams}
|
actionParams={actionParams}
|
||||||
actionConnector={actionConnector}
|
actionConnector={actionConnector}
|
||||||
editAction={editAction}
|
editAction={editAction}
|
||||||
|
@ -104,7 +104,7 @@ describe('Gen AI Params Fields renders', () => {
|
||||||
const editAction = jest.fn();
|
const editAction = jest.fn();
|
||||||
const errors = {};
|
const errors = {};
|
||||||
render(
|
render(
|
||||||
<ParamsFields
|
<GenerativeAiParamsFields
|
||||||
actionParams={actionParams}
|
actionParams={actionParams}
|
||||||
editAction={editAction}
|
editAction={editAction}
|
||||||
index={0}
|
index={0}
|
||||||
|
@ -120,7 +120,7 @@ describe('Gen AI Params Fields renders', () => {
|
||||||
const editAction = jest.fn();
|
const editAction = jest.fn();
|
||||||
const errors = {};
|
const errors = {};
|
||||||
const { getByTestId } = render(
|
const { getByTestId } = render(
|
||||||
<ParamsFields
|
<GenerativeAiParamsFields
|
||||||
actionParams={{
|
actionParams={{
|
||||||
subAction: SUB_ACTION.RUN,
|
subAction: SUB_ACTION.RUN,
|
||||||
subActionParams: {
|
subActionParams: {
|
|
@ -12,11 +12,13 @@ import {
|
||||||
ActionConnectorMode,
|
ActionConnectorMode,
|
||||||
JsonEditorWithMessageVariables,
|
JsonEditorWithMessageVariables,
|
||||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||||
import { OpenAiProviderType, SUB_ACTION } from '../../../common/openai/constants';
|
|
||||||
import { DEFAULT_BODY, DEFAULT_BODY_AZURE } from './constants';
|
import { DEFAULT_BODY, DEFAULT_BODY_AZURE } from './constants';
|
||||||
import { OpenAIActionConnector, ActionParams } from './types';
|
import { OpenAiProviderType, SUB_ACTION } from '../../../common/gen_ai/constants';
|
||||||
|
import { GenerativeAiActionConnector, GenerativeAiActionParams } from './types';
|
||||||
|
|
||||||
const ParamsFields: React.FunctionComponent<ActionParamsProps<ActionParams>> = ({
|
const GenerativeAiParamsFields: React.FunctionComponent<
|
||||||
|
ActionParamsProps<GenerativeAiActionParams>
|
||||||
|
> = ({
|
||||||
actionConnector,
|
actionConnector,
|
||||||
actionParams,
|
actionParams,
|
||||||
editAction,
|
editAction,
|
||||||
|
@ -29,7 +31,7 @@ const ParamsFields: React.FunctionComponent<ActionParamsProps<ActionParams>> = (
|
||||||
|
|
||||||
const { body } = subActionParams ?? {};
|
const { body } = subActionParams ?? {};
|
||||||
|
|
||||||
const typedActionConnector = actionConnector as unknown as OpenAIActionConnector;
|
const typedActionConnector = actionConnector as unknown as GenerativeAiActionConnector;
|
||||||
|
|
||||||
const isTest = useMemo(() => executionMode === ActionConnectorMode.Test, [executionMode]);
|
const isTest = useMemo(() => executionMode === ActionConnectorMode.Test, [executionMode]);
|
||||||
|
|
||||||
|
@ -53,7 +55,7 @@ const ParamsFields: React.FunctionComponent<ActionParamsProps<ActionParams>> = (
|
||||||
}, [typedActionConnector?.config?.apiProvider, editAction, index, subActionParams]);
|
}, [typedActionConnector?.config?.apiProvider, editAction, index, subActionParams]);
|
||||||
|
|
||||||
const editSubActionParams = useCallback(
|
const editSubActionParams = useCallback(
|
||||||
(params: ActionParams['subActionParams']) => {
|
(params: GenerativeAiActionParams['subActionParams']) => {
|
||||||
editAction('subActionParams', { ...subActionParams, ...params }, index);
|
editAction('subActionParams', { ...subActionParams, ...params }, index);
|
||||||
},
|
},
|
||||||
[editAction, index, subActionParams]
|
[editAction, index, subActionParams]
|
||||||
|
@ -85,4 +87,4 @@ const ParamsFields: React.FunctionComponent<ActionParamsProps<ActionParams>> = (
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export { ParamsFields as default };
|
export { GenerativeAiParamsFields as default };
|
|
@ -39,7 +39,7 @@ export const API_PROVIDER_LABEL = i18n.translate(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const OPENAI = i18n.translate('xpack.stackConnectors.components.genAi.openAi', {
|
export const OPEN_AI = i18n.translate('xpack.stackConnectors.components.genAi.openAi', {
|
||||||
defaultMessage: 'OpenAI',
|
defaultMessage: 'OpenAI',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -104,6 +104,6 @@ export const USAGE_DASHBOARD_LINK = (apiProvider: string, connectorName: string)
|
||||||
export const GET_DASHBOARD_API_ERROR = i18n.translate(
|
export const GET_DASHBOARD_API_ERROR = i18n.translate(
|
||||||
'xpack.stackConnectors.components.genAi.error.dashboardApiError',
|
'xpack.stackConnectors.components.genAi.error.dashboardApiError',
|
||||||
{
|
{
|
||||||
defaultMessage: 'Error finding OpenAI Token Usage Dashboard.',
|
defaultMessage: 'Error finding Generative AI Token Usage Dashboard.',
|
||||||
}
|
}
|
||||||
);
|
);
|
|
@ -7,22 +7,29 @@
|
||||||
|
|
||||||
import { ActionTypeModel as ConnectorTypeModel } from '@kbn/triggers-actions-ui-plugin/public';
|
import { ActionTypeModel as ConnectorTypeModel } from '@kbn/triggers-actions-ui-plugin/public';
|
||||||
import { UserConfiguredActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
import { UserConfiguredActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||||
import { OpenAiProviderType, SUB_ACTION } from '../../../common/openai/constants';
|
import { OpenAiProviderType, SUB_ACTION } from '../../../common/gen_ai/constants';
|
||||||
import { RunActionParams } from '../../../common/openai/types';
|
import { RunActionParams } from '../../../common/gen_ai/types';
|
||||||
|
|
||||||
export interface ActionParams {
|
export interface GenerativeAiActionParams {
|
||||||
subAction: SUB_ACTION.RUN | SUB_ACTION.TEST;
|
subAction: SUB_ACTION.RUN | SUB_ACTION.TEST;
|
||||||
subActionParams: RunActionParams;
|
subActionParams: RunActionParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Config {
|
export interface GenerativeAiConfig {
|
||||||
apiProvider: OpenAiProviderType;
|
apiProvider: OpenAiProviderType;
|
||||||
apiUrl: string;
|
apiUrl: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Secrets {
|
export interface GenerativeAiSecrets {
|
||||||
apiKey: string;
|
apiKey: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type OpenAIConnector = ConnectorTypeModel<Config, Secrets, ActionParams>;
|
export type GenerativeAiConnector = ConnectorTypeModel<
|
||||||
export type OpenAIActionConnector = UserConfiguredActionConnector<Config, Secrets>;
|
GenerativeAiConfig,
|
||||||
|
GenerativeAiSecrets,
|
||||||
|
GenerativeAiActionParams
|
||||||
|
>;
|
||||||
|
export type GenerativeAiActionConnector = UserConfiguredActionConnector<
|
||||||
|
GenerativeAiConfig,
|
||||||
|
GenerativeAiSecrets
|
||||||
|
>;
|
|
@ -123,7 +123,7 @@ describe('useGetDashboard_function', () => {
|
||||||
await waitForNextUpdate();
|
await waitForNextUpdate();
|
||||||
expect(result.current.isLoading).toBe(false);
|
expect(result.current.isLoading).toBe(false);
|
||||||
expect(mockToasts.addDanger).toHaveBeenCalledWith({
|
expect(mockToasts.addDanger).toHaveBeenCalledWith({
|
||||||
title: 'Error finding OpenAI Token Usage Dashboard.',
|
title: 'Error finding Generative AI Token Usage Dashboard.',
|
||||||
text: 'Error fetching dashboard',
|
text: 'Error fetching dashboard',
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -11,7 +11,7 @@ import { getCasesWebhookConnectorType } from './cases_webhook';
|
||||||
import { getEmailConnectorType } from './email';
|
import { getEmailConnectorType } from './email';
|
||||||
import { getIndexConnectorType } from './es_index';
|
import { getIndexConnectorType } from './es_index';
|
||||||
import { getJiraConnectorType } from './jira';
|
import { getJiraConnectorType } from './jira';
|
||||||
import { getOpenAIConnectorType } from './openai';
|
import { getGenerativeAiConnectorType } from './gen_ai';
|
||||||
import { getBedrockConnectorType } from './bedrock';
|
import { getBedrockConnectorType } from './bedrock';
|
||||||
import { getOpsgenieConnectorType } from './opsgenie';
|
import { getOpsgenieConnectorType } from './opsgenie';
|
||||||
import { getPagerDutyConnectorType } from './pagerduty';
|
import { getPagerDutyConnectorType } from './pagerduty';
|
||||||
|
@ -60,7 +60,7 @@ export function registerConnectorTypes({
|
||||||
connectorTypeRegistry.register(getJiraConnectorType());
|
connectorTypeRegistry.register(getJiraConnectorType());
|
||||||
connectorTypeRegistry.register(getResilientConnectorType());
|
connectorTypeRegistry.register(getResilientConnectorType());
|
||||||
connectorTypeRegistry.register(getOpsgenieConnectorType());
|
connectorTypeRegistry.register(getOpsgenieConnectorType());
|
||||||
connectorTypeRegistry.register(getOpenAIConnectorType());
|
connectorTypeRegistry.register(getGenerativeAiConnectorType());
|
||||||
connectorTypeRegistry.register(getBedrockConnectorType());
|
connectorTypeRegistry.register(getBedrockConnectorType());
|
||||||
connectorTypeRegistry.register(getTeamsConnectorType());
|
connectorTypeRegistry.register(getTeamsConnectorType());
|
||||||
connectorTypeRegistry.register(getTorqConnectorType());
|
connectorTypeRegistry.register(getTorqConnectorType());
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
SubActionConnectorType,
|
SubActionConnectorType,
|
||||||
ValidatorType,
|
ValidatorType,
|
||||||
} from '@kbn/actions-plugin/server/sub_action_framework/types';
|
} from '@kbn/actions-plugin/server/sub_action_framework/types';
|
||||||
import { GenerativeAIConnectorFeatureId } from '@kbn/actions-plugin/common';
|
import { GeneralConnectorFeatureId } from '@kbn/actions-plugin/common';
|
||||||
import { urlAllowListValidator } from '@kbn/actions-plugin/server';
|
import { urlAllowListValidator } from '@kbn/actions-plugin/server';
|
||||||
import { ValidatorServices } from '@kbn/actions-plugin/server/types';
|
import { ValidatorServices } from '@kbn/actions-plugin/server/types';
|
||||||
import { assertURL } from '@kbn/actions-plugin/server/sub_action_framework/helpers/validators';
|
import { assertURL } from '@kbn/actions-plugin/server/sub_action_framework/helpers/validators';
|
||||||
|
@ -29,7 +29,7 @@ export const getConnectorType = (): SubActionConnectorType<Config, Secrets> => (
|
||||||
secrets: SecretsSchema,
|
secrets: SecretsSchema,
|
||||||
},
|
},
|
||||||
validators: [{ type: ValidatorType.CONFIG, validator: configValidator }],
|
validators: [{ type: ValidatorType.CONFIG, validator: configValidator }],
|
||||||
supportedFeatureIds: [GenerativeAIConnectorFeatureId],
|
supportedFeatureIds: [GeneralConnectorFeatureId],
|
||||||
minimumLicenseRequired: 'enterprise' as const,
|
minimumLicenseRequired: 'enterprise' as const,
|
||||||
renderParameterTemplates,
|
renderParameterTemplates,
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { DashboardAttributes } from '@kbn/dashboard-plugin/common';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import { SavedObject } from '@kbn/core-saved-objects-common/src/server_types';
|
import { SavedObject } from '@kbn/core-saved-objects-common/src/server_types';
|
||||||
|
|
||||||
export const dashboardTitle = `OpenAI Token Usage`;
|
export const dashboardTitle = `Generative AI Token Usage`;
|
||||||
|
|
||||||
export const getDashboard = (dashboardId: string): SavedObject<DashboardAttributes> => {
|
export const getDashboard = (dashboardId: string): SavedObject<DashboardAttributes> => {
|
||||||
const ids: Record<string, string> = {
|
const ids: Record<string, string> = {
|
||||||
|
@ -125,7 +125,7 @@ export const getDashboard = (dashboardId: string): SavedObject<DashboardAttribut
|
||||||
yLeft: 0,
|
yLeft: 0,
|
||||||
yRight: 0,
|
yRight: 0,
|
||||||
},
|
},
|
||||||
yTitle: 'Sum of OpenAI Completion + Prompt Tokens',
|
yTitle: 'Sum of GenAi Completion + Prompt Tokens',
|
||||||
axisTitlesVisibilitySettings: {
|
axisTitlesVisibilitySettings: {
|
||||||
x: true,
|
x: true,
|
||||||
yLeft: true,
|
yLeft: true,
|
||||||
|
@ -143,7 +143,7 @@ export const getDashboard = (dashboardId: string): SavedObject<DashboardAttribut
|
||||||
'475e8ca0-e78e-454a-8597-a5492f70dce3': {
|
'475e8ca0-e78e-454a-8597-a5492f70dce3': {
|
||||||
columns: {
|
columns: {
|
||||||
'0f9814ec-0964-4efa-93a3-c7f173df2483': {
|
'0f9814ec-0964-4efa-93a3-c7f173df2483': {
|
||||||
label: 'OpenAI Completion Tokens',
|
label: 'GenAI Completion Tokens',
|
||||||
dataType: 'number',
|
dataType: 'number',
|
||||||
operationType: 'sum',
|
operationType: 'sum',
|
||||||
sourceField: 'kibana.action.execution.gen_ai.usage.completion_tokens',
|
sourceField: 'kibana.action.execution.gen_ai.usage.completion_tokens',
|
||||||
|
@ -177,7 +177,7 @@ export const getDashboard = (dashboardId: string): SavedObject<DashboardAttribut
|
||||||
includeIsRegex: false,
|
includeIsRegex: false,
|
||||||
excludeIsRegex: false,
|
excludeIsRegex: false,
|
||||||
orderAgg: {
|
orderAgg: {
|
||||||
label: 'Sum of kibana.action.execution.openai.usage.total_tokens',
|
label: 'Sum of kibana.action.execution.gen_ai.usage.total_tokens',
|
||||||
dataType: 'number',
|
dataType: 'number',
|
||||||
operationType: 'sum',
|
operationType: 'sum',
|
||||||
sourceField: 'kibana.action.execution.gen_ai.usage.total_tokens',
|
sourceField: 'kibana.action.execution.gen_ai.usage.total_tokens',
|
||||||
|
@ -192,7 +192,7 @@ export const getDashboard = (dashboardId: string): SavedObject<DashboardAttribut
|
||||||
customLabel: true,
|
customLabel: true,
|
||||||
},
|
},
|
||||||
'b0e390e4-d754-4eb4-9fcc-4347dadda394': {
|
'b0e390e4-d754-4eb4-9fcc-4347dadda394': {
|
||||||
label: 'OpenAI Prompt Tokens',
|
label: 'GenAi Prompt Tokens',
|
||||||
dataType: 'number',
|
dataType: 'number',
|
||||||
operationType: 'sum',
|
operationType: 'sum',
|
||||||
sourceField: 'kibana.action.execution.gen_ai.usage.prompt_tokens',
|
sourceField: 'kibana.action.execution.gen_ai.usage.prompt_tokens',
|
||||||
|
@ -334,7 +334,7 @@ export const getDashboard = (dashboardId: string): SavedObject<DashboardAttribut
|
||||||
customLabel: true,
|
customLabel: true,
|
||||||
},
|
},
|
||||||
'b0e390e4-d754-4eb4-9fcc-4347dadda394': {
|
'b0e390e4-d754-4eb4-9fcc-4347dadda394': {
|
||||||
label: 'Sum of OpenAI Total Tokens',
|
label: 'Sum of GenAI Total Tokens',
|
||||||
dataType: 'number',
|
dataType: 'number',
|
||||||
operationType: 'sum',
|
operationType: 'sum',
|
||||||
sourceField: 'kibana.action.execution.gen_ai.usage.total_tokens',
|
sourceField: 'kibana.action.execution.gen_ai.usage.total_tokens',
|
|
@ -5,20 +5,20 @@
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { OpenAIConnector } from './openai';
|
import { GenAiConnector } from './gen_ai';
|
||||||
import { actionsConfigMock } from '@kbn/actions-plugin/server/actions_config.mock';
|
import { actionsConfigMock } from '@kbn/actions-plugin/server/actions_config.mock';
|
||||||
import {
|
import {
|
||||||
DEFAULT_OPENAI_MODEL,
|
DEFAULT_OPENAI_MODEL,
|
||||||
OPENAI_CONNECTOR_ID,
|
GEN_AI_CONNECTOR_ID,
|
||||||
OpenAiProviderType,
|
OpenAiProviderType,
|
||||||
} from '../../../common/openai/constants';
|
} from '../../../common/gen_ai/constants';
|
||||||
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
|
||||||
import { actionsMock } from '@kbn/actions-plugin/server/mocks';
|
import { actionsMock } from '@kbn/actions-plugin/server/mocks';
|
||||||
import { RunActionResponseSchema, StreamingResponseSchema } from '../../../common/openai/schema';
|
import { RunActionResponseSchema, StreamingResponseSchema } from '../../../common/gen_ai/schema';
|
||||||
import { initDashboard } from './create_dashboard';
|
import { initDashboard } from './create_dashboard';
|
||||||
jest.mock('./create_dashboard');
|
jest.mock('./create_dashboard');
|
||||||
|
|
||||||
describe('OpenAIConnector', () => {
|
describe('GenAiConnector', () => {
|
||||||
let mockRequest: jest.Mock;
|
let mockRequest: jest.Mock;
|
||||||
let mockError: jest.Mock;
|
let mockError: jest.Mock;
|
||||||
const mockResponseString = 'Hello! How can I assist you today?';
|
const mockResponseString = 'Hello! How can I assist you today?';
|
||||||
|
@ -46,9 +46,9 @@ describe('OpenAIConnector', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('OpenAI', () => {
|
describe('OpenAI', () => {
|
||||||
const connector = new OpenAIConnector({
|
const connector = new GenAiConnector({
|
||||||
configurationUtilities: actionsConfigMock.create(),
|
configurationUtilities: actionsConfigMock.create(),
|
||||||
connector: { id: '1', type: OPENAI_CONNECTOR_ID },
|
connector: { id: '1', type: GEN_AI_CONNECTOR_ID },
|
||||||
config: {
|
config: {
|
||||||
apiUrl: 'https://api.openai.com/v1/chat/completions',
|
apiUrl: 'https://api.openai.com/v1/chat/completions',
|
||||||
apiProvider: OpenAiProviderType.OpenAi,
|
apiProvider: OpenAiProviderType.OpenAi,
|
||||||
|
@ -285,9 +285,9 @@ describe('OpenAIConnector', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('AzureAI', () => {
|
describe('AzureAI', () => {
|
||||||
const connector = new OpenAIConnector({
|
const connector = new GenAiConnector({
|
||||||
configurationUtilities: actionsConfigMock.create(),
|
configurationUtilities: actionsConfigMock.create(),
|
||||||
connector: { id: '1', type: OPENAI_CONNECTOR_ID },
|
connector: { id: '1', type: GEN_AI_CONNECTOR_ID },
|
||||||
config: {
|
config: {
|
||||||
apiUrl:
|
apiUrl:
|
||||||
'https://My-test-resource-123.openai.azure.com/openai/deployments/NEW-DEPLOYMENT-321/chat/completions?api-version=2023-05-15',
|
'https://My-test-resource-123.openai.azure.com/openai/deployments/NEW-DEPLOYMENT-321/chat/completions?api-version=2023-05-15',
|
||||||
|
@ -455,9 +455,9 @@ describe('OpenAIConnector', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Token dashboard', () => {
|
describe('Token dashboard', () => {
|
||||||
const connector = new OpenAIConnector({
|
const connector = new GenAiConnector({
|
||||||
configurationUtilities: actionsConfigMock.create(),
|
configurationUtilities: actionsConfigMock.create(),
|
||||||
connector: { id: '1', type: OPENAI_CONNECTOR_ID },
|
connector: { id: '1', type: GEN_AI_CONNECTOR_ID },
|
||||||
config: { apiUrl: 'https://example.com/api', apiProvider: OpenAiProviderType.AzureAi },
|
config: { apiUrl: 'https://example.com/api', apiProvider: OpenAiProviderType.AzureAi },
|
||||||
secrets: { apiKey: '123' },
|
secrets: { apiKey: '123' },
|
||||||
logger: loggingSystemMock.createLogger(),
|
logger: loggingSystemMock.createLogger(),
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
import { ServiceParams, SubActionConnector } from '@kbn/actions-plugin/server';
|
import { ServiceParams, SubActionConnector } from '@kbn/actions-plugin/server';
|
||||||
import type { AxiosError } from 'axios';
|
import type { AxiosError } from 'axios';
|
||||||
|
import { initDashboard } from './create_dashboard';
|
||||||
import {
|
import {
|
||||||
RunActionParamsSchema,
|
RunActionParamsSchema,
|
||||||
RunActionResponseSchema,
|
RunActionResponseSchema,
|
||||||
|
@ -14,22 +15,21 @@ import {
|
||||||
StreamActionParamsSchema,
|
StreamActionParamsSchema,
|
||||||
StreamingResponseSchema,
|
StreamingResponseSchema,
|
||||||
InvokeAIActionParamsSchema,
|
InvokeAIActionParamsSchema,
|
||||||
} from '../../../common/openai/schema';
|
} from '../../../common/gen_ai/schema';
|
||||||
import type {
|
import type {
|
||||||
Config,
|
Config,
|
||||||
Secrets,
|
Secrets,
|
||||||
RunActionParams,
|
RunActionParams,
|
||||||
RunActionResponse,
|
RunActionResponse,
|
||||||
StreamActionParams,
|
StreamActionParams,
|
||||||
} from '../../../common/openai/types';
|
} from '../../../common/gen_ai/types';
|
||||||
import { SUB_ACTION } from '../../../common/openai/constants';
|
import { SUB_ACTION } from '../../../common/gen_ai/constants';
|
||||||
import {
|
import {
|
||||||
DashboardActionParams,
|
DashboardActionParams,
|
||||||
DashboardActionResponse,
|
DashboardActionResponse,
|
||||||
InvokeAIActionParams,
|
InvokeAIActionParams,
|
||||||
InvokeAIActionResponse,
|
InvokeAIActionResponse,
|
||||||
} from '../../../common/openai/types';
|
} from '../../../common/gen_ai/types';
|
||||||
import { initDashboard } from './create_dashboard';
|
|
||||||
import {
|
import {
|
||||||
getAxiosOptions,
|
getAxiosOptions,
|
||||||
getRequestWithStreamOption,
|
getRequestWithStreamOption,
|
||||||
|
@ -37,7 +37,7 @@ import {
|
||||||
sanitizeRequest,
|
sanitizeRequest,
|
||||||
} from './lib/utils';
|
} from './lib/utils';
|
||||||
|
|
||||||
export class OpenAIConnector extends SubActionConnector<Config, Secrets> {
|
export class GenAiConnector extends SubActionConnector<Config, Secrets> {
|
||||||
private url;
|
private url;
|
||||||
private provider;
|
private provider;
|
||||||
private key;
|
private key;
|
|
@ -9,9 +9,9 @@ import { actionsConfigMock } from '@kbn/actions-plugin/server/actions_config.moc
|
||||||
import { ActionsConfigurationUtilities } from '@kbn/actions-plugin/server/actions_config';
|
import { ActionsConfigurationUtilities } from '@kbn/actions-plugin/server/actions_config';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { configValidator, getConnectorType } from '.';
|
import { configValidator, getConnectorType } from '.';
|
||||||
import { Config, Secrets } from '../../../common/openai/types';
|
import { Config, Secrets } from '../../../common/gen_ai/types';
|
||||||
import { SubActionConnectorType } from '@kbn/actions-plugin/server/sub_action_framework/types';
|
import { SubActionConnectorType } from '@kbn/actions-plugin/server/sub_action_framework/types';
|
||||||
import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/openai/constants';
|
import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/gen_ai/constants';
|
||||||
|
|
||||||
jest.mock('axios');
|
jest.mock('axios');
|
||||||
jest.mock('@kbn/actions-plugin/server/lib/axios_utils', () => {
|
jest.mock('@kbn/actions-plugin/server/lib/axios_utils', () => {
|
||||||
|
@ -30,12 +30,12 @@ axios.create = jest.fn(() => axios);
|
||||||
let connectorType: SubActionConnectorType<Config, Secrets>;
|
let connectorType: SubActionConnectorType<Config, Secrets>;
|
||||||
let configurationUtilities: jest.Mocked<ActionsConfigurationUtilities>;
|
let configurationUtilities: jest.Mocked<ActionsConfigurationUtilities>;
|
||||||
|
|
||||||
describe('OpenAI Connector', () => {
|
describe('Generative AI Connector', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
configurationUtilities = actionsConfigMock.create();
|
configurationUtilities = actionsConfigMock.create();
|
||||||
connectorType = getConnectorType();
|
connectorType = getConnectorType();
|
||||||
});
|
});
|
||||||
test('exposes the connector as `OpenAI` with id `.gen-ai`', () => {
|
test('exposes the connector as `Generative AI` with id `.gen-ai`', () => {
|
||||||
expect(connectorType.id).toEqual('.gen-ai');
|
expect(connectorType.id).toEqual('.gen-ai');
|
||||||
expect(connectorType.name).toEqual('OpenAI');
|
expect(connectorType.name).toEqual('OpenAI');
|
||||||
});
|
});
|
||||||
|
@ -59,7 +59,7 @@ describe('OpenAI Connector', () => {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
configValidator(config, { configurationUtilities });
|
configValidator(config, { configurationUtilities });
|
||||||
}).toThrowErrorMatchingInlineSnapshot(
|
}).toThrowErrorMatchingInlineSnapshot(
|
||||||
'"Error configuring OpenAI action: Error: URL Error: Invalid URL: example.com/do-something"'
|
'"Error configuring Generative AI action: Error: URL Error: Invalid URL: example.com/do-something"'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ describe('OpenAI Connector', () => {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
configValidator(config, { configurationUtilities });
|
configValidator(config, { configurationUtilities });
|
||||||
}).toThrowErrorMatchingInlineSnapshot(
|
}).toThrowErrorMatchingInlineSnapshot(
|
||||||
'"Error configuring OpenAI action: Error: API Provider is not supported"'
|
'"Error configuring Generative AI action: Error: API Provider is not supported"'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ describe('OpenAI Connector', () => {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
configValidator(config, { configurationUtilities });
|
configValidator(config, { configurationUtilities });
|
||||||
}).toThrowErrorMatchingInlineSnapshot(
|
}).toThrowErrorMatchingInlineSnapshot(
|
||||||
'"Error configuring OpenAI action: Error: API Provider is not supported: bad-one"'
|
'"Error configuring Generative AI action: Error: API Provider is not supported: bad-one"'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ describe('OpenAI Connector', () => {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
configValidator(config, { configurationUtilities: configUtils });
|
configValidator(config, { configurationUtilities: configUtils });
|
||||||
}).toThrowErrorMatchingInlineSnapshot(
|
}).toThrowErrorMatchingInlineSnapshot(
|
||||||
`"Error configuring OpenAI action: Error: error validating url: target url is not present in allowedHosts"`
|
`"Error configuring Generative AI action: Error: error validating url: target url is not present in allowedHosts"`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -10,30 +10,30 @@ import {
|
||||||
SubActionConnectorType,
|
SubActionConnectorType,
|
||||||
ValidatorType,
|
ValidatorType,
|
||||||
} from '@kbn/actions-plugin/server/sub_action_framework/types';
|
} from '@kbn/actions-plugin/server/sub_action_framework/types';
|
||||||
import { GenerativeAIConnectorFeatureId } from '@kbn/actions-plugin/common';
|
import { GeneralConnectorFeatureId } from '@kbn/actions-plugin/common';
|
||||||
import { urlAllowListValidator } from '@kbn/actions-plugin/server';
|
import { urlAllowListValidator } from '@kbn/actions-plugin/server';
|
||||||
import { ValidatorServices } from '@kbn/actions-plugin/server/types';
|
import { ValidatorServices } from '@kbn/actions-plugin/server/types';
|
||||||
import { assertURL } from '@kbn/actions-plugin/server/sub_action_framework/helpers/validators';
|
import { assertURL } from '@kbn/actions-plugin/server/sub_action_framework/helpers/validators';
|
||||||
import {
|
import {
|
||||||
OPENAI_CONNECTOR_ID,
|
GEN_AI_CONNECTOR_ID,
|
||||||
OPENAI_TITLE,
|
OPEN_AI_TITLE,
|
||||||
OpenAiProviderType,
|
OpenAiProviderType,
|
||||||
} from '../../../common/openai/constants';
|
} from '../../../common/gen_ai/constants';
|
||||||
import { ConfigSchema, SecretsSchema } from '../../../common/openai/schema';
|
import { ConfigSchema, SecretsSchema } from '../../../common/gen_ai/schema';
|
||||||
import { Config, Secrets } from '../../../common/openai/types';
|
import { Config, Secrets } from '../../../common/gen_ai/types';
|
||||||
import { OpenAIConnector } from './openai';
|
import { GenAiConnector } from './gen_ai';
|
||||||
import { renderParameterTemplates } from './render';
|
import { renderParameterTemplates } from './render';
|
||||||
|
|
||||||
export const getConnectorType = (): SubActionConnectorType<Config, Secrets> => ({
|
export const getConnectorType = (): SubActionConnectorType<Config, Secrets> => ({
|
||||||
id: OPENAI_CONNECTOR_ID,
|
id: GEN_AI_CONNECTOR_ID,
|
||||||
name: OPENAI_TITLE,
|
name: OPEN_AI_TITLE,
|
||||||
Service: OpenAIConnector,
|
Service: GenAiConnector,
|
||||||
schema: {
|
schema: {
|
||||||
config: ConfigSchema,
|
config: ConfigSchema,
|
||||||
secrets: SecretsSchema,
|
secrets: SecretsSchema,
|
||||||
},
|
},
|
||||||
validators: [{ type: ValidatorType.CONFIG, validator: configValidator }],
|
validators: [{ type: ValidatorType.CONFIG, validator: configValidator }],
|
||||||
supportedFeatureIds: [GenerativeAIConnectorFeatureId],
|
supportedFeatureIds: [GeneralConnectorFeatureId],
|
||||||
minimumLicenseRequired: 'enterprise' as const,
|
minimumLicenseRequired: 'enterprise' as const,
|
||||||
renderParameterTemplates,
|
renderParameterTemplates,
|
||||||
});
|
});
|
||||||
|
@ -57,7 +57,7 @@ export const configValidator = (configObject: Config, validatorServices: Validat
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
i18n.translate('xpack.stackConnectors.genAi.configurationErrorApiProvider', {
|
i18n.translate('xpack.stackConnectors.genAi.configurationErrorApiProvider', {
|
||||||
defaultMessage: 'Error configuring OpenAI action: {err}',
|
defaultMessage: 'Error configuring Generative AI action: {err}',
|
||||||
values: {
|
values: {
|
||||||
err,
|
err,
|
||||||
},
|
},
|
|
@ -14,7 +14,7 @@ import {
|
||||||
AZURE_OPENAI_CHAT_URL,
|
AZURE_OPENAI_CHAT_URL,
|
||||||
AZURE_OPENAI_COMPLETIONS_URL,
|
AZURE_OPENAI_COMPLETIONS_URL,
|
||||||
AZURE_OPENAI_COMPLETIONS_EXTENSIONS_URL,
|
AZURE_OPENAI_COMPLETIONS_EXTENSIONS_URL,
|
||||||
} from '../../../../common/openai/constants';
|
} from '../../../../common/gen_ai/constants';
|
||||||
|
|
||||||
describe('Azure Open AI Utils', () => {
|
describe('Azure Open AI Utils', () => {
|
||||||
const chatUrl =
|
const chatUrl =
|
|
@ -9,7 +9,7 @@ import {
|
||||||
AZURE_OPENAI_CHAT_URL,
|
AZURE_OPENAI_CHAT_URL,
|
||||||
AZURE_OPENAI_COMPLETIONS_URL,
|
AZURE_OPENAI_COMPLETIONS_URL,
|
||||||
AZURE_OPENAI_COMPLETIONS_EXTENSIONS_URL,
|
AZURE_OPENAI_COMPLETIONS_EXTENSIONS_URL,
|
||||||
} from '../../../../common/openai/constants';
|
} from '../../../../common/gen_ai/constants';
|
||||||
|
|
||||||
const APIS_ALLOWING_STREAMING = new Set<string>([
|
const APIS_ALLOWING_STREAMING = new Set<string>([
|
||||||
AZURE_OPENAI_CHAT_URL,
|
AZURE_OPENAI_CHAT_URL,
|
|
@ -10,7 +10,7 @@ import {
|
||||||
DEFAULT_OPENAI_MODEL,
|
DEFAULT_OPENAI_MODEL,
|
||||||
OPENAI_CHAT_URL,
|
OPENAI_CHAT_URL,
|
||||||
OPENAI_LEGACY_COMPLETION_URL,
|
OPENAI_LEGACY_COMPLETION_URL,
|
||||||
} from '../../../../common/openai/constants';
|
} from '../../../../common/gen_ai/constants';
|
||||||
|
|
||||||
describe('Open AI Utils', () => {
|
describe('Open AI Utils', () => {
|
||||||
describe('sanitizeRequest', () => {
|
describe('sanitizeRequest', () => {
|
|
@ -5,7 +5,7 @@
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { OPENAI_CHAT_URL, OPENAI_LEGACY_COMPLETION_URL } from '../../../../common/openai/constants';
|
import { OPENAI_CHAT_URL, OPENAI_LEGACY_COMPLETION_URL } from '../../../../common/gen_ai/constants';
|
||||||
|
|
||||||
const APIS_ALLOWING_STREAMING = new Set<string>([OPENAI_CHAT_URL, OPENAI_LEGACY_COMPLETION_URL]);
|
const APIS_ALLOWING_STREAMING = new Set<string>([OPENAI_CHAT_URL, OPENAI_LEGACY_COMPLETION_URL]);
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
DEFAULT_OPENAI_MODEL,
|
DEFAULT_OPENAI_MODEL,
|
||||||
OpenAiProviderType,
|
OpenAiProviderType,
|
||||||
OPENAI_CHAT_URL,
|
OPENAI_CHAT_URL,
|
||||||
} from '../../../../common/openai/constants';
|
} from '../../../../common/gen_ai/constants';
|
||||||
import {
|
import {
|
||||||
sanitizeRequest as openAiSanitizeRequest,
|
sanitizeRequest as openAiSanitizeRequest,
|
||||||
getRequestWithStreamOption as openAiGetRequestWithStreamOption,
|
getRequestWithStreamOption as openAiGetRequestWithStreamOption,
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import { AxiosResponse, ResponseType } from 'axios';
|
import { AxiosResponse, ResponseType } from 'axios';
|
||||||
import { IncomingMessage } from 'http';
|
import { IncomingMessage } from 'http';
|
||||||
import { OpenAiProviderType } from '../../../../common/openai/constants';
|
import { OpenAiProviderType } from '../../../../common/gen_ai/constants';
|
||||||
import {
|
import {
|
||||||
sanitizeRequest as openAiSanitizeRequest,
|
sanitizeRequest as openAiSanitizeRequest,
|
||||||
getRequestWithStreamOption as openAiGetRequestWithStreamOption,
|
getRequestWithStreamOption as openAiGetRequestWithStreamOption,
|
|
@ -17,7 +17,7 @@ const params = {
|
||||||
|
|
||||||
const variables = { domain: 'm0zepcuuu2' };
|
const variables = { domain: 'm0zepcuuu2' };
|
||||||
|
|
||||||
describe('OpenAI - renderParameterTemplates', () => {
|
describe('GenAI - renderParameterTemplates', () => {
|
||||||
it('should not render body on test action', () => {
|
it('should not render body on test action', () => {
|
||||||
const testParams = { subAction: 'test', subActionParams: { body: 'test_json' } };
|
const testParams = { subAction: 'test', subActionParams: { body: 'test_json' } };
|
||||||
const result = renderParameterTemplates(testParams, variables);
|
const result = renderParameterTemplates(testParams, variables);
|
|
@ -8,7 +8,7 @@
|
||||||
import { ExecutorParams } from '@kbn/actions-plugin/server/sub_action_framework/types';
|
import { ExecutorParams } from '@kbn/actions-plugin/server/sub_action_framework/types';
|
||||||
import { renderMustacheString } from '@kbn/actions-plugin/server/lib/mustache_renderer';
|
import { renderMustacheString } from '@kbn/actions-plugin/server/lib/mustache_renderer';
|
||||||
import { RenderParameterTemplates } from '@kbn/actions-plugin/server/types';
|
import { RenderParameterTemplates } from '@kbn/actions-plugin/server/types';
|
||||||
import { SUB_ACTION } from '../../../common/openai/constants';
|
import { SUB_ACTION } from '../../../common/gen_ai/constants';
|
||||||
|
|
||||||
export const renderParameterTemplates: RenderParameterTemplates<ExecutorParams> = (
|
export const renderParameterTemplates: RenderParameterTemplates<ExecutorParams> = (
|
||||||
params,
|
params,
|
|
@ -17,7 +17,7 @@ import { getTinesConnectorType } from './tines';
|
||||||
import { getActionType as getTorqConnectorType } from './torq';
|
import { getActionType as getTorqConnectorType } from './torq';
|
||||||
import { getConnectorType as getEmailConnectorType } from './email';
|
import { getConnectorType as getEmailConnectorType } from './email';
|
||||||
import { getConnectorType as getIndexConnectorType } from './es_index';
|
import { getConnectorType as getIndexConnectorType } from './es_index';
|
||||||
import { getConnectorType as getOpenAIConnectorType } from './openai';
|
import { getConnectorType as getGenerativeAiConnectorType } from './gen_ai';
|
||||||
import { getConnectorType as getBedrockConnectorType } from './bedrock';
|
import { getConnectorType as getBedrockConnectorType } from './bedrock';
|
||||||
import { getConnectorType as getPagerDutyConnectorType } from './pagerduty';
|
import { getConnectorType as getPagerDutyConnectorType } from './pagerduty';
|
||||||
import { getConnectorType as getSwimlaneConnectorType } from './swimlane';
|
import { getConnectorType as getSwimlaneConnectorType } from './swimlane';
|
||||||
|
@ -101,7 +101,7 @@ export function registerConnectorTypes({
|
||||||
|
|
||||||
actions.registerSubActionConnectorType(getOpsgenieConnectorType());
|
actions.registerSubActionConnectorType(getOpsgenieConnectorType());
|
||||||
actions.registerSubActionConnectorType(getTinesConnectorType());
|
actions.registerSubActionConnectorType(getTinesConnectorType());
|
||||||
actions.registerSubActionConnectorType(getOpenAIConnectorType());
|
actions.registerSubActionConnectorType(getGenerativeAiConnectorType());
|
||||||
actions.registerSubActionConnectorType(getBedrockConnectorType());
|
actions.registerSubActionConnectorType(getBedrockConnectorType());
|
||||||
actions.registerSubActionConnectorType(getD3SecurityConnectorType());
|
actions.registerSubActionConnectorType(getD3SecurityConnectorType());
|
||||||
}
|
}
|
||||||
|
|
|
@ -7073,6 +7073,7 @@
|
||||||
"xpack.actions.availableConnectorFeatures.cases": "Cas",
|
"xpack.actions.availableConnectorFeatures.cases": "Cas",
|
||||||
"xpack.actions.availableConnectorFeatures.compatibility.alertingRules": "Règles d'alerting",
|
"xpack.actions.availableConnectorFeatures.compatibility.alertingRules": "Règles d'alerting",
|
||||||
"xpack.actions.availableConnectorFeatures.compatibility.cases": "Cas",
|
"xpack.actions.availableConnectorFeatures.compatibility.cases": "Cas",
|
||||||
|
"xpack.actions.availableConnectorFeatures.compatibility.general": "Général",
|
||||||
"xpack.actions.availableConnectorFeatures.securitySolution": "Solution de sécurité",
|
"xpack.actions.availableConnectorFeatures.securitySolution": "Solution de sécurité",
|
||||||
"xpack.actions.availableConnectorFeatures.uptime": "Uptime",
|
"xpack.actions.availableConnectorFeatures.uptime": "Uptime",
|
||||||
"xpack.actions.builtin.cases.jiraTitle": "Jira",
|
"xpack.actions.builtin.cases.jiraTitle": "Jira",
|
||||||
|
@ -39765,4 +39766,4 @@
|
||||||
"xpack.painlessLab.walkthroughButtonLabel": "Présentation",
|
"xpack.painlessLab.walkthroughButtonLabel": "Présentation",
|
||||||
"xpack.serverlessObservability.nav.getStarted": "Démarrer"
|
"xpack.serverlessObservability.nav.getStarted": "Démarrer"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7089,6 +7089,7 @@
|
||||||
"xpack.actions.availableConnectorFeatures.cases": "ケース",
|
"xpack.actions.availableConnectorFeatures.cases": "ケース",
|
||||||
"xpack.actions.availableConnectorFeatures.compatibility.alertingRules": "アラートルール",
|
"xpack.actions.availableConnectorFeatures.compatibility.alertingRules": "アラートルール",
|
||||||
"xpack.actions.availableConnectorFeatures.compatibility.cases": "ケース",
|
"xpack.actions.availableConnectorFeatures.compatibility.cases": "ケース",
|
||||||
|
"xpack.actions.availableConnectorFeatures.compatibility.general": "一般",
|
||||||
"xpack.actions.availableConnectorFeatures.securitySolution": "セキュリティソリューション",
|
"xpack.actions.availableConnectorFeatures.securitySolution": "セキュリティソリューション",
|
||||||
"xpack.actions.availableConnectorFeatures.uptime": "アップタイム",
|
"xpack.actions.availableConnectorFeatures.uptime": "アップタイム",
|
||||||
"xpack.actions.builtin.cases.jiraTitle": "Jira",
|
"xpack.actions.builtin.cases.jiraTitle": "Jira",
|
||||||
|
@ -39756,4 +39757,4 @@
|
||||||
"xpack.painlessLab.walkthroughButtonLabel": "実地検証",
|
"xpack.painlessLab.walkthroughButtonLabel": "実地検証",
|
||||||
"xpack.serverlessObservability.nav.getStarted": "使ってみる"
|
"xpack.serverlessObservability.nav.getStarted": "使ってみる"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7088,6 +7088,7 @@
|
||||||
"xpack.actions.availableConnectorFeatures.cases": "案例",
|
"xpack.actions.availableConnectorFeatures.cases": "案例",
|
||||||
"xpack.actions.availableConnectorFeatures.compatibility.alertingRules": "告警规则",
|
"xpack.actions.availableConnectorFeatures.compatibility.alertingRules": "告警规则",
|
||||||
"xpack.actions.availableConnectorFeatures.compatibility.cases": "案例",
|
"xpack.actions.availableConnectorFeatures.compatibility.cases": "案例",
|
||||||
|
"xpack.actions.availableConnectorFeatures.compatibility.general": "常规",
|
||||||
"xpack.actions.availableConnectorFeatures.securitySolution": "安全解决方案",
|
"xpack.actions.availableConnectorFeatures.securitySolution": "安全解决方案",
|
||||||
"xpack.actions.availableConnectorFeatures.uptime": "运行时间",
|
"xpack.actions.availableConnectorFeatures.uptime": "运行时间",
|
||||||
"xpack.actions.builtin.cases.jiraTitle": "Jira",
|
"xpack.actions.builtin.cases.jiraTitle": "Jira",
|
||||||
|
@ -39750,4 +39751,4 @@
|
||||||
"xpack.painlessLab.walkthroughButtonLabel": "指导",
|
"xpack.painlessLab.walkthroughButtonLabel": "指导",
|
||||||
"xpack.serverlessObservability.nav.getStarted": "开始使用"
|
"xpack.serverlessObservability.nav.getStarted": "开始使用"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,7 +9,7 @@ import http from 'http';
|
||||||
|
|
||||||
import { ProxyArgs, Simulator } from './simulator';
|
import { ProxyArgs, Simulator } from './simulator';
|
||||||
|
|
||||||
export class OpenAISimulator extends Simulator {
|
export class GenAiSimulator extends Simulator {
|
||||||
private readonly returnError: boolean;
|
private readonly returnError: boolean;
|
||||||
|
|
||||||
constructor({ returnError = false, proxy }: { returnError?: boolean; proxy?: ProxyArgs }) {
|
constructor({ returnError = false, proxy }: { returnError?: boolean; proxy?: ProxyArgs }) {
|
||||||
|
@ -24,10 +24,10 @@ export class OpenAISimulator extends Simulator {
|
||||||
data: Record<string, unknown>
|
data: Record<string, unknown>
|
||||||
) {
|
) {
|
||||||
if (this.returnError) {
|
if (this.returnError) {
|
||||||
return OpenAISimulator.sendErrorResponse(response);
|
return GenAiSimulator.sendErrorResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OpenAISimulator.sendResponse(response);
|
return GenAiSimulator.sendResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static sendResponse(response: http.ServerResponse) {
|
private static sendResponse(response: http.ServerResponse) {
|
|
@ -8,9 +8,9 @@
|
||||||
import expect from '@kbn/expect';
|
import expect from '@kbn/expect';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
OpenAISimulator,
|
GenAiSimulator,
|
||||||
genAiSuccessResponse,
|
genAiSuccessResponse,
|
||||||
} from '@kbn/actions-simulators-plugin/server/openai_simulation';
|
} from '@kbn/actions-simulators-plugin/server/gen_ai_simulation';
|
||||||
import { FtrProviderContext } from '../../../../../common/ftr_provider_context';
|
import { FtrProviderContext } from '../../../../../common/ftr_provider_context';
|
||||||
import { getUrlPrefix, ObjectRemover } from '../../../../../common/lib';
|
import { getUrlPrefix, ObjectRemover } from '../../../../../common/lib';
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {
|
||||||
objectRemover.removeAll();
|
objectRemover.removeAll();
|
||||||
});
|
});
|
||||||
describe('action creation', () => {
|
describe('action creation', () => {
|
||||||
const simulator = new OpenAISimulator({
|
const simulator = new GenAiSimulator({
|
||||||
returnError: false,
|
returnError: false,
|
||||||
proxy: {
|
proxy: {
|
||||||
config: configService.get('kbnTestServer.serverArgs'),
|
config: configService.get('kbnTestServer.serverArgs'),
|
||||||
|
@ -189,7 +189,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {
|
||||||
statusCode: 400,
|
statusCode: 400,
|
||||||
error: 'Bad Request',
|
error: 'Bad Request',
|
||||||
message:
|
message:
|
||||||
'error validating action type config: Error configuring OpenAI action: Error: error validating url: target url "http://genAi.mynonexistent.com" is not added to the Kibana config xpack.actions.allowedHosts',
|
'error validating action type config: Error configuring Generative AI action: Error: error validating url: target url "http://genAi.mynonexistent.com" is not added to the Kibana config xpack.actions.allowedHosts',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -217,7 +217,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {
|
||||||
|
|
||||||
describe('executor', () => {
|
describe('executor', () => {
|
||||||
describe('validation', () => {
|
describe('validation', () => {
|
||||||
const simulator = new OpenAISimulator({
|
const simulator = new GenAiSimulator({
|
||||||
proxy: {
|
proxy: {
|
||||||
config: configService.get('kbnTestServer.serverArgs'),
|
config: configService.get('kbnTestServer.serverArgs'),
|
||||||
},
|
},
|
||||||
|
@ -272,7 +272,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {
|
||||||
|
|
||||||
describe('execution', () => {
|
describe('execution', () => {
|
||||||
describe('successful response simulator', () => {
|
describe('successful response simulator', () => {
|
||||||
const simulator = new OpenAISimulator({
|
const simulator = new GenAiSimulator({
|
||||||
proxy: {
|
proxy: {
|
||||||
config: configService.get('kbnTestServer.serverArgs'),
|
config: configService.get('kbnTestServer.serverArgs'),
|
||||||
},
|
},
|
||||||
|
@ -313,7 +313,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {
|
||||||
data: genAiSuccessResponse,
|
data: genAiSuccessResponse,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('OpenAI dashboard', () => {
|
describe('gen ai dashboard', () => {
|
||||||
const dashboardId = 'specific-dashboard-id-default';
|
const dashboardId = 'specific-dashboard-id-default';
|
||||||
|
|
||||||
it('should not create a dashboard when user does not have kibana event log permissions', async () => {
|
it('should not create a dashboard when user does not have kibana event log permissions', async () => {
|
||||||
|
@ -377,7 +377,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('non-default space simulator', () => {
|
describe('non-default space simulator', () => {
|
||||||
const simulator = new OpenAISimulator({
|
const simulator = new GenAiSimulator({
|
||||||
proxy: {
|
proxy: {
|
||||||
config: configService.get('kbnTestServer.serverArgs'),
|
config: configService.get('kbnTestServer.serverArgs'),
|
||||||
},
|
},
|
||||||
|
@ -428,7 +428,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('error response simulator', () => {
|
describe('error response simulator', () => {
|
||||||
const simulator = new OpenAISimulator({
|
const simulator = new GenAiSimulator({
|
||||||
returnError: true,
|
returnError: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
config: configService.get('kbnTestServer.serverArgs'),
|
config: configService.get('kbnTestServer.serverArgs'),
|
|
@ -39,7 +39,7 @@ export default function connectorsTests({ loadTestFile, getService }: FtrProvide
|
||||||
loadTestFile(require.resolve('./connector_types/xmatters'));
|
loadTestFile(require.resolve('./connector_types/xmatters'));
|
||||||
loadTestFile(require.resolve('./connector_types/tines'));
|
loadTestFile(require.resolve('./connector_types/tines'));
|
||||||
loadTestFile(require.resolve('./connector_types/torq'));
|
loadTestFile(require.resolve('./connector_types/torq'));
|
||||||
loadTestFile(require.resolve('./connector_types/openai'));
|
loadTestFile(require.resolve('./connector_types/gen_ai'));
|
||||||
loadTestFile(require.resolve('./connector_types/d3security'));
|
loadTestFile(require.resolve('./connector_types/d3security'));
|
||||||
loadTestFile(require.resolve('./connector_types/bedrock'));
|
loadTestFile(require.resolve('./connector_types/bedrock'));
|
||||||
loadTestFile(require.resolve('./create'));
|
loadTestFile(require.resolve('./create'));
|
||||||
|
|
|
@ -21,13 +21,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||||
`"content": "You are a cyber security analyst using Elastic Security. I would like you to evaluate the event below and format your output neatly in markdown syntax. Add your description, an accuracy rating, and a threat rating."\n` +
|
`"content": "You are a cyber security analyst using Elastic Security. I would like you to evaluate the event below and format your output neatly in markdown syntax. Add your description, an accuracy rating, and a threat rating."\n` +
|
||||||
`}]`;
|
`}]`;
|
||||||
|
|
||||||
describe('OpenAI connector', function () {
|
describe('generative ai connector', function () {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await pageObjects.common.navigateToApp('connectors');
|
await pageObjects.common.navigateToApp('connectors');
|
||||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('OpenAI connector screenshots', async () => {
|
it('generative ai connector screenshots', async () => {
|
||||||
await pageObjects.common.navigateToApp('connectors');
|
await pageObjects.common.navigateToApp('connectors');
|
||||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||||
await actions.common.openNewConnectorForm('gen-ai');
|
await actions.common.openNewConnectorForm('gen-ai');
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('xmatters connector screenshots', async () => {
|
it('generative ai connector screenshots', async () => {
|
||||||
await pageObjects.common.navigateToApp('connectors');
|
await pageObjects.common.navigateToApp('connectors');
|
||||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||||
await actions.common.openNewConnectorForm('xmatters');
|
await actions.common.openNewConnectorForm('xmatters');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue