Skip to content

Commit

Permalink
[Security solution] Rename connector from AWS Bedrock to Amazon Bedro…
Browse files Browse the repository at this point in the history
…ck (elastic#169025)

(cherry picked from commit 9b73b87)
  • Loading branch information
stephmilovic committed Oct 17, 2023
1 parent 84a6e65 commit 80a5aaf
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 16 deletions.
Binary file modified docs/management/connectors/images/bedrock-connector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/management/connectors/images/bedrock-params.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
} from '@elastic/eui';
import { ActionType } from '@kbn/actions-plugin/common';
import { ActionTypeRegistryContract } from '@kbn/triggers-actions-ui-plugin/public';
import { css } from '@emotion/css/dist/emotion-css.cjs';
import * as i18n from '../translations';

interface Props {
Expand All @@ -26,6 +27,12 @@ interface Props {
onClose: () => void;
onSelect: (actionType: ActionType) => void;
}
const itemClassName = css`
.euiKeyPadMenuItem__label {
white-space: nowrap;
overflow: hidden;
}
`;

export const ActionTypeSelectorModal = ({
actionTypes,
Expand All @@ -46,6 +53,7 @@ export const ActionTypeSelectorModal = ({
return (
<EuiFlexItem key={actionType.id} grow={false}>
<EuiKeyPadMenuItem
className={itemClassName}
key={actionType.id}
isDisabled={!actionType.enabled}
label={actionType.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const WELCOME_GENERAL_2 = i18n.translate(
'xpack.elasticAssistant.securityAssistant.content.prompts.welcome.welcomeGeneral2Prompt',
{
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 OpenAI service or an Amazon 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... 😉",
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const getLlmType = (connectorId: string, connectors: ActionResult[]): str
// See: https://github.com/langchain-ai/langchainjs/blob/fb699647a310c620140842776f4a7432c53e02fa/langchain/src/agents/openai/index.ts#L185
return 'openai';
}
// TODO: Add support for AWS Bedrock Connector once merged
// TODO: Add support for Amazon Bedrock Connector once merged
// Note: Doesn't appear to be a difference between Azure and OpenAI LLM types, so TBD for functions agent on Azure
// See: https://github.com/langchain-ai/langchainjs/blob/fb699647a310c620140842776f4a7432c53e02fa/langchain/src/llms/openai.ts#L539

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';
export const BEDROCK_TITLE = i18n.translate(
'xpack.stackConnectors.components.bedrock.connectorTypeTitle',
{
defaultMessage: 'AWS Bedrock',
defaultMessage: 'Amazon Bedrock',
}
);
export const BEDROCK_CONNECTOR_ID = '.bedrock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ beforeAll(() => {
describe('actionTypeRegistry.get() works', () => {
test('connector type static data is as expected', () => {
expect(actionTypeModel.id).toEqual(ACTION_TYPE_ID);
expect(actionTypeModel.selectMessage).toBe('Send a request to AWS Bedrock.');
expect(actionTypeModel.actionTypeTitle).toBe('AWS Bedrock');
expect(actionTypeModel.selectMessage).toBe('Send a request to Amazon Bedrock.');
expect(actionTypeModel.actionTypeTitle).toBe('Amazon Bedrock');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function getConnectorType(): BedrockConnector {
id: BEDROCK_CONNECTOR_ID,
iconClass: lazy(() => import('./logo')),
selectMessage: i18n.translate('xpack.stackConnectors.components.bedrock.selectMessageText', {
defaultMessage: 'Send a request to AWS Bedrock.',
defaultMessage: 'Send a request to Amazon Bedrock.',
}),
actionTypeTitle: BEDROCK_TITLE,
validateParams: async (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const bedrockConfig: ConfigFieldSchema[] = [
defaultValue: DEFAULT_BEDROCK_URL,
helpText: (
<FormattedMessage
defaultMessage="The AWS Bedrock API endpoint URL. For more information on the URL, refer to the {bedrockAPIUrlDocs}."
defaultMessage="The Amazon Bedrock API endpoint URL. For more information on the URL, refer to the {bedrockAPIUrlDocs}."
id="xpack.stackConnectors.components.bedrock.bedrockDocumentation"
values={{
bedrockAPIUrlDocs: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const SECRET = i18n.translate('xpack.stackConnectors.components.bedrock.s
});

export const BEDROCK = i18n.translate('xpack.stackConnectors.components.bedrock.title', {
defaultMessage: 'AWS Bedrock',
defaultMessage: 'Amazon Bedrock',
});

export const DOCUMENTATION = i18n.translate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ describe('Bedrock Connector', () => {
configurationUtilities = actionsConfigMock.create();
connectorType = getConnectorType();
});
test('exposes the connector as `AWS Bedrock` with id `.bedrock`', () => {
test('exposes the connector as `Amazon Bedrock` with id `.bedrock`', () => {
expect(connectorType.id).toEqual('.bedrock');
expect(connectorType.name).toEqual('AWS Bedrock');
expect(connectorType.name).toEqual('Amazon Bedrock');
});
describe('config validation', () => {
test('config validation passes when only required fields are provided', () => {
Expand All @@ -55,7 +55,7 @@ describe('Bedrock Connector', () => {
expect(() => {
configValidator(config, { configurationUtilities });
}).toThrowErrorMatchingInlineSnapshot(
'"Error configuring AWS Bedrock action: Error: URL Error: Invalid URL: example.com/do-something"'
'"Error configuring Amazon Bedrock action: Error: URL Error: Invalid URL: example.com/do-something"'
);
});

Expand All @@ -75,7 +75,7 @@ describe('Bedrock Connector', () => {
expect(() => {
configValidator(config, { configurationUtilities: configUtils });
}).toThrowErrorMatchingInlineSnapshot(
`"Error configuring AWS Bedrock action: Error: error validating url: target url is not present in allowedHosts"`
`"Error configuring Amazon Bedrock action: Error: error validating url: target url is not present in allowedHosts"`
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const configValidator = (configObject: Config, validatorServices: Validat
} catch (err) {
throw new Error(
i18n.translate('xpack.stackConnectors.bedrock.configurationErrorApiProvider', {
defaultMessage: 'Error configuring AWS Bedrock action: {err}',
defaultMessage: 'Error configuring Amazon Bedrock action: {err}',
values: {
err,
},
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/stack_connectors/server/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe('Stack Connectors Plugin', () => {
4,
expect.objectContaining({
id: '.bedrock',
name: 'AWS Bedrock',
name: 'Amazon Bedrock',
})
);
expect(actionsSetup.registerSubActionConnectorType).toHaveBeenNthCalledWith(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default function bedrockTest({ getService }: FtrProviderContext) {
statusCode: 400,
error: 'Bad Request',
message:
'error validating action type config: Error configuring AWS Bedrock action: Error: error validating url: target url "http://bedrock.mynonexistent.com" is not added to the Kibana config xpack.actions.allowedHosts',
'error validating action type config: Error configuring Amazon Bedrock action: Error: error validating url: target url "http://bedrock.mynonexistent.com" is not added to the Kibana config xpack.actions.allowedHosts',
});
});
});
Expand Down Expand Up @@ -280,7 +280,7 @@ export default function bedrockTest({ getService }: FtrProviderContext) {
status: 'error',
retry: true,
message: 'an error occurred while running the action',
service_message: `Sub action "invalidAction" is not registered. Connector id: ${bedrockActionId}. Connector name: AWS Bedrock. Connector type: .bedrock`,
service_message: `Sub action "invalidAction" is not registered. Connector id: ${bedrockActionId}. Connector name: Amazon Bedrock. Connector type: .bedrock`,
});
});
});
Expand Down

0 comments on commit 80a5aaf

Please sign in to comment.