From e4b126c75a443d50da56cf8165f0bd824465ed87 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Thu, 28 Sep 2023 08:36:22 -0700 Subject: [PATCH] [8.10] [OAS] Add defaultModel to generative AI connector (#166394) (#166879) # Backport This will backport the following commits from `main` to `8.10`: - [[OAS] Add defaultModel to generative AI connector (#166394)](https://github.com/elastic/kibana/pull/166394) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) --- .../connector-apis-passthru.asciidoc | 101 +++++++++++++----- .../plugins/actions/docs/openapi/bundled.json | 57 ++++++++-- .../plugins/actions/docs/openapi/bundled.yaml | 41 +++++-- .../schemas/config_properties_genai.yaml | 32 +++++- .../update_connector_request_genai.yaml | 13 +++ ...}@api@actions@connector@{connectorid}.yaml | 2 +- 6 files changed, 198 insertions(+), 48 deletions(-) create mode 100644 x-pack/plugins/actions/docs/openapi/components/schemas/update_connector_request_genai.yaml diff --git a/docs/api-generated/connectors/connector-apis-passthru.asciidoc b/docs/api-generated/connectors/connector-apis-passthru.asciidoc index f5128f88f1b1e..164099437dff3 100644 --- a/docs/api-generated/connectors/connector-apis-passthru.asciidoc +++ b/docs/api-generated/connectors/connector-apis-passthru.asciidoc @@ -7,8 +7,8 @@ Any modifications made to this file will be overwritten.

Access

    -
  1. APIKey KeyParamName:ApiKey KeyInQuery:false KeyInHeader:true
  2. HTTP Basic Authentication
  3. +
  4. APIKey KeyParamName:ApiKey KeyInQuery:false KeyInHeader:true

Methods

@@ -308,7 +308,7 @@ Any modifications made to this file will be overwritten.

Example data

Content-Type: application/json
-
{
+    
[ {
   "supported_feature_ids" : [ "alerting", "uptime", "siem" ],
   "name" : "Index",
   "enabled_in_license" : true,
@@ -316,7 +316,15 @@ Any modifications made to this file will be overwritten.
   "enabled_in_config" : true,
   "minimum_license_required" : "basic",
   "enabled" : true
-}
+}, { + "supported_feature_ids" : [ "alerting", "uptime", "siem" ], + "name" : "Index", + "enabled_in_license" : true, + "id" : ".server-log", + "enabled_in_config" : true, + "minimum_license_required" : "basic", + "enabled" : true +} ]

Produces

This API call produces the following media types according to the Accept request header; @@ -363,7 +371,7 @@ Any modifications made to this file will be overwritten.

Example data

Content-Type: application/json
-
{
+    
[ {
   "is_missing_secrets" : false,
   "is_deprecated" : false,
   "is_preconfigured" : false,
@@ -375,7 +383,19 @@ Any modifications made to this file will be overwritten.
     "key" : ""
   },
   "connector_type_id" : ".server-log"
-}
+}, { + "is_missing_secrets" : false, + "is_deprecated" : false, + "is_preconfigured" : false, + "name" : "my-connector", + "is_system_action" : false, + "referenced_by_count" : 2, + "id" : "b0766e10-d190-11ec-b04c-776c77d14fca", + "config" : { + "key" : "" + }, + "connector_type_id" : ".server-log" +} ]

Produces

This API call produces the following media types according to the Accept request header; @@ -601,14 +621,21 @@ Any modifications made to this file will be overwritten.

Example data

Content-Type: application/json
-
{
+    
[ {
   "enabledInConfig" : true,
   "name" : "name",
   "enabledInLicense" : true,
   "id" : "id",
   "minimumLicenseRequired" : "minimumLicenseRequired",
   "enabled" : true
-}
+}, { + "enabledInConfig" : true, + "name" : "name", + "enabledInLicense" : true, + "id" : "id", + "minimumLicenseRequired" : "minimumLicenseRequired", + "enabled" : true +} ]

Produces

This API call produces the following media types according to the Accept request header; @@ -655,7 +682,7 @@ Any modifications made to this file will be overwritten.

Example data

Content-Type: application/json
-
{
+    
[ {
   "isPreconfigured" : true,
   "isDeprecated" : true,
   "actionTypeId" : "actionTypeId",
@@ -663,7 +690,15 @@ Any modifications made to this file will be overwritten.
   "id" : "id",
   "config" : "{}",
   "isMissingSecrets" : true
-}
+}, { + "isPreconfigured" : true, + "isDeprecated" : true, + "actionTypeId" : "actionTypeId", + "name" : "name", + "id" : "id", + "config" : "{}", + "isMissingSecrets" : true +} ]

Produces

