Amazon Bedrock Connector
Overview
The Amazon Bedrock Connector is the easiest way to connect to the generative AI service Amazon Bedrock from Mendix version 9.18.0 or higher.
The Amazon Bedrock Connector allows Mendix makers to integrate with Amazon Bedrock. It provides following functionalities
- List Foundational Models
- Invoke Model (generic)
Pre-requisite – It requires AWS Authentication Module.
Please find the Amazon Bedrock Example Implementation on the marketplace to get some inspiration on how the Amazon Bedrock Connector can be used in your Mendix application and to see example microflows for invoking different foundational models available on Amazon Bedrock.
DISCLAIMER: The Amazon Bedrock service is currently in preview and hence not available to everyone. To use this connector you need to have access to Amazon Bedrock.
This Amazon Bedrock Connector is community-supported, because Amazon Bedrock is still in preview, causing breaking changes on the API to be possible anytime. Nevertheless, we will react to any breaking changes as soon as possible to ensure a high quality of the connector.
For more information about our AWS Connector strategy, please see the Mendix Evaluation Guide
Documentation
1 Introduction
The Amazon Bedrock connector enables you to enrich your Mendix app with generative AI capabilities by connecting it to Amazon Bedrock.
The Amazon Bedrock service is currently in preview, which means it is only available to selected users. For more information, refer to the Amazon service documentation.
1.1 Typical Use Cases
Amazon Bedrock is a fully managed service that makes foundation models (FMs) from Amazon and leading AI startups available through an API, so you can choose from various FMs to find the model that is best suited for your use case. With the Amazon Bedrock serverless experience, you can quickly get started, easily experiment with FMs, and seamlessly integrate and deploy them into your applications using AWS tools and capabilities. Typical use cases include the following:
- Building an AI agent to answer questions about proprietary data.
- Generating images based on text prompts and displaying them in the Mendix app.
1.2 Prerequisites
The Amazon Bedrock connector requires Mendix Studio Pro version 9.18.0 or above.
To authenticate with Amazon Web Service (AWS), you must also install and configure the AWS Authentication connector version 2.3.1 or higher. It is crucial for the Amazon Bedrock connector to function correctly. For more information about installing and configuring the AWS Authentication connector, see AWS Authentication.
1.3 Licensing and Cost
This connector is available as a free download from the Mendix Marketplace, but the AWS service to which is connects may incur a usage cost. For more information, refer to AWS documentation.
The pricing of the Amazon Bedrock Connectors is dependent on the Foundational Model that you use. You can find information about the pricing in the Foundational Model overview in the AWS console.
Most AWS services provide a free tier that allows easy access to most services. To find out if this service is included in the free tier, see AWS Free Tier. To calculate the potential cost of using an AWS service outside of the free tier, use the AWS Cost calculator.
Depending on your use case, your deployment environment, and the type of app that you want to build, you may also need a license for your Mendix app. For more information, refer to Licensing Apps.
2 Installation
Follow the instructions in How to Use Marketplace Content in Studio Pro to import the Amazon Bedrock connector into your app.
3 Configuration
After you install the connector, you can find it in the App Explorer, in the AmazonBedrockConnector section. The connector provides a domain model and several activities that you can use to connect your app to Amazon Bedrock. Each activity can be implemented by using it in a microflow. To ensure that your app can connect to the AWS service, you must also configure AWS authentication for the connector.
3.1 Configuring AWS Authentication
In order to use the Amazon Bedrock service, you must authenticate with AWS. To do so, you must set up a configuration profile in your Mendix app. After you set up the configuration profile, the connector module handles the authentication internally.
- Ensure that you have installed and configured the AWS Authentication connector, as mentioned in Prerequisites.
- Decide whether you want to use session or static credentials to authenticate. The Amazon Bedrock connector supports both session and static credentials. By default, the connector is pre-configured to use static credentials, but you may want to switch to session credentials, for example, to increase the security of your app. For an overview of both authentication methods, see see AWS Authentication.
- In the App Explorer, double-click the Settings for your app.
- In the App Settings dialog, in the Configurations tab, edit or create an authentication profile. If you have multiple sets of AWS credentials, or if you want to use both static and session credentials for different use cases, create separate authentication profiles for each set of credentials.
- In the Edit Configuration dialog, in the Constants tab, click New to add the constants required for the configuration.
- In the Select Constants dialog, find and expand the AmazonBedrockConnector > ConnectionDetails section.
- Depending on your selected authentication type, configure the required parameters for the StaticCredentials or SessionCredentials:
- For all credential types:
- UseStaticCredentials - true if you want to use static credentials, or false for session credentials
- For StaticCredentials:
- AccessKey - Access key ID created in IAM
- SecretKey - Secret key created in IAM
- For SessionCredentials:
- Role ARN - ARN of the AWS role that the connector should assume
- Profile ARN - ARN of the profile created in IAM Roles Anywhere
- Trust Anchor ARN - ARN of the trust anchor created in IAM Roles Anywhere
- Client Certificate Identifier - The Client Certificate Pin visible in the Outgoing Certificates section on the Network tab in the Mendix Cloud environment
- Duration - Duration for which the session token should be valid; after the duration passes, the validity of the session credentials expires
- Session Name - An identifier for the session
3.2 Configuring a Microflow for an AWS Service
After you configure the authentication profile for Amazon Bedrock, you can implement the functions of the connector by using the provided activities in microflows. For example, to list all foundational models, implement the List Foundation Models activity by doing the following steps:
- In the App Explorer, right-click on the name of your module, and then click Add microflow.
- Enter a name for your microflow, for example, ACT_ListFoundationModels, and then click OK.
- In the App Explorer, in the AmazonBedrockConnector section, find the ListFoundationModels activity.
- Drag the ListFoundationModels activity onto the work area of your microflow.
- Double-click the ListFoundationModels activity to configure the required parameters.
- For the ENUM_Region parameter, provide a value by using a variable or an expression. For a list of available AWS regions, see ENUM_Region.
- For the Credentials parameter, provide a Credentials Object from the AWS Authentication connector:
- In the App Explorer, in the AmazonBedrockConnector section, find the Credentials_GenerateFromConstants action under Resources > Authentication.
- Drag the Credentials_GenerateFromConstants to the beginning of your microflow.
- Double-click the Credentials_Generate activity to configure the required parameters and provide a value for the AWS Region.
- The ListFoundationModelsResponse object is returned by the ListFoundationalModels activity. From the Toolbox, drag a Retrieve activity to your microflow and place it after the ListFoundationModels activity.
- Double-click the Retrieve activity and make sure By Association is selected.
- Select the ModelSummary_ListFoundationModelsResponse association, which will return a list of the type ModelSummary.
- To further use the response information, you can create an implementation module with copies of the ListFoundationModelsResponse and ModelSummary Entites. This way, you can use your custom user roles and access rules for those entities and keep them when updating the connector.
4 Technical Reference
To help you work with the Amazon Bedrock connector, the following sections of this document list the available entities, enumerations, and activities that you can use in your application.
4.1 Domain Model
The domain model is a data model that describes the information in your application domain in an abstract way. For more information, see Domain Model.
4.1.1 ListFoundationModelsResponse
The ListFoundationModelsResponse entity collects (through association) the details needed to invoke all available foundational models that AWS provides in its response. The details per model are stored on the ModelSummary entity.
4.1.2 ModelSummary
The ModelSummary entity stores the details (per model) needed to invoke all the available foundational models.
- ModelArn - The ARN (Amazon Resource Name) that identifies the foundational model (string)
- ModelId - ID assigned by Amazon Bedrock to their specific foundational models; it is used to invoke the model in question (string)
- ModelSummary_ListFoundationModelsResponse (*-1) - For collecting the returned foundational models under the ListFoundationalModelsResponse (string)
4.1.3 InvokeModelGenericRequest
This is the request entity of the InvokeModelGeneric action.
- ModelId - The ModelId attribute describes identifier of the model and is a required parameter.|
- Accept - The Accept attribute describes the desired MIME type of the inference body in the response. The default value is application/json.
- ContentType - The ContentType attribute describes the MIME type of the input data in the request. The default value is application/json.
- SavePrompt - The SavePrompt attribute describes whether to save this prompt in your prompt history. The default value is false.
4.1.4 InvokeModelGenericResponse
This is the response entity of the InvokeModelGeneric action.
- ContentType - The ContentType attribute describes the MIME type of the inference result.
- PromptId - The PromptId describes the identifier of the prompt. Only is available for prompts that are saved.
- ResponseBody - The ResponseBody attribute holds the JSON response body of the specific model.
4.2 Enumerations
An enumeration is a predefined list of values that can be used as an attribute type. For the more information, see Enumerations.
4.2.1 ENUM_Region
This enumeration provides a list of available AWS regions.
- us_east_2 - US East (Ohio)
- us_east_1 - US East (N. Virginia)
- us_west_1 - US West (N. California)
- us_west_2 - US West (Oregon)
- af_south_1 - Africa (Cape Town)
- ap_east_1 - Asia Pacific (Hong Kong)
- ap_southeast_3 - Asia Pacific (Jakarta)
- ap_south_1 - Asia Pacific (Mumbai)
- ap_northeast_3 - Asia Pacific (Osaka)
- ap_northeast_2 - Asia Pacific (Seoul)
- ap_southeast_1 - Asia Pacific (Singapore)
- ap_southeast_2 - Asia Pacific (Sydney)
- ap_northeast_1 - Asia Pacific (Tokyo)
- ca_central_1 - Canada (Central)
- eu_central_1 - Europe (Frankfurt)
- eu_west_1 - Europe (Ireland)
- eu_west_2 - Europe (London)
- eu_south_1 - Europe (Milan)
- eu_west_3 - Europe (Paris)
- eu_north_1 - Europe (Stockholm)
- me_south_1 - Middle East (Bahrain)
- sa_east_1 - South America (São Paulo)
4.3 Activities
Activities define the actions that are executed in a microflow or a nanoflow. For more information, see Activities.
4.3.1 List Foundation Models
The List Foundation Models activity allows you to get all the available foundational models which Amazon Bedrock provides. It requires a Credentials object and an ENUM_Region value (like us_west_2).
The input and output for this service are shown below:
- Input - Credentials, ENUM_Region
- Output - ListFoundationModelsResponse, ListFoundationalModelsResponse
4.3.2 Invoke Model Generic
The InvokeModel Generic activity allows you to invoke a model from Amazon Bedrock. This activity provides the generic parts that are equal for the invocation of every model. It requires ENUM_Region, RequestBody and InvokeModelGenericRequest as input parameters.
The input and output for this service are shown below:
- Input - AWS_Region (ENUM), RequestBody (String), InvokeModelGenericRequest
- Output - InvokeModelGenericResponse