Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
fd9e33c
[Security solution] AI assistant persistent storage
YulNaumenko Dec 5, 2023
c5e8c94
Merge remote-tracking branch 'upstream/main' into security-ai-assista…
YulNaumenko Dec 5, 2023
0e1dca5
Merge remote-tracking branch 'upstream/main' into security-ai-assista…
YulNaumenko Dec 7, 2023
c2fa821
Merge remote-tracking branch 'upstream/main' into security-ai-assista…
YulNaumenko Dec 9, 2023
0aeb11e
[Security solution] AI Assistant persistent storage.
YulNaumenko Dec 18, 2023
977b9a7
Merge remote-tracking branch 'upstream/main' into security-ai-assista…
YulNaumenko Dec 18, 2023
ed10f8b
fixed apis
YulNaumenko Dec 19, 2023
d743bd0
Merge remote-tracking branch 'upstream/main' into security-ai-assista…
YulNaumenko Jan 8, 2024
04c76cc
changed client to use the new apis
YulNaumenko Jan 12, 2024
57ead26
Merge remote-tracking branch 'upstream/main' into security-ai-assista…
YulNaumenko Jan 12, 2024
dd501f6
fixed merge issues
YulNaumenko Jan 12, 2024
7af9db2
added kbn-data-stream-adapter
YulNaumenko Jan 13, 2024
5d3e92e
improved APIs
YulNaumenko Jan 14, 2024
f4eaa73
Merge remote-tracking branch 'upstream/main' into security-ai-assista…
YulNaumenko Jan 14, 2024
dabe489
migrated existing apis to versioned api
YulNaumenko Jan 14, 2024
dfdb03e
removed debug
YulNaumenko Jan 14, 2024
71cd051
throw error if templated weren't installed
YulNaumenko Jan 14, 2024
6ad0564
replaced context method getConversation with storage API request to g…
YulNaumenko Jan 14, 2024
c4a83af
added refetch current conversation on useChatSent
YulNaumenko Jan 14, 2024
418a51c
cleaned up select handler
YulNaumenko Jan 14, 2024
6ebff9b
fixed ui
YulNaumenko Jan 17, 2024
9a759ca
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Jan 17, 2024
7311ef6
updated data stream adapter
YulNaumenko Jan 18, 2024
ef9bd99
fixed frontend bulk api
YulNaumenko Jan 18, 2024
582d947
fixed bulk update api
YulNaumenko Jan 18, 2024
8bada67
fixed system prompt change to do the bulk update on save
YulNaumenko Jan 18, 2024
dd4008a
added migration from the local storage
YulNaumenko Jan 18, 2024
1877e0b
fixed migration with title
YulNaumenko Jan 18, 2024
8ccb28f
fixed uncesarry Assistant rendering
YulNaumenko Jan 20, 2024
3b89f80
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Jan 20, 2024
ddabe95
revert to use localStorage for the last conversation
YulNaumenko Jan 20, 2024
a455949
-
YulNaumenko Jan 20, 2024
0f071b8
added appendMessages API
YulNaumenko Jan 21, 2024
3718761
fixed KB params
YulNaumenko Jan 21, 2024
e1b161e
Added API unit tests
YulNaumenko Jan 22, 2024
a4e97b3
cleanup
YulNaumenko Jan 22, 2024
1dcb318
fixed tests
YulNaumenko Jan 23, 2024
29de319
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Jan 23, 2024
def6ecd
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jan 23, 2024
ed69397
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine Jan 23, 2024
c953777
-
YulNaumenko Jan 23, 2024
d1a93d5
more tests fixes
YulNaumenko Jan 23, 2024
4a38118
more test
YulNaumenko Jan 23, 2024
1d76ddf
[CI] Auto-commit changed files from 'node scripts/check_mappings_upda…
kibanamachine Jan 23, 2024
388576e
[CI] Auto-commit changed files from 'node scripts/jest_integration -u…
kibanamachine Jan 23, 2024
0f36144
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Jan 24, 2024
c6ab1e5
fixed replacements test
YulNaumenko Jan 24, 2024
77abfd1
-
YulNaumenko Jan 24, 2024
59704de
fixed type checks
YulNaumenko Jan 24, 2024
0978a06
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jan 24, 2024
3129865
-
YulNaumenko Jan 24, 2024
ff03c23
Merge remote-tracking branch 'upstream/main' into security-ai-assista…
YulNaumenko Jan 24, 2024
aab5c12
fixed start fetch error
YulNaumenko Jan 24, 2024
35ee2af
fixed starting conversation failures
YulNaumenko Jan 25, 2024
e70a361
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Jan 25, 2024
3628696
tests fixes
YulNaumenko Jan 25, 2024
d3b6d6e
-
YulNaumenko Jan 25, 2024
84d6841
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jan 25, 2024
2ca4681
fixed lint issues
YulNaumenko Jan 25, 2024
90ec31b
-
YulNaumenko Jan 26, 2024
df0c262
fixed security_solution tests
YulNaumenko Jan 26, 2024
d893192
useConversation tests
YulNaumenko Jan 26, 2024
74d75b8
fixed types checks
YulNaumenko Jan 26, 2024
bd60b77
api tests fix
YulNaumenko Jan 29, 2024
29e6016
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Jan 29, 2024
90b413d
type checks and ftr test
YulNaumenko Jan 29, 2024
d99f274
fixed api tests and typechecks
YulNaumenko Jan 30, 2024
a1fe21a
fixed first batch of comments
YulNaumenko Jan 31, 2024
2eaf461
Merge remote-tracking branch 'upstream/main' into security-ai-assista…
YulNaumenko Jan 31, 2024
8e6de8b
resolved conflicts
YulNaumenko Jan 31, 2024
76da778
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jan 31, 2024
1e074d4
Fixed failing tests
YulNaumenko Jan 31, 2024
980a44e
-
YulNaumenko Feb 1, 2024
2ea2fb7
Refactored logic with toast instead of silent error log
YulNaumenko Feb 1, 2024
712b750
fixed tests
YulNaumenko Feb 2, 2024
eeaaad9
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Feb 2, 2024
c4545f5
moved schemas to common package
YulNaumenko Feb 2, 2024
1fbe6e2
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Feb 2, 2024
5d49bed
renamed anonimization to anonymizaton
YulNaumenko Feb 2, 2024
12c986e
[CI] Auto-commit changed files from 'node scripts/jest_integration -u…
kibanamachine Feb 2, 2024
5bfe84c
changed approach to use title for dictionary on the client side
YulNaumenko Feb 6, 2024
5d09e32
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Feb 6, 2024
c3534b4
Change routes to serve only current user
YulNaumenko Feb 6, 2024
2a590b1
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Feb 7, 2024
7bff771
moved anonymization to server side
YulNaumenko Feb 8, 2024
9f3c8ae
fixed replacements
YulNaumenko Feb 9, 2024
f0df29f
fixed no replacements message
YulNaumenko Feb 10, 2024
ddd563f
fix streaming+ tests
stephmilovic Feb 12, 2024
ef17066
[CI] Auto-commit changed files from 'yarn openapi:generate'
kibanamachine Feb 12, 2024
5737ebe
fix spacing
stephmilovic Feb 12, 2024
424e0db
fix more tests
stephmilovic Feb 12, 2024
dcb9786
try fixing zod
stephmilovic Feb 12, 2024
289d1dc
Revert "try fixing zod"
stephmilovic Feb 12, 2024
71d4117
fix zod
stephmilovic Feb 12, 2024
b8a0173
fixed connectorTitle save on bulk update/create
YulNaumenko Feb 13, 2024
52772b6
used datastream for prompts and anonymization fields
YulNaumenko Feb 13, 2024
ce1d5c3
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Feb 13, 2024
bf82ec1
-
YulNaumenko Feb 13, 2024
94836be
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Feb 13, 2024
6439c01
added sendMessage telemetry to user_chat_send
YulNaumenko Feb 14, 2024
003f8b6
fixed tests
YulNaumenko Feb 14, 2024
5d281a1
fixed typechecks
YulNaumenko Feb 14, 2024
29a78e6
test fix
YulNaumenko Feb 14, 2024
b4987b0
added category and summary fields
YulNaumenko Feb 14, 2024
89f818d
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Feb 14, 2024
3f607ff
test fix
YulNaumenko Feb 14, 2024
624847e
tests
YulNaumenko Feb 14, 2024
f8a83e8
update replacements
stephmilovic Feb 14, 2024
cd1dd09
more tests
stephmilovic Feb 15, 2024
243378b
more testing
stephmilovic Feb 15, 2024
b3caaaa
reorder
stephmilovic Feb 15, 2024
d7ddaf6
test cleanup
stephmilovic Feb 15, 2024
1446f2a
-
YulNaumenko Feb 16, 2024
7eac6b5
Merge branch 'security-ai-assistant-persistant-storage' of github.com…
YulNaumenko Feb 16, 2024
167d153
data client unif
YulNaumenko Feb 20, 2024
9cb6e78
wip
stephmilovic Feb 20, 2024
72a8741
adjust id to empty string
stephmilovic Feb 20, 2024
3555f78
rm logs
stephmilovic Feb 20, 2024
b647e0f
fix test err
stephmilovic Feb 20, 2024
6eff37d
add delete test
stephmilovic Feb 20, 2024
18e0679
Merge branch 'main' into security-ai-assistant-persistant-storage
kibanamachine Feb 21, 2024
715835e
rm unused var
stephmilovic Feb 21, 2024
e26b473
Merge branch 'security-ai-assistant-persistant-storage' of github.com…
stephmilovic Feb 21, 2024
3f68c7a
fix type
stephmilovic Feb 21, 2024
17a1ff5
Merge branch 'main' into security-ai-assistant-persistant-storage
kibanamachine Feb 21, 2024
c3bca6e
fix
stephmilovic Feb 21, 2024
e5f3cde
Merge branch 'security-ai-assistant-persistant-storage' of github.com…
stephmilovic Feb 21, 2024
16940c8
fixes bugz
stephmilovic Feb 22, 2024
3eaaec8
fix eval route
stephmilovic Feb 22, 2024
6cee732
require replacements for agent executor function
stephmilovic Feb 23, 2024
53b8bba
fix test
stephmilovic Feb 23, 2024
08d3376
rm TODOs
stephmilovic Feb 23, 2024
1176505
Merge branch 'main' into security-ai-assistant-persistant-storage-steph
stephmilovic Feb 23, 2024
55383e7
Merge branch 'main' into security-ai-assistant-persistant-storage
kibanamachine Mar 4, 2024
7c6aa79
fix type
stephmilovic Mar 5, 2024
bcb657c
added more server side tests
YulNaumenko Mar 6, 2024
3e080f1
Merge branch 'security-ai-assistant-persistant-storage' of github.com…
YulNaumenko Mar 6, 2024
6392c12
fixed merge
YulNaumenko Mar 6, 2024
2276738
fixed typechecks
YulNaumenko Mar 6, 2024
929ee9d
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Mar 6, 2024
57d89d5
fix bulk update bug
stephmilovic Mar 7, 2024
d39d169
fixed empty sending bulk
YulNaumenko Mar 7, 2024
faa5b72
renaming cleanup
YulNaumenko Mar 7, 2024
4cb61ec
removed duplicated buildRouteValidationWithZod
YulNaumenko Mar 7, 2024
b704e41
renaming fix
YulNaumenko Mar 7, 2024
689b3c8
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Mar 7, 2024
d5762f7
-
YulNaumenko Mar 7, 2024
f891544
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Mar 7, 2024
2a923e1
fixed traces and message timestamp
YulNaumenko Mar 8, 2024
afd560e
Merge branch 'main' into security-ai-assistant-persistant-storage-steph
stephmilovic Mar 8, 2024
8ed14f4
fix race condition with onMessageSent
stephmilovic Mar 8, 2024
e36ed8e
Fix replacements
stephmilovic Mar 8, 2024
62c94b6
update replacements zod schema
stephmilovic Mar 8, 2024
9b3b0ae
add missing dep to useEffect
stephmilovic Mar 8, 2024
651fd02
refactor execute api to receive message: string instead of messages: …
stephmilovic Mar 9, 2024
64ca374
fix tests
stephmilovic Mar 9, 2024
eab6223
Merge branch 'main' into security-ai-assistant-persistant-storage-steph
stephmilovic Mar 11, 2024
3408912
fixed replacements and throw errors for conversation apis
YulNaumenko Mar 11, 2024
92b3f0a
Require connectorId and connectorTitleType in apiConfig
stephmilovic Mar 11, 2024
6edaa04
Merge branch 'security-ai-assistant-persistant-storage' of github.com…
stephmilovic Mar 11, 2024
1b96a5f
fixed transform
YulNaumenko Mar 12, 2024
8464c52
fixed failing test and conversation update script
YulNaumenko Mar 12, 2024
32078a4
fixed delete and create for conversation settings
YulNaumenko Mar 12, 2024
aa29a9e
fixed bulk change for system prompts
YulNaumenko Mar 12, 2024
cd0984d
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Mar 12, 2024
4ec01ea
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Mar 12, 2024
24b9ca2
store original messages and conversationDataClient always return anon…
YulNaumenko Mar 12, 2024
06bd29a
ci fix
YulNaumenko Mar 13, 2024
acbf3b7
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Mar 13, 2024
d25950e
-
YulNaumenko Mar 13, 2024
d2bcda5
Changed the shape of replacements
YulNaumenko Mar 13, 2024
ee7e269
fixed tests
YulNaumenko Mar 13, 2024
0c3b0b7
fixed replacements dups
YulNaumenko Mar 13, 2024
be3335a
fixed timestamp to ISO
YulNaumenko Mar 13, 2024
c9926e7
Merge branch 'main' into security-ai-assistant-persistant-storage
YulNaumenko Mar 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions x-pack/packages/kbn-elastic-assistant-common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export const ELASTIC_AI_ASSISTANT_API_CURRENT_VERSION = '2023-10-31';
export const ELASTIC_AI_ASSISTANT_INTERNAL_API_VERSION = '1';