This API call produces the following media types according to the Accept request header; @@ -997,12 +1032,13 @@ Any modifications made to this file will be overwritten.
  • Run_connector_request_body_properties - Run connector request body properties
  • Run_connector_request_body_properties_params -
  • Severity_mapping - Severity mapping
  • -
  • Subaction_parameters - Subaction parameters
  • Unauthorized_response - Unauthorized response
  • Update_connector_request_body_properties - Update connector request body properties
  • action_response_properties - Action response properties
  • config_properties_cases_webhook - Connector request properties for Webhook - Case Management connector
  • config_properties_genai - Connector request properties for a generative AI connector
  • +
  • config_properties_genai_oneOf -
  • +
  • config_properties_genai_oneOf_1 -
  • config_properties_index - Connector request properties for an index connector
  • config_properties_jira - Connector request properties for a Jira connector
  • config_properties_opsgenie - Connector request properties for an Opsgenie connector
  • @@ -1289,10 +1325,6 @@ Any modifications made to this file will be overwritten.
    Enum:
    debug
    error
    fatal
    info
    trace
    warn
    message
    String The message for server log connectors.
    -
    subAction
    String The action to test.
    -
    Enum:
    -
    pushToService
    -
    subActionParams
    @@ -1305,16 +1337,6 @@ Any modifications made to this file will be overwritten.
    name
    String The name of the field in Swimlane.
    -
    -

    Subaction_parameters - Subaction parameters Up

    -
    Test an action that involves a subaction.
    -
    -
    subAction
    String The action to test.
    -
    Enum:
    -
    pushToService
    -
    subActionParams
    -
    -

    Unauthorized_response - Unauthorized response Up

    @@ -1335,6 +1357,9 @@ Any modifications made to this file will be overwritten.
    config
    name
    String The display name for the connector.
    secrets
    +
    connector_type_id
    String The type of connector.
    +
    Enum:
    +
    .gen-ai
    @@ -1381,8 +1406,32 @@ Any modifications made to this file will be overwritten.

    config_properties_genai - Connector request properties for a generative AI connector Up

    Defines properties for connectors when type is .gen-ai.
    -
    apiProvider (optional)
    String The OpenAI API provider.
    -
    apiUrl (optional)
    String The OpenAI API endpoint.
    +
    apiProvider
    String The OpenAI API provider.
    +
    Enum:
    +
    OpenAI
    +
    apiUrl
    String The OpenAI API endpoint.
    +
    defaultModel (optional)
    String The default model to use for requests.
    +
    +
    +
    +

    config_properties_genai_oneOf - Up

    +
    +
    +
    apiProvider
    String The OpenAI API provider.
    +
    Enum:
    +
    Azure OpenAI
    +
    apiUrl
    String The OpenAI API endpoint.
    +
    +
    +
    +

    config_properties_genai_oneOf_1 - Up

    +
    +
    +
    apiProvider
    String The OpenAI API provider.
    +
    Enum:
    +
    OpenAI
    +
    apiUrl
    String The OpenAI API endpoint.
    +
    defaultModel (optional)
    String The default model to use for requests.
    diff --git a/x-pack/plugins/actions/docs/openapi/bundled.json b/x-pack/plugins/actions/docs/openapi/bundled.json index 67191da3842d6..6879ea6017d76 100644 --- a/x-pack/plugins/actions/docs/openapi/bundled.json +++ b/x-pack/plugins/actions/docs/openapi/bundled.json @@ -445,6 +445,9 @@ { "$ref": "#/components/schemas/update_connector_request_cases_webhook" }, + { + "$ref": "#/components/schemas/create_connector_request_genai" + }, { "$ref": "#/components/schemas/update_connector_request_index" }, @@ -1595,16 +1598,54 @@ "config_properties_genai": { "title": "Connector request properties for a generative AI connector", "description": "Defines properties for connectors when type is `.gen-ai`.", - "type": "object", - "properties": { - "apiProvider": { - "type": "string", - "description": "The OpenAI API provider." + "oneOf": [ + { + "type": "object", + "required": [ + "apiProvider", + "apiUrl" + ], + "properties": { + "apiProvider": { + "type": "string", + "description": "The OpenAI API provider.", + "enum": [ + "Azure OpenAI" + ] + }, + "apiUrl": { + "type": "string", + "description": "The OpenAI API endpoint." + } + } }, - "apiUrl": { - "type": "string", - "description": "The OpenAI API endpoint." + { + "type": "object", + "required": [ + "apiProvider", + "apiUrl" + ], + "properties": { + "apiProvider": { + "type": "string", + "description": "The OpenAI API provider.", + "enum": [ + "OpenAI" + ] + }, + "apiUrl": { + "type": "string", + "description": "The OpenAI API endpoint." + }, + "defaultModel": { + "type": "string", + "description": "The default model to use for requests." + } + } } + ], + "discriminator": { + "propertyName": "apiProvider" } }, "secrets_properties_genai": { diff --git a/x-pack/plugins/actions/docs/openapi/bundled.yaml b/x-pack/plugins/actions/docs/openapi/bundled.yaml index 5da86f4563a6c..ba0ed129af2a4 100644 --- a/x-pack/plugins/actions/docs/openapi/bundled.yaml +++ b/x-pack/plugins/actions/docs/openapi/bundled.yaml @@ -239,6 +239,7 @@ paths: description: The properties vary depending on the connector type. oneOf: - $ref: '#/components/schemas/update_connector_request_cases_webhook' + - $ref: '#/components/schemas/create_connector_request_genai' - $ref: '#/components/schemas/update_connector_request_index' - $ref: '#/components/schemas/update_connector_request_jira' - $ref: '#/components/schemas/update_connector_request_opsgenie' @@ -979,14 +980,38 @@ components: config_properties_genai: title: Connector request properties for a generative AI connector description: Defines properties for connectors when type is `.gen-ai`. - type: object - properties: - apiProvider: - type: string - description: The OpenAI API provider. - apiUrl: - type: string - description: The OpenAI API endpoint. + oneOf: + - type: object + required: + - apiProvider + - apiUrl + properties: + apiProvider: + type: string + description: The OpenAI API provider. + enum: + - Azure OpenAI + apiUrl: + type: string + description: The OpenAI API endpoint. + - type: object + required: + - apiProvider + - apiUrl + properties: + apiProvider: + type: string + description: The OpenAI API provider. + enum: + - OpenAI + apiUrl: + type: string + description: The OpenAI API endpoint. + defaultModel: + type: string + description: The default model to use for requests. + discriminator: + propertyName: apiProvider secrets_properties_genai: title: Connector secrets properties for a generative AI connector description: Defines secrets for connectors when type is `.gen-ai`. diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/config_properties_genai.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/config_properties_genai.yaml index 6732d4efbbf3b..ca4388303fd2c 100644 --- a/x-pack/plugins/actions/docs/openapi/components/schemas/config_properties_genai.yaml +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/config_properties_genai.yaml @@ -1,10 +1,32 @@ title: Connector request properties for a generative AI connector description: Defines properties for connectors when type is `.gen-ai`. -type: object -properties: - apiProvider: +oneOf: + - type: object + required: + - apiProvider + - apiUrl + properties: + apiProvider: type: string description: The OpenAI API provider. - apiUrl: + enum: ['Azure OpenAI'] + apiUrl: type: string - description: The OpenAI API endpoint. \ No newline at end of file + description: The OpenAI API endpoint. + - type: object + required: + - apiProvider + - apiUrl + properties: + apiProvider: + type: string + description: The OpenAI API provider. + enum: ['OpenAI'] + apiUrl: + type: string + description: The OpenAI API endpoint. + defaultModel: + type: string + description: The default model to use for requests. +discriminator: + propertyName: apiProvider \ No newline at end of file diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/update_connector_request_genai.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/update_connector_request_genai.yaml new file mode 100644 index 0000000000000..a7fbf5cb7bcfa --- /dev/null +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/update_connector_request_genai.yaml @@ -0,0 +1,13 @@ +title: Update generative AI connector request +type: object +required: + - config + - name +properties: + config: + $ref: 'config_properties_genai.yaml' + name: + type: string + description: The display name for the connector. + secrets: + $ref: 'secrets_properties_genai.yaml' \ No newline at end of file diff --git a/x-pack/plugins/actions/docs/openapi/paths/s@{spaceid}@api@actions@connector@{connectorid}.yaml b/x-pack/plugins/actions/docs/openapi/paths/s@{spaceid}@api@actions@connector@{connectorid}.yaml index 9b6279bcb18a7..a6fad249b1aba 100644 --- a/x-pack/plugins/actions/docs/openapi/paths/s@{spaceid}@api@actions@connector@{connectorid}.yaml +++ b/x-pack/plugins/actions/docs/openapi/paths/s@{spaceid}@api@actions@connector@{connectorid}.yaml @@ -160,7 +160,7 @@ put: oneOf: - $ref: '../components/schemas/update_connector_request_cases_webhook.yaml' # - $ref: '../components/schemas/update_connector_request_email.yaml' -# - $ref: '../components/schemas/create_connector_request_genai.yaml' + - $ref: '../components/schemas/create_connector_request_genai.yaml' - $ref: '../components/schemas/update_connector_request_index.yaml' - $ref: '../components/schemas/update_connector_request_jira.yaml' - $ref: '../components/schemas/update_connector_request_opsgenie.yaml'