io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Agent Maven / Gradle / Ivy
Show all versions of generative-ai-cdk-constructs Show documentation
package io.github.cdklabs.generative_ai_cdk_constructs.bedrock;
/**
* (experimental) Deploy a Bedrock Agent.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-01T15:41:28.666Z")
@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.Agent")
public class Agent extends software.constructs.Construct {
protected Agent(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Agent(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 Agent(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.AgentProps 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) Add action group to the agent.
*
* @param actionGroup This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addActionGroup(final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.AgentActionGroup actionGroup) {
software.amazon.jsii.Kernel.call(this, "addActionGroup", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(actionGroup, "actionGroup is required") });
}
/**
* (experimental) Add action groups to the agent.
*
* @param actionGroups This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addActionGroups(final @org.jetbrains.annotations.NotNull java.util.List actionGroups) {
software.amazon.jsii.Kernel.call(this, "addActionGroups", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(actionGroups, "actionGroups is required") });
}
/**
* (experimental) Add an alias to the agent.
*
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.AgentAlias addAlias(final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.AddAgentAliasProps props) {
return software.amazon.jsii.Kernel.call(this, "addAlias", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.AgentAlias.class), new Object[] { java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) Add guardrail to the agent.
*
* @param guardrail This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addGuardrail(final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Guardrail guardrail) {
software.amazon.jsii.Kernel.call(this, "addGuardrail", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(guardrail, "guardrail is required") });
}
/**
* (experimental) Add knowledge base to the agent.
*
* @param knowledgeBase This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addKnowledgeBase(final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.KnowledgeBase knowledgeBase) {
software.amazon.jsii.Kernel.call(this, "addKnowledgeBase", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(knowledgeBase, "knowledgeBase is required") });
}
/**
* (experimental) Add knowledge bases to the agent.
*
* @param knowledgeBases This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addKnowledgeBases(final @org.jetbrains.annotations.NotNull java.util.List knowledgeBases) {
software.amazon.jsii.Kernel.call(this, "addKnowledgeBases", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(knowledgeBases, "knowledgeBases is required") });
}
/**
* (experimental) The ARN of the agent.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getAgentArn() {
return software.amazon.jsii.Kernel.get(this, "agentArn", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The unique identifier of the agent.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getAgentId() {
return software.amazon.jsii.Kernel.get(this, "agentId", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) Instance of Agent.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.bedrock.CfnAgent getAgentInstance() {
return software.amazon.jsii.Kernel.get(this, "agentInstance", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.bedrock.CfnAgent.class));
}
/**
* (experimental) The version for the agent.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getAgentversion() {
return software.amazon.jsii.Kernel.get(this, "agentversion", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The name of the agent.
*/
@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 IAM role for the agent.
*/
@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 ARN of the agent alias.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable java.lang.String getAliasArn() {
return software.amazon.jsii.Kernel.get(this, "aliasArn", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The unique identifier of the agent alias.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable java.lang.String getAliasId() {
return software.amazon.jsii.Kernel.get(this, "aliasId", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The name for the agent alias.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable java.lang.String getAliasName() {
return software.amazon.jsii.Kernel.get(this, "aliasName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) A list of action groups associated with the agent.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.util.List getActionGroups() {
return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "actionGroups", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.bedrock.CfnAgent.AgentActionGroupProperty.class))));
}
/**
* (experimental) A list of action groups associated with the agent.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void setActionGroups(final @org.jetbrains.annotations.NotNull java.util.List value) {
software.amazon.jsii.Kernel.set(this, "actionGroups", java.util.Objects.requireNonNull(value, "actionGroups is required"));
}
/**
* (experimental) A list of KnowledgeBases associated with the agent.
*
* Default: - No knowledge base is used.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.util.List getKnowledgeBases() {
return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "knowledgeBases", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.bedrock.CfnAgent.AgentKnowledgeBaseProperty.class))));
}
/**
* (experimental) A list of KnowledgeBases associated with the agent.
*
* Default: - No knowledge base is used.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void setKnowledgeBases(final @org.jetbrains.annotations.NotNull java.util.List value) {
software.amazon.jsii.Kernel.set(this, "knowledgeBases", java.util.Objects.requireNonNull(value, "knowledgeBases is required"));
}
/**
* (experimental) A fluent builder for {@link io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Agent}.
*/
@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.AgentProps.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.AgentProps.Builder();
}
/**
* (experimental) The Bedrock text foundation model for the agent to use.
*
* @return {@code this}
* @param foundationModel The Bedrock text foundation model for the agent to use. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder foundationModel(final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.BedrockFoundationModel foundationModel) {
this.props.foundationModel(foundationModel);
return this;
}
/**
* (experimental) A narrative instruction to provide the agent as context.
*
* @return {@code this}
* @param instruction A narrative instruction to provide the agent as context. 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) AgentActionGroup to make available to the agent.
*
* Default: - No AgentActionGroup is used.
*
* @return {@code this}
* @param actionGroups AgentActionGroup to make available to the agent. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder actionGroups(final java.util.List extends io.github.cdklabs.generative_ai_cdk_constructs.bedrock.AgentActionGroup> actionGroups) {
this.props.actionGroups(actionGroups);
return this;
}
/**
* (experimental) Name of the alias for the agent.
*
* Default: - No alias is created.
*
* @return {@code this}
* @param aliasName Name of the alias for the agent. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder aliasName(final java.lang.String aliasName) {
this.props.aliasName(aliasName);
return this;
}
/**
* (experimental) A description of the agent.
*
* Default: - No description is provided.
*
* @return {@code this}
* @param description A description of the agent. 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) Select whether the agent can prompt additional information from the user when it does not have enough information to respond to an utterance.
*
* Default: - False
*
* @return {@code this}
* @param enableUserInput Select whether the agent can prompt additional information from the user when it does not have enough information to respond to an utterance. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder enableUserInput(final java.lang.Boolean enableUserInput) {
this.props.enableUserInput(enableUserInput);
return this;
}
/**
* (experimental) KMS encryption key to use for the agent.
*
* Default: - An AWS managed key is used.
*
* @return {@code this}
* @param encryptionKey KMS encryption key to use for the agent. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder encryptionKey(final software.amazon.awscdk.services.kms.IKey encryptionKey) {
this.props.encryptionKey(encryptionKey);
return this;
}
/**
* (experimental) The existing IAM Role for the agent with a trust policy that allows the Bedrock service to assume the role.
*
* @return {@code this}
* @param existingRole The existing IAM Role for the agent with a trust policy that allows the Bedrock service to assume the role. 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) Guardrail configuration.
*
* Warning: If you provide a guardrail configuration through the constructor,
* you will need to provide the correct permissions for your agent to access
* the guardrails. If you want the permissions to be configured on your behalf,
* use the addGuardrail method.
*
* Default: - No guardrails associated to the agent.
*
* @return {@code this}
* @param guardrailConfiguration Guardrail configuration. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder guardrailConfiguration(final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.GuardrailConfiguration guardrailConfiguration) {
this.props.guardrailConfiguration(guardrailConfiguration);
return this;
}
/**
* (experimental) How long sessions should be kept open for the agent.
*
* Default: - 1 hour
*
* @return {@code this}
* @param idleSessionTtl How long sessions should be kept open for the agent. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder idleSessionTtl(final software.amazon.awscdk.Duration idleSessionTtl) {
this.props.idleSessionTtl(idleSessionTtl);
return this;
}
/**
* (experimental) Knowledge Bases to make available to the agent.
*
* Default: - No knowledge base is used.
*
* @return {@code this}
* @param knowledgeBases Knowledge Bases to make available to the agent. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder knowledgeBases(final java.util.List extends io.github.cdklabs.generative_ai_cdk_constructs.bedrock.KnowledgeBase> knowledgeBases) {
this.props.knowledgeBases(knowledgeBases);
return this;
}
/**
* (experimental) The name of the agent.
*
* Default: - A name is automatically generated.
*
* @return {@code this}
* @param name The name of the agent. 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) Overrides for the agent.
*
* Default: - No overrides are provided.
*
* @return {@code this}
* @param promptOverrideConfiguration Overrides for the agent. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder promptOverrideConfiguration(final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptOverrideConfiguration promptOverrideConfiguration) {
this.props.promptOverrideConfiguration(promptOverrideConfiguration);
return this;
}
/**
* (experimental) Whether to prepare the agent for use.
*
* Default: - false
*
* @return {@code this}
* @param shouldPrepareAgent Whether to prepare the agent for use. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder shouldPrepareAgent(final java.lang.Boolean shouldPrepareAgent) {
this.props.shouldPrepareAgent(shouldPrepareAgent);
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;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Agent}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Agent build() {
return new io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Agent(
this.scope,
this.id,
this.props.build()
);
}
}
}