export const ELASTIC_AI_ASSISTANT_URL = '/api/elastic_assistant';

export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL = `${ELASTIC_AI_ASSISTANT_URL}/current_user/conversations`;
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID = `${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/{id}`;
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID_MESSAGES = `${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID}/messages`;

export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BULK_ACTION = `${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/_bulk_action`;
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_FIND = `${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/_find`;

export const ELASTIC_AI_ASSISTANT_PROMPTS_URL = `${ELASTIC_AI_ASSISTANT_URL}/prompts`;
export const ELASTIC_AI_ASSISTANT_PROMPTS_URL_BULK_ACTION = `${ELASTIC_AI_ASSISTANT_PROMPTS_URL}/_bulk_action`;
export const ELASTIC_AI_ASSISTANT_PROMPTS_URL_FIND = `${ELASTIC_AI_ASSISTANT_PROMPTS_URL}/_find`;

export const ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL = `${ELASTIC_AI_ASSISTANT_URL}/anonymization_fields`;
export const ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION = `${ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL}/_bulk_action`;
export const ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_FIND = `${ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL}/_find`;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* 2.0.
*/

import { Replacement } from '../../schemas';

export const getIsDataAnonymizable = (rawData: string | Record<string, string[]>): boolean =>
typeof rawData !== 'string';

Expand All @@ -21,3 +23,31 @@ export const isAnonymized = ({
allowReplacementSet: Set<string>;
field: string;
}): boolean => allowReplacementSet.has(field);

export const replaceAnonymizedValuesWithOriginalValues = ({
messageContent,
replacements,
}: {
messageContent: string;
replacements: Replacement[];
}): string =>
replacements != null
? replacements.reduce((acc, replacement) => {
const value = replacement.value;
return replacement.uuid && value ? acc.replaceAll(replacement.uuid, value) : acc;
}, messageContent)
: messageContent;

export const replaceOriginalValuesWithUuidValues = ({
messageContent,
replacements,
}: {
messageContent: string;
replacements: Replacement[];
}): string =>
replacements != null
? replacements.reduce((acc, replacement) => {
const value = replacement.value;
return replacement.uuid && value ? acc.replaceAll(value, replacement.uuid) : acc;
}, messageContent)
: messageContent;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('transformRawData', () => {
const result = transformRawData({
allow: inputRawData.allow,
allowReplacement: inputRawData.allowReplacement,
currentReplacements: {},
currentReplacements: [],
getAnonymizedValue: mockGetAnonymizedValue,
onNewReplacements: () => {},
rawData: inputRawData.rawData,
Expand All @@ -42,13 +42,13 @@ describe('transformRawData', () => {
transformRawData({
allow: inputRawData.allow,
allowReplacement: inputRawData.allowReplacement,
currentReplacements: {},
currentReplacements: [],
getAnonymizedValue: mockGetAnonymizedValue,
onNewReplacements,
rawData: inputRawData.rawData,
});

expect(onNewReplacements).toHaveBeenCalledWith({ '1eulav': 'value1' });
expect(onNewReplacements).toHaveBeenCalledWith([{ uuid: '1eulav', value: 'value1' }]);
});

it('returns the expected mix of anonymized and non-anonymized data as a CSV string', () => {
Expand All @@ -62,7 +62,7 @@ describe('transformRawData', () => {
const result = transformRawData({
allow: inputRawData.allow,
allowReplacement: inputRawData.allowReplacement,
currentReplacements: {},
currentReplacements: [],
getAnonymizedValue: mockGetAnonymizedValue,
onNewReplacements: () => {},
rawData: inputRawData.rawData,
Expand All @@ -86,7 +86,7 @@ describe('transformRawData', () => {
const result = transformRawData({
allow: inputRawData.allow,
allowReplacement: inputRawData.allowReplacement,
currentReplacements: {},
currentReplacements: [],
getAnonymizedValue: mockGetAnonymizedValue,
onNewReplacements: () => {},
rawData: inputRawData.rawData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { Replacement } from '../../schemas';
import { getAnonymizedData } from '../get_anonymized_data';
import { getAnonymizedValues } from '../get_anonymized_values';
import { getCsvFromData } from '../get_csv_from_data';
Expand All @@ -19,15 +20,15 @@ export const transformRawData = ({
}: {
allow: string[];
allowReplacement: string[];
currentReplacements: Record<string, string> | undefined;
currentReplacements: Replacement[] | undefined;
getAnonymizedValue: ({
currentReplacements,
rawValue,
}: {
currentReplacements: Record<string, string> | undefined;
rawValue: string;
}) => string;
onNewReplacements?: (replacements: Record<string, string>) => void;
onNewReplacements?: (replacements: Replacement[]) => void;
rawData: string | Record<string, unknown[]>;
}): string => {
if (typeof rawData === 'string') {
Expand All @@ -37,14 +38,22 @@ export const transformRawData = ({
const anonymizedData = getAnonymizedData({
allow,
allowReplacement,
currentReplacements,
currentReplacements: currentReplacements?.reduce((acc: Record<string, string>, r) => {
acc[r.uuid] = r.value;
return acc;
}, {}),
rawData,
getAnonymizedValue,
getAnonymizedValues,
});

if (onNewReplacements != null) {
onNewReplacements(anonymizedData.replacements);
onNewReplacements(
Object.keys(anonymizedData.replacements).map((key) => ({
uuid: key,
value: anonymizedData.replacements[key],
}))
);
}

return getCsvFromData(anonymizedData.anonymizedData);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { z } from 'zod';

/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Execute Connector API endpoint
* version: 1
*/

import { UUID, Replacement } from '../conversations/common_attributes.gen';

export type ExecuteConnectorRequestParams = z.infer<typeof ExecuteConnectorRequestParams>;
export const ExecuteConnectorRequestParams = z.object({
/**
* The connector's `id` value.
*/
connectorId: z.string(),
});
export type ExecuteConnectorRequestParamsInput = z.input<typeof ExecuteConnectorRequestParams>;

export type ExecuteConnectorRequestBody = z.infer<typeof ExecuteConnectorRequestBody>;
export const ExecuteConnectorRequestBody = z.object({
conversationId: UUID.optional(),
message: z.string().optional(),
model: z.string().optional(),
subAction: z.enum(['invokeAI', 'invokeStream']),
alertsIndexPattern: z.string().optional(),
allow: z.array(z.string()).optional(),
allowReplacement: z.array(z.string()).optional(),
isEnabledKnowledgeBase: z.boolean().optional(),
isEnabledRAGAlerts: z.boolean().optional(),
replacements: z.array(Replacement),
size: z.number().optional(),
llmType: z.enum(['bedrock', 'openai']),
});
export type ExecuteConnectorRequestBodyInput = z.input<typeof ExecuteConnectorRequestBody>;

export type ExecuteConnectorResponse = z.infer<typeof ExecuteConnectorResponse>;
export const ExecuteConnectorResponse = z.object({
data: z.string().optional(),
connector_id: z.string().optional(),
replacements: z.array(Replacement).optional(),
status: z.string().optional(),
/**
* Trace Data
*/
trace_data: z
.object({
/**
* Could be any string, not necessarily a UUID
*/
transactionId: z.string().optional(),
/**
* Could be any string, not necessarily a UUID
*/
traceId: z.string().optional(),
})
.optional(),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
openapi: 3.0.0
info:
title: Execute Connector API endpoint
version: '1'
paths:
/internal/elastic_assistant/actions/connector/{connectorId}/_execute:
post:
operationId: ExecuteConnector
x-codegen-enabled: true
description: Execute Elastic Assistant connector by id
summary: Execute Elastic Assistant connector
tags:
- Connector API
parameters:
- name: connectorId
in: path
required: true
description: The connector's `id` value.
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- params
- llmType
- replacements
- subAction
properties:
conversationId:
$ref: '../conversations/common_attributes.schema.yaml#/components/schemas/UUID'
message:
type: string
model:
type: string
subAction:
type: string
enum:
- invokeAI
- invokeStream
alertsIndexPattern:
type: string
allow:
type: array
items:
type: string
allowReplacement:
type: array
items:
type: string
isEnabledKnowledgeBase:
type: boolean
isEnabledRAGAlerts:
type: boolean
replacements:
type: array
items:
$ref: '../conversations/common_attributes.schema.yaml#/components/schemas/Replacement'
size:
type: number
llmType:
type: string
enum:
- bedrock
- openai
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
data:
type: string
connector_id:
type: string
replacements:
type: array
items:
$ref: '../conversations/common_attributes.schema.yaml#/components/schemas/Replacement'
status:
type: string
trace_data:
type: object
description: Trace Data
properties:
transactionId:
type: string
description: Could be any string, not necessarily a UUID
traceId:
type: string
description: Could be any string, not necessarily a UUID
'400':
description: Generic Error
content:
application/json:
schema:
type: object
properties:
statusCode:
type: number
error:
type: string
message:
type: string

Loading