From 93917f77f3731b304a04688716d5e5a057f502ca Mon Sep 17 00:00:00 2001 From: awstools Date: Wed, 1 May 2024 18:14:43 +0000 Subject: [PATCH] feat(client-bedrock-agent): This release adds support for using MongoDB Atlas as a vector store when creating a knowledge base. --- .../commands/CreateKnowledgeBaseCommand.ts | 30 +++- .../src/commands/GetKnowledgeBaseCommand.ts | 15 +- .../commands/UpdateKnowledgeBaseCommand.ts | 30 +++- .../src/models/models_0.ts | 89 +++++++++- .../src/protocols/Aws_restJson1.ts | 10 ++ .../sdk-codegen/aws-models/bedrock-agent.json | 153 +++++++++++++++++- 6 files changed, 312 insertions(+), 15 deletions(-) diff --git a/clients/client-bedrock-agent/src/commands/CreateKnowledgeBaseCommand.ts b/clients/client-bedrock-agent/src/commands/CreateKnowledgeBaseCommand.ts index 71ac5fd3b40f..5c079eaf04af 100644 --- a/clients/client-bedrock-agent/src/commands/CreateKnowledgeBaseCommand.ts +++ b/clients/client-bedrock-agent/src/commands/CreateKnowledgeBaseCommand.ts @@ -77,7 +77,7 @@ export interface CreateKnowledgeBaseCommandOutput extends CreateKnowledgeBaseRes * }, * }, * storageConfiguration: { // StorageConfiguration - * type: "OPENSEARCH_SERVERLESS" || "PINECONE" || "REDIS_ENTERPRISE_CLOUD" || "RDS", // required + * type: "OPENSEARCH_SERVERLESS" || "PINECONE" || "REDIS_ENTERPRISE_CLOUD" || "RDS" || "MONGO_DB_ATLAS", // required * opensearchServerlessConfiguration: { // OpenSearchServerlessConfiguration * collectionArn: "STRING_VALUE", // required * vectorIndexName: "STRING_VALUE", // required @@ -118,6 +118,19 @@ export interface CreateKnowledgeBaseCommandOutput extends CreateKnowledgeBaseRes * metadataField: "STRING_VALUE", // required * }, * }, + * mongoDbAtlasConfiguration: { // MongoDbAtlasConfiguration + * endpoint: "STRING_VALUE", // required + * databaseName: "STRING_VALUE", // required + * collectionName: "STRING_VALUE", // required + * vectorIndexName: "STRING_VALUE", // required + * credentialsSecretArn: "STRING_VALUE", // required + * fieldMapping: { // MongoDbAtlasFieldMapping + * vectorField: "STRING_VALUE", // required + * textField: "STRING_VALUE", // required + * metadataField: "STRING_VALUE", // required + * }, + * endpointServiceName: "STRING_VALUE", + * }, * }, * tags: { // TagsMap * "": "STRING_VALUE", @@ -139,7 +152,7 @@ export interface CreateKnowledgeBaseCommandOutput extends CreateKnowledgeBaseRes * // }, * // }, * // storageConfiguration: { // StorageConfiguration - * // type: "OPENSEARCH_SERVERLESS" || "PINECONE" || "REDIS_ENTERPRISE_CLOUD" || "RDS", // required + * // type: "OPENSEARCH_SERVERLESS" || "PINECONE" || "REDIS_ENTERPRISE_CLOUD" || "RDS" || "MONGO_DB_ATLAS", // required * // opensearchServerlessConfiguration: { // OpenSearchServerlessConfiguration * // collectionArn: "STRING_VALUE", // required * // vectorIndexName: "STRING_VALUE", // required @@ -180,6 +193,19 @@ export interface CreateKnowledgeBaseCommandOutput extends CreateKnowledgeBaseRes * // metadataField: "STRING_VALUE", // required * // }, * // }, + * // mongoDbAtlasConfiguration: { // MongoDbAtlasConfiguration + * // endpoint: "STRING_VALUE", // required + * // databaseName: "STRING_VALUE", // required + * // collectionName: "STRING_VALUE", // required + * // vectorIndexName: "STRING_VALUE", // required + * // credentialsSecretArn: "STRING_VALUE", // required + * // fieldMapping: { // MongoDbAtlasFieldMapping + * // vectorField: "STRING_VALUE", // required + * // textField: "STRING_VALUE", // required + * // metadataField: "STRING_VALUE", // required + * // }, + * // endpointServiceName: "STRING_VALUE", + * // }, * // }, * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED" || "DELETE_UNSUCCESSFUL", // required * // createdAt: new Date("TIMESTAMP"), // required diff --git a/clients/client-bedrock-agent/src/commands/GetKnowledgeBaseCommand.ts b/clients/client-bedrock-agent/src/commands/GetKnowledgeBaseCommand.ts index f3176c5a073d..a4a0cc42b0f3 100644 --- a/clients/client-bedrock-agent/src/commands/GetKnowledgeBaseCommand.ts +++ b/clients/client-bedrock-agent/src/commands/GetKnowledgeBaseCommand.ts @@ -53,7 +53,7 @@ export interface GetKnowledgeBaseCommandOutput extends GetKnowledgeBaseResponse, * // }, * // }, * // storageConfiguration: { // StorageConfiguration - * // type: "OPENSEARCH_SERVERLESS" || "PINECONE" || "REDIS_ENTERPRISE_CLOUD" || "RDS", // required + * // type: "OPENSEARCH_SERVERLESS" || "PINECONE" || "REDIS_ENTERPRISE_CLOUD" || "RDS" || "MONGO_DB_ATLAS", // required * // opensearchServerlessConfiguration: { // OpenSearchServerlessConfiguration * // collectionArn: "STRING_VALUE", // required * // vectorIndexName: "STRING_VALUE", // required @@ -94,6 +94,19 @@ export interface GetKnowledgeBaseCommandOutput extends GetKnowledgeBaseResponse, * // metadataField: "STRING_VALUE", // required * // }, * // }, + * // mongoDbAtlasConfiguration: { // MongoDbAtlasConfiguration + * // endpoint: "STRING_VALUE", // required + * // databaseName: "STRING_VALUE", // required + * // collectionName: "STRING_VALUE", // required + * // vectorIndexName: "STRING_VALUE", // required + * // credentialsSecretArn: "STRING_VALUE", // required + * // fieldMapping: { // MongoDbAtlasFieldMapping + * // vectorField: "STRING_VALUE", // required + * // textField: "STRING_VALUE", // required + * // metadataField: "STRING_VALUE", // required + * // }, + * // endpointServiceName: "STRING_VALUE", + * // }, * // }, * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED" || "DELETE_UNSUCCESSFUL", // required * // createdAt: new Date("TIMESTAMP"), // required diff --git a/clients/client-bedrock-agent/src/commands/UpdateKnowledgeBaseCommand.ts b/clients/client-bedrock-agent/src/commands/UpdateKnowledgeBaseCommand.ts index f1a686fc9883..8ba50a31fb0d 100644 --- a/clients/client-bedrock-agent/src/commands/UpdateKnowledgeBaseCommand.ts +++ b/clients/client-bedrock-agent/src/commands/UpdateKnowledgeBaseCommand.ts @@ -65,7 +65,7 @@ export interface UpdateKnowledgeBaseCommandOutput extends UpdateKnowledgeBaseRes * }, * }, * storageConfiguration: { // StorageConfiguration - * type: "OPENSEARCH_SERVERLESS" || "PINECONE" || "REDIS_ENTERPRISE_CLOUD" || "RDS", // required + * type: "OPENSEARCH_SERVERLESS" || "PINECONE" || "REDIS_ENTERPRISE_CLOUD" || "RDS" || "MONGO_DB_ATLAS", // required * opensearchServerlessConfiguration: { // OpenSearchServerlessConfiguration * collectionArn: "STRING_VALUE", // required * vectorIndexName: "STRING_VALUE", // required @@ -106,6 +106,19 @@ export interface UpdateKnowledgeBaseCommandOutput extends UpdateKnowledgeBaseRes * metadataField: "STRING_VALUE", // required * }, * }, + * mongoDbAtlasConfiguration: { // MongoDbAtlasConfiguration + * endpoint: "STRING_VALUE", // required + * databaseName: "STRING_VALUE", // required + * collectionName: "STRING_VALUE", // required + * vectorIndexName: "STRING_VALUE", // required + * credentialsSecretArn: "STRING_VALUE", // required + * fieldMapping: { // MongoDbAtlasFieldMapping + * vectorField: "STRING_VALUE", // required + * textField: "STRING_VALUE", // required + * metadataField: "STRING_VALUE", // required + * }, + * endpointServiceName: "STRING_VALUE", + * }, * }, * }; * const command = new UpdateKnowledgeBaseCommand(input); @@ -124,7 +137,7 @@ export interface UpdateKnowledgeBaseCommandOutput extends UpdateKnowledgeBaseRes * // }, * // }, * // storageConfiguration: { // StorageConfiguration - * // type: "OPENSEARCH_SERVERLESS" || "PINECONE" || "REDIS_ENTERPRISE_CLOUD" || "RDS", // required + * // type: "OPENSEARCH_SERVERLESS" || "PINECONE" || "REDIS_ENTERPRISE_CLOUD" || "RDS" || "MONGO_DB_ATLAS", // required * // opensearchServerlessConfiguration: { // OpenSearchServerlessConfiguration * // collectionArn: "STRING_VALUE", // required * // vectorIndexName: "STRING_VALUE", // required @@ -165,6 +178,19 @@ export interface UpdateKnowledgeBaseCommandOutput extends UpdateKnowledgeBaseRes * // metadataField: "STRING_VALUE", // required * // }, * // }, + * // mongoDbAtlasConfiguration: { // MongoDbAtlasConfiguration + * // endpoint: "STRING_VALUE", // required + * // databaseName: "STRING_VALUE", // required + * // collectionName: "STRING_VALUE", // required + * // vectorIndexName: "STRING_VALUE", // required + * // credentialsSecretArn: "STRING_VALUE", // required + * // fieldMapping: { // MongoDbAtlasFieldMapping + * // vectorField: "STRING_VALUE", // required + * // textField: "STRING_VALUE", // required + * // metadataField: "STRING_VALUE", // required + * // }, + * // endpointServiceName: "STRING_VALUE", + * // }, * // }, * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED" || "DELETE_UNSUCCESSFUL", // required * // createdAt: new Date("TIMESTAMP"), // required diff --git a/clients/client-bedrock-agent/src/models/models_0.ts b/clients/client-bedrock-agent/src/models/models_0.ts index b6816c3a1b3b..bca7c4181cdc 100644 --- a/clients/client-bedrock-agent/src/models/models_0.ts +++ b/clients/client-bedrock-agent/src/models/models_0.ts @@ -2222,7 +2222,7 @@ export interface S3DataSourceConfiguration { inclusionPrefixes?: string[]; /** - *

The account ID for the owner of the S3 bucket.

+ *

The bucket account owner ID for the S3 bucket.

* @public */ bucketOwnerAccountId?: string; @@ -2379,7 +2379,7 @@ export interface CreateDataSourceRequest { dataSourceConfiguration: DataSourceConfiguration | undefined; /** - *

The deletion policy for the requested data source

+ *

The data deletion policy assigned to the data source.

* @public */ dataDeletionPolicy?: DataDeletionPolicy; @@ -2474,7 +2474,7 @@ export interface DataSource { vectorIngestionConfiguration?: VectorIngestionConfiguration; /** - *

The deletion policy for the data source.

+ *

The data deletion policy for a data source.

* @public */ dataDeletionPolicy?: DataDeletionPolicy; @@ -2492,7 +2492,7 @@ export interface DataSource { updatedAt: Date | undefined; /** - *

The details of the failure reasons related to the data source.

+ *

The detailed reasons on the failure to delete a data source.

* @public */ failureReasons?: string[]; @@ -2694,7 +2694,7 @@ export interface UpdateDataSourceRequest { dataSourceConfiguration: DataSourceConfiguration | undefined; /** - *

The data deletion policy of the updated data source.

+ *

The data deletion policy assigned to the data source.

* @public */ dataDeletionPolicy?: DataDeletionPolicy; @@ -3239,6 +3239,78 @@ export interface KnowledgeBaseConfiguration { vectorKnowledgeBaseConfiguration?: VectorKnowledgeBaseConfiguration; } +/** + *

Contains the names of the fields to which to map information about the vector store.

+ * @public + */ +export interface MongoDbAtlasFieldMapping { + /** + *

The name of the field in which Amazon Bedrock stores the vector embeddings for your data sources.

+ * @public + */ + vectorField: string | undefined; + + /** + *

The name of the field in which Amazon Bedrock stores the raw text from your data. The text is split according to the chunking strategy you choose.

+ * @public + */ + textField: string | undefined; + + /** + *

The name of the field in which Amazon Bedrock stores metadata about the vector store.

+ * @public + */ + metadataField: string | undefined; +} + +/** + *

Contains details about the storage configuration of the knowledge base in MongoDB Atlas.

+ * @public + */ +export interface MongoDbAtlasConfiguration { + /** + *

The endpoint URL of your MongoDB Atlas cluster for your knowledge base.

+ * @public + */ + endpoint: string | undefined; + + /** + *

The database name in your MongoDB Atlas cluster for your knowledge base.

+ * @public + */ + databaseName: string | undefined; + + /** + *

The collection name of the knowledge base in MongoDB Atlas.

+ * @public + */ + collectionName: string | undefined; + + /** + *

The name of the MongoDB Atlas vector search index.

+ * @public + */ + vectorIndexName: string | undefined; + + /** + *

The Amazon Resource Name (ARN) of the secret that you created in Secrets Manager that contains user credentials for your MongoDB Atlas cluster.

+ * @public + */ + credentialsSecretArn: string | undefined; + + /** + *

Contains the names of the fields to which to map information about the vector store.

+ * @public + */ + fieldMapping: MongoDbAtlasFieldMapping | undefined; + + /** + *

The name of the VPC endpoint service in your account that is connected to your MongoDB Atlas cluster.

+ * @public + */ + endpointServiceName?: string; +} + /** *

Contains the names of the fields to which to map information about the vector store.

* @public @@ -3460,6 +3532,7 @@ export interface RedisEnterpriseCloudConfiguration { * @enum */ export const KnowledgeBaseStorageType = { + MONGO_DB_ATLAS: "MONGO_DB_ATLAS", OPENSEARCH_SERVERLESS: "OPENSEARCH_SERVERLESS", PINECONE: "PINECONE", RDS: "RDS", @@ -3505,6 +3578,12 @@ export interface StorageConfiguration { * @public */ rdsConfiguration?: RdsConfiguration; + + /** + *

Contains the storage configuration of the knowledge base in MongoDB Atlas.

+ * @public + */ + mongoDbAtlasConfiguration?: MongoDbAtlasConfiguration; } /** diff --git a/clients/client-bedrock-agent/src/protocols/Aws_restJson1.ts b/clients/client-bedrock-agent/src/protocols/Aws_restJson1.ts index ad5c6b0b9557..4a45eb7d139e 100644 --- a/clients/client-bedrock-agent/src/protocols/Aws_restJson1.ts +++ b/clients/client-bedrock-agent/src/protocols/Aws_restJson1.ts @@ -147,6 +147,8 @@ import { KnowledgeBase, KnowledgeBaseConfiguration, KnowledgeBaseSummary, + MongoDbAtlasConfiguration, + MongoDbAtlasFieldMapping, OpenSearchServerlessConfiguration, OpenSearchServerlessFieldMapping, ParameterDetail, @@ -2133,6 +2135,10 @@ const se_InferenceConfiguration = (input: InferenceConfiguration, context: __Ser // se_KnowledgeBaseConfiguration omitted. +// se_MongoDbAtlasConfiguration omitted. + +// se_MongoDbAtlasFieldMapping omitted. + // se_OpenSearchServerlessConfiguration omitted. // se_OpenSearchServerlessFieldMapping omitted. @@ -2636,6 +2642,10 @@ const de_KnowledgeBaseSummary = (output: any, context: __SerdeContext): Knowledg }) as any; }; +// de_MongoDbAtlasConfiguration omitted. + +// de_MongoDbAtlasFieldMapping omitted. + // de_OpenSearchServerlessConfiguration omitted. // de_OpenSearchServerlessFieldMapping omitted. diff --git a/codegen/sdk-codegen/aws-models/bedrock-agent.json b/codegen/sdk-codegen/aws-models/bedrock-agent.json index f0cc9f0f6836..dd70b4d349c3 100644 --- a/codegen/sdk-codegen/aws-models/bedrock-agent.json +++ b/codegen/sdk-codegen/aws-models/bedrock-agent.json @@ -2450,7 +2450,7 @@ "dataDeletionPolicy": { "target": "com.amazonaws.bedrockagent#DataDeletionPolicy", "traits": { - "smithy.api#documentation": "

The deletion policy for the requested data source

" + "smithy.api#documentation": "

The data deletion policy assigned to the data source.

" } }, "serverSideEncryptionConfiguration": { @@ -2698,7 +2698,7 @@ "dataDeletionPolicy": { "target": "com.amazonaws.bedrockagent#DataDeletionPolicy", "traits": { - "smithy.api#documentation": "

The deletion policy for the data source.

" + "smithy.api#documentation": "

The data deletion policy for a data source.

" } }, "createdAt": { @@ -2718,7 +2718,7 @@ "failureReasons": { "target": "com.amazonaws.bedrockagent#FailureReasons", "traits": { - "smithy.api#documentation": "

The details of the failure reasons related to the data source.

" + "smithy.api#documentation": "

The detailed reasons on the failure to delete a data source.

" } } }, @@ -4887,6 +4887,12 @@ "traits": { "smithy.api#enumValue": "RDS" } + }, + "MONGO_DB_ATLAS": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "MONGO_DB_ATLAS" + } } } }, @@ -5793,6 +5799,137 @@ "smithy.api#pattern": "^arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:(([0-9]{12}:custom-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}(([:][a-z0-9-]{1,63}){0,2})?/[a-z0-9]{12})|(:foundation-model/([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.]?[a-z0-9-]{1,63})([:][a-z0-9-]{1,63}){0,2})))|(([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.]?[a-z0-9-]{1,63})([:][a-z0-9-]{1,63}){0,2}))|(([0-9a-zA-Z][_-]?)+)$" } }, + "com.amazonaws.bedrockagent#MongoDbAtlasCollectionName": { + "type": "string", + "traits": { + "smithy.api#length": { + "max": 63 + }, + "smithy.api#pattern": "^.*$" + } + }, + "com.amazonaws.bedrockagent#MongoDbAtlasConfiguration": { + "type": "structure", + "members": { + "endpoint": { + "target": "com.amazonaws.bedrockagent#MongoDbAtlasEndpoint", + "traits": { + "smithy.api#documentation": "

The endpoint URL of your MongoDB Atlas cluster for your knowledge base.

", + "smithy.api#required": {} + } + }, + "databaseName": { + "target": "com.amazonaws.bedrockagent#MongoDbAtlasDatabaseName", + "traits": { + "smithy.api#documentation": "

The database name in your MongoDB Atlas cluster for your knowledge base.

", + "smithy.api#required": {} + } + }, + "collectionName": { + "target": "com.amazonaws.bedrockagent#MongoDbAtlasCollectionName", + "traits": { + "smithy.api#documentation": "

The collection name of the knowledge base in MongoDB Atlas.

", + "smithy.api#required": {} + } + }, + "vectorIndexName": { + "target": "com.amazonaws.bedrockagent#MongoDbAtlasIndexName", + "traits": { + "smithy.api#documentation": "

The name of the MongoDB Atlas vector search index.

", + "smithy.api#required": {} + } + }, + "credentialsSecretArn": { + "target": "com.amazonaws.bedrockagent#SecretArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the secret that you created in Secrets Manager that contains user credentials for your MongoDB Atlas cluster.

", + "smithy.api#required": {} + } + }, + "fieldMapping": { + "target": "com.amazonaws.bedrockagent#MongoDbAtlasFieldMapping", + "traits": { + "smithy.api#documentation": "

Contains the names of the fields to which to map information about the vector store.

", + "smithy.api#required": {} + } + }, + "endpointServiceName": { + "target": "com.amazonaws.bedrockagent#MongoDbAtlasEndpointServiceName", + "traits": { + "smithy.api#documentation": "

The name of the VPC endpoint service in your account that is connected to your MongoDB Atlas cluster.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains details about the storage configuration of the knowledge base in MongoDB Atlas.

" + } + }, + "com.amazonaws.bedrockagent#MongoDbAtlasDatabaseName": { + "type": "string", + "traits": { + "smithy.api#length": { + "max": 63 + }, + "smithy.api#pattern": "^.*$" + } + }, + "com.amazonaws.bedrockagent#MongoDbAtlasEndpoint": { + "type": "string", + "traits": { + "smithy.api#length": { + "max": 2048 + }, + "smithy.api#pattern": "^.*$" + } + }, + "com.amazonaws.bedrockagent#MongoDbAtlasEndpointServiceName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 255 + }, + "smithy.api#pattern": "^(?:arn:aws(?:-us-gov|-cn|-iso|-iso-[a-z])*:.+:.*:\\d+:.+/.+$|[a-zA-Z0-9*]+[a-zA-Z0-9._-]*)$" + } + }, + "com.amazonaws.bedrockagent#MongoDbAtlasFieldMapping": { + "type": "structure", + "members": { + "vectorField": { + "target": "com.amazonaws.bedrockagent#FieldName", + "traits": { + "smithy.api#documentation": "

The name of the field in which Amazon Bedrock stores the vector embeddings for your data sources.

", + "smithy.api#required": {} + } + }, + "textField": { + "target": "com.amazonaws.bedrockagent#FieldName", + "traits": { + "smithy.api#documentation": "

The name of the field in which Amazon Bedrock stores the raw text from your data. The text is split according to the chunking strategy you choose.

", + "smithy.api#required": {} + } + }, + "metadataField": { + "target": "com.amazonaws.bedrockagent#FieldName", + "traits": { + "smithy.api#documentation": "

The name of the field in which Amazon Bedrock stores metadata about the vector store.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains the names of the fields to which to map information about the vector store.

" + } + }, + "com.amazonaws.bedrockagent#MongoDbAtlasIndexName": { + "type": "string", + "traits": { + "smithy.api#length": { + "max": 2048 + }, + "smithy.api#pattern": "^.*$" + } + }, "com.amazonaws.bedrockagent#Name": { "type": "string", "traits": { @@ -6496,7 +6633,7 @@ "bucketOwnerAccountId": { "target": "com.amazonaws.bedrockagent#BucketOwnerAccountId", "traits": { - "smithy.api#documentation": "

The account ID for the owner of the S3 bucket.

" + "smithy.api#documentation": "

The bucket account owner ID for the S3 bucket.

" } } }, @@ -6753,6 +6890,12 @@ "traits": { "smithy.api#documentation": "

Contains details about the storage configuration of the knowledge base in Amazon RDS. For more information, see Create a vector index in Amazon RDS.

" } + }, + "mongoDbAtlasConfiguration": { + "target": "com.amazonaws.bedrockagent#MongoDbAtlasConfiguration", + "traits": { + "smithy.api#documentation": "

Contains the storage configuration of the knowledge base in MongoDB Atlas.

" + } } }, "traits": { @@ -7568,7 +7711,7 @@ "dataDeletionPolicy": { "target": "com.amazonaws.bedrockagent#DataDeletionPolicy", "traits": { - "smithy.api#documentation": "

The data deletion policy of the updated data source.

" + "smithy.api#documentation": "

The data deletion policy assigned to the data source.

" } }, "serverSideEncryptionConfiguration": {