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.

There is a newer version: 0.1.271
Show 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-09-23T18:35:37.400Z")
@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.constructs.Construct {

    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") });
    }

    /**
     * (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. */ @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. */ @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. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.Role getRole() { return software.amazon.jsii.Kernel.get(this, "role", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.Role.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.Role 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