From b85919e6c299e67121e47b542762dfe124b99689 Mon Sep 17 00:00:00 2001 From: Marius Iversen Date: Wed, 19 Feb 2025 14:42:07 +0100 Subject: [PATCH] [Genai Connectors] Add missing telemetryMetadata field definition (#211733) As part of https://github.com/elastic/kibana/pull/208180 the telemetryMetadata optional field was added to the schema for the AI connectors, however it seems that one was missing, this PR simply adds it in. Similarly to the above PR, the feature cannot be used in the same week as when it was added, to allow a grace period for serverless. The PR simply adds the schema update itself. --- .../connector_types.test.ts.snap | 114 ++++++++++++++++++ .../stack_connectors/common/bedrock/schema.ts | 1 + .../stack_connectors/common/openai/schema.ts | 1 + 3 files changed, 116 insertions(+) diff --git a/x-pack/platform/plugins/shared/actions/server/integration_tests/__snapshots__/connector_types.test.ts.snap b/x-pack/platform/plugins/shared/actions/server/integration_tests/__snapshots__/connector_types.test.ts.snap index f39ea3e8dcd28..a51bb1a3714c3 100644 --- a/x-pack/platform/plugins/shared/actions/server/integration_tests/__snapshots__/connector_types.test.ts.snap +++ b/x-pack/platform/plugins/shared/actions/server/integration_tests/__snapshots__/connector_types.test.ts.snap @@ -74,6 +74,63 @@ Object { ], "type": "any", }, + "telemetryMetadata": Object { + "flags": Object { + "default": [Function], + "error": [Function], + "presence": "optional", + }, + "keys": Object { + "aggregateBy": Object { + "flags": Object { + "default": [Function], + "error": [Function], + "presence": "optional", + }, + "metas": Array [ + Object { + "x-oas-optional": true, + }, + ], + "rules": Array [ + Object { + "args": Object { + "method": [Function], + }, + "name": "custom", + }, + ], + "type": "string", + }, + "pluginId": Object { + "flags": Object { + "default": [Function], + "error": [Function], + "presence": "optional", + }, + "metas": Array [ + Object { + "x-oas-optional": true, + }, + ], + "rules": Array [ + Object { + "args": Object { + "method": [Function], + }, + "name": "custom", + }, + ], + "type": "string", + }, + }, + "metas": Array [ + Object { + "x-oas-optional": true, + }, + ], + "type": "object", + }, "timeout": Object { "flags": Object { "default": [Function], @@ -195,6 +252,63 @@ Object { ], "type": "any", }, + "telemetryMetadata": Object { + "flags": Object { + "default": [Function], + "error": [Function], + "presence": "optional", + }, + "keys": Object { + "aggregateBy": Object { + "flags": Object { + "default": [Function], + "error": [Function], + "presence": "optional", + }, + "metas": Array [ + Object { + "x-oas-optional": true, + }, + ], + "rules": Array [ + Object { + "args": Object { + "method": [Function], + }, + "name": "custom", + }, + ], + "type": "string", + }, + "pluginId": Object { + "flags": Object { + "default": [Function], + "error": [Function], + "presence": "optional", + }, + "metas": Array [ + Object { + "x-oas-optional": true, + }, + ], + "rules": Array [ + Object { + "args": Object { + "method": [Function], + }, + "name": "custom", + }, + ], + "type": "string", + }, + }, + "metas": Array [ + Object { + "x-oas-optional": true, + }, + ], + "type": "object", + }, "timeout": Object { "flags": Object { "default": [Function], diff --git a/x-pack/platform/plugins/shared/stack_connectors/common/bedrock/schema.ts b/x-pack/platform/plugins/shared/stack_connectors/common/bedrock/schema.ts index 1b40efe223e1a..e7144661a7b0e 100644 --- a/x-pack/platform/plugins/shared/stack_connectors/common/bedrock/schema.ts +++ b/x-pack/platform/plugins/shared/stack_connectors/common/bedrock/schema.ts @@ -31,6 +31,7 @@ export const RunActionParamsSchema = schema.object({ signal: schema.maybe(schema.any()), timeout: schema.maybe(schema.number()), raw: schema.maybe(schema.boolean()), + telemetryMetadata: schema.maybe(TelemtryMetadataSchema), }); export const BedrockMessageSchema = schema.object( diff --git a/x-pack/platform/plugins/shared/stack_connectors/common/openai/schema.ts b/x-pack/platform/plugins/shared/stack_connectors/common/openai/schema.ts index 029972332fb14..bb77ccf94fdbd 100644 --- a/x-pack/platform/plugins/shared/stack_connectors/common/openai/schema.ts +++ b/x-pack/platform/plugins/shared/stack_connectors/common/openai/schema.ts @@ -173,6 +173,7 @@ export const StreamActionParamsSchema = schema.object({ // abort signal from client signal: schema.maybe(schema.any()), timeout: schema.maybe(schema.number()), + telemetryMetadata: schema.maybe(TelemtryMetadataSchema), }); export const StreamingResponseSchema = schema.any();