All classes are under active development and subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
| Language | Package |
|---|---|
TypeScript |
@cdklabs/generative-ai-cdk-constructs |
Python |
cdklabs.generative_ai_cdk_constructs |
Java |
io.github.cdklabs.generative_ai_cdk_constructs |
.Net |
CdkLabs.GenerativeAICdkConstructs |
Go |
github.com/cdklabs/generative-ai-cdk-constructs-go/generativeaicdkconstructs |
The MongoDBAtlasVectorStore construct allows you to define a MongoDB Atlas instance as a vector store for your Amazon Bedrock Knowledge Base.
typescript fixture=default-bedrock
const vectorStore = new genaicdk.mongodbAtlas.MongoDBAtlasVectorStore({
collectionName: 'embeddings',
credentialsSecretArn: 'arn:aws:secretsmanager:region:account:secret:secret-name',
databaseName: 'vectordb',
endpoint: 'https://your-mongodb-atlas-endpoint.mongodb.net',
endpointServiceName: 'mongodb-atlas',
fieldMapping: {
vectorField: 'embedding',
textField: 'text',
metadataField: 'metadata'
},
vectorIndexName: 'vector_index'
});
The MongoDBAtlasVectorStore construct accepts the following properties:
| Property | Type | Description |
|---|---|---|
collectionName |
string | The name of the collection in MongoDB Atlas |
credentialsSecretArn |
string | The ARN of the AWS Secrets Manager secret containing MongoDB Atlas credentials |
databaseName |
string | The name of the database in MongoDB Atlas |
endpoint |
string | The endpoint URL for MongoDB Atlas |
endpointServiceName |
string | The name of the endpoint service |
fieldMapping |
MongoDbAtlasFieldMapping | The mapping of fields in the MongoDB collection |
vectorIndexName |
string | The name of the vector index in MongoDB Atlas |
The fieldMapping property defines how fields in your MongoDB collection map to vector store concepts:
| Property | Type | Description |
|---|---|---|
vectorField |
string | The field name for storing vector embeddings |
textField |
string | The field name for storing the original text |
metadataField |
string | The field name for storing additional metadata |