All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.cdklabs.generative_ai_cdk_constructs.bedrock.KnowledgeBase Maven / Gradle / Ivy

Go to download

AWS Generative AI CDK Constructs is a library for well-architected generative AI patterns.

The newest version!
package io.github.cdklabs.generative_ai_cdk_constructs.bedrock;

/**
 * (experimental) Deploys a Bedrock Knowledge Base and configures a backend by OpenSearch Serverless, Pinecone, Redis Enterprise Cloud or Amazon Aurora PostgreSQL.
 */
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-01T15:41:28.752Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = io.github.cdklabs.generative_ai_cdk_constructs.$Module.class, fqn = "@cdklabs/generative-ai-cdk-constructs.bedrock.KnowledgeBase")
public class KnowledgeBase extends software.amazon.awscdk.Resource implements io.github.cdklabs.generative_ai_cdk_constructs.bedrock.IKnowledgeBase {

    protected KnowledgeBase(final software.amazon.jsii.JsiiObjectRef objRef) {
        super(objRef);
    }

    protected KnowledgeBase(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
        super(initializationMode);
    }

    /**
     * @param scope This parameter is required.
     * @param id This parameter is required.
     * @param props This parameter is required.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
    public KnowledgeBase(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.KnowledgeBaseProps props) {
        super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
        software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") });
    }

    /**
     * @param scope This parameter is required.
     * @param id This parameter is required.
     * @param attrs This parameter is required.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
    public static @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.IKnowledgeBase fromKnowledgeBaseAttributes(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.KnowledgeBaseAttributes attrs) {
        return software.amazon.jsii.JsiiObject.jsiiStaticCall(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.KnowledgeBase.class, "fromKnowledgeBaseAttributes", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.IKnowledgeBase.class), new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(attrs, "attrs is required") });
    }

    /**
     * (experimental) Add a Confluence data source to the knowledge base.
     * 

* @param props This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @Override public @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ConfluenceDataSource addConfluenceDataSource(final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ConfluenceDataSourceAssociationProps props) { return software.amazon.jsii.Kernel.call(this, "addConfluenceDataSource", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ConfluenceDataSource.class), new Object[] { java.util.Objects.requireNonNull(props, "props is required") }); } /** * (experimental) Add an S3 data source to the knowledge base. *

* @param props This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @Override public @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.S3DataSource addS3DataSource(final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.S3DataSourceAssociationProps props) { return software.amazon.jsii.Kernel.call(this, "addS3DataSource", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.S3DataSource.class), new Object[] { java.util.Objects.requireNonNull(props, "props is required") }); } /** * (experimental) Add a Salesforce data source to the knowledge base. *

* @param props This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @Override public @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.SalesforceDataSource addSalesforceDataSource(final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.SalesforceDataSourceAssociationProps props) { return software.amazon.jsii.Kernel.call(this, "addSalesforceDataSource", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.SalesforceDataSource.class), new Object[] { java.util.Objects.requireNonNull(props, "props is required") }); } /** * (experimental) Add a SharePoint data source to the knowledge base. *

* @param props This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @Override public @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.SharePointDataSource addSharePointDataSource(final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.SharePointDataSourceAssociationProps props) { return software.amazon.jsii.Kernel.call(this, "addSharePointDataSource", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.SharePointDataSource.class), new Object[] { java.util.Objects.requireNonNull(props, "props is required") }); } /** * (experimental) Add a web crawler data source to the knowledge base. *

* @param props This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @Override public @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.WebCrawlerDataSource addWebCrawlerDataSource(final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.WebCrawlerDataSourceAssociationProps props) { return software.amazon.jsii.Kernel.call(this, "addWebCrawlerDataSource", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.WebCrawlerDataSource.class), new Object[] { java.util.Objects.requireNonNull(props, "props is required") }); } /** * (experimental) Associate knowledge base with an agent. *

* @param agent This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public void associateToAgent(final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Agent agent) { software.amazon.jsii.Kernel.call(this, "associateToAgent", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(agent, "agent is required") }); } /** * (experimental) The description knowledge base. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull java.lang.String getDescription() { return software.amazon.jsii.Kernel.get(this, "description", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * (experimental) The ARN of the knowledge base. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull java.lang.String getKnowledgeBaseArn() { return software.amazon.jsii.Kernel.get(this, "knowledgeBaseArn", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * (experimental) The ID of the knowledge base. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull java.lang.String getKnowledgeBaseId() { return software.amazon.jsii.Kernel.get(this, "knowledgeBaseId", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * (experimental) Instance of knowledge base. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.bedrock.CfnKnowledgeBase getKnowledgeBaseInstance() { return software.amazon.jsii.Kernel.get(this, "knowledgeBaseInstance", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.bedrock.CfnKnowledgeBase.class)); } /** * (experimental) Specifies whether to use the knowledge base or not when sending an InvokeAgent request. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull java.lang.String getKnowledgeBaseState() { return software.amazon.jsii.Kernel.get(this, "knowledgeBaseState", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * (experimental) The name of the knowledge base. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull java.lang.String getName() { return software.amazon.jsii.Kernel.get(this, "name", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * (experimental) The role the Knowledge Base uses to access the vector store and data source. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.IRole getRole() { return software.amazon.jsii.Kernel.get(this, "role", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.IRole.class)); } /** * (experimental) The vector store for the knowledge base. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull java.lang.Object getVectorStore() { return software.amazon.jsii.Kernel.get(this, "vectorStore", software.amazon.jsii.NativeType.forClass(java.lang.Object.class)); } /** * (experimental) A narrative instruction of the knowledge base. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.Nullable java.lang.String getInstruction() { return software.amazon.jsii.Kernel.get(this, "instruction", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * (experimental) A fluent builder for {@link io.github.cdklabs.generative_ai_cdk_constructs.bedrock.KnowledgeBase}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public static final class Builder implements software.amazon.jsii.Builder { /** * @return a new instance of {@link Builder}. * @param scope This parameter is required. * @param id This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public static Builder create(final software.constructs.Construct scope, final java.lang.String id) { return new Builder(scope, id); } private final software.constructs.Construct scope; private final java.lang.String id; private final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.KnowledgeBaseProps.Builder props; private Builder(final software.constructs.Construct scope, final java.lang.String id) { this.scope = scope; this.id = id; this.props = new io.github.cdklabs.generative_ai_cdk_constructs.bedrock.KnowledgeBaseProps.Builder(); } /** * (experimental) The embeddings model for the knowledge base. *

* @return {@code this} * @param embeddingsModel The embeddings model for the knowledge base. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder embeddingsModel(final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.BedrockFoundationModel embeddingsModel) { this.props.embeddingsModel(embeddingsModel); return this; } /** * (experimental) The description of the knowledge base. *

* Default: - No description provided. *

* @return {@code this} * @param description The description of the knowledge base. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder description(final java.lang.String description) { this.props.description(description); return this; } /** * (experimental) Existing IAM role with a policy statement granting permission to invoke the specific embeddings model. *

* Any entity (e.g., an AWS service or application) that assumes * this role will be able to invoke or use the * specified embeddings model within the Bedrock service. *

* @return {@code this} * @param existingRole Existing IAM role with a policy statement granting permission to invoke the specific embeddings model. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder existingRole(final software.amazon.awscdk.services.iam.IRole existingRole) { this.props.existingRole(existingRole); return this; } /** * (experimental) The name of the vector index. *

* If vectorStore is not of type VectorCollection, * do not include this property as it will throw error. *

* Default: - 'bedrock-knowledge-base-default-index' *

* @return {@code this} * @param indexName The name of the vector index. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder indexName(final java.lang.String indexName) { this.props.indexName(indexName); return this; } /** * (experimental) A narrative description of the knowledge base. *

* A Bedrock Agent can use this instruction to determine if it should * query this Knowledge Base. *

* Default: - No description provided. *

* @return {@code this} * @param instruction A narrative description of the knowledge base. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder instruction(final java.lang.String instruction) { this.props.instruction(instruction); return this; } /** * (experimental) Specifies whether to use the knowledge base or not when sending an InvokeAgent request. *

* @return {@code this} * @param knowledgeBaseState Specifies whether to use the knowledge base or not when sending an InvokeAgent request. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder knowledgeBaseState(final java.lang.String knowledgeBaseState) { this.props.knowledgeBaseState(knowledgeBaseState); return this; } /** * (experimental) The name of the knowledge base. *

* @return {@code this} * @param name The name of the knowledge base. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder name(final java.lang.String name) { this.props.name(name); return this; } /** * (experimental) OPTIONAL: Tag (KEY-VALUE) bedrock agent resource. *

* Default: - false *

* @return {@code this} * @param tags OPTIONAL: Tag (KEY-VALUE) bedrock agent resource. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder tags(final java.util.Map tags) { this.props.tags(tags); return this; } /** * (experimental) The name of the field in the vector index. *

* If vectorStore is not of type VectorCollection, * do not include this property as it will throw error. *

* Default: - 'bedrock-knowledge-base-default-vector' *

* @return {@code this} * @param vectorField The name of the field in the vector index. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder vectorField(final java.lang.String vectorField) { this.props.vectorField(vectorField); return this; } /** * (experimental) The vector index for the OpenSearch Serverless backed knowledge base. *

* If vectorStore is not of type VectorCollection, do not include * this property as it will throw error. *

* Default: - A new vector index is created on the Vector Collection * if vector store is of `VectorCollection` type. *

* @return {@code this} * @param vectorIndex The vector index for the OpenSearch Serverless backed knowledge base. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder vectorIndex(final io.github.cdklabs.generative_ai_cdk_constructs.opensearch_vectorindex.VectorIndex vectorIndex) { this.props.vectorIndex(vectorIndex); return this; } /** * (experimental) The vector store for the knowledge base. *

* Must be either of * type VectorCollection, RedisEnterpriseVectorStore, * PineconeVectorStore, AmazonAuroraVectorStore or * AmazonAuroraDefaultVectorStore. *

* Default: - A new OpenSearch Serverless vector collection is created. *

* @return {@code this} * @param vectorStore The vector store for the knowledge base. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder vectorStore(final io.github.cdklabs.generative_ai_cdk_constructs.amazonaurora.AmazonAuroraDefaultVectorStore vectorStore) { this.props.vectorStore(vectorStore); return this; } /** * (experimental) The vector store for the knowledge base. *

* Must be either of * type VectorCollection, RedisEnterpriseVectorStore, * PineconeVectorStore, AmazonAuroraVectorStore or * AmazonAuroraDefaultVectorStore. *

* Default: - A new OpenSearch Serverless vector collection is created. *

* @return {@code this} * @param vectorStore The vector store for the knowledge base. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder vectorStore(final io.github.cdklabs.generative_ai_cdk_constructs.amazonaurora.AmazonAuroraVectorStore vectorStore) { this.props.vectorStore(vectorStore); return this; } /** * (experimental) The vector store for the knowledge base. *

* Must be either of * type VectorCollection, RedisEnterpriseVectorStore, * PineconeVectorStore, AmazonAuroraVectorStore or * AmazonAuroraDefaultVectorStore. *

* Default: - A new OpenSearch Serverless vector collection is created. *

* @return {@code this} * @param vectorStore The vector store for the knowledge base. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder vectorStore(final io.github.cdklabs.generative_ai_cdk_constructs.opensearchserverless.VectorCollection vectorStore) { this.props.vectorStore(vectorStore); return this; } /** * (experimental) The vector store for the knowledge base. *

* Must be either of * type VectorCollection, RedisEnterpriseVectorStore, * PineconeVectorStore, AmazonAuroraVectorStore or * AmazonAuroraDefaultVectorStore. *

* Default: - A new OpenSearch Serverless vector collection is created. *

* @return {@code this} * @param vectorStore The vector store for the knowledge base. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder vectorStore(final io.github.cdklabs.generative_ai_cdk_constructs.pinecone.PineconeVectorStore vectorStore) { this.props.vectorStore(vectorStore); return this; } /** * @return a newly built instance of {@link io.github.cdklabs.generative_ai_cdk_constructs.bedrock.KnowledgeBase}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @Override public io.github.cdklabs.generative_ai_cdk_constructs.bedrock.KnowledgeBase build() { return new io.github.cdklabs.generative_ai_cdk_constructs.bedrock.KnowledgeBase( this.scope, this.id, this.props.build() ); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy