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

commonMain.aws.sdk.kotlin.services.bedrockagent.BedrockAgentClient.kt Maven / Gradle / Ivy

There is a newer version: 1.3.35
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.bedrockagent

import aws.sdk.kotlin.runtime.auth.credentials.DefaultChainCredentialsProvider
import aws.sdk.kotlin.runtime.auth.credentials.internal.manage
import aws.sdk.kotlin.runtime.client.AwsSdkClientConfig
import aws.sdk.kotlin.runtime.config.AbstractAwsSdkClientFactory
import aws.sdk.kotlin.runtime.config.endpoints.resolveEndpointUrl
import aws.sdk.kotlin.runtime.config.profile.AwsProfile
import aws.sdk.kotlin.runtime.config.profile.AwsSharedConfig
import aws.sdk.kotlin.runtime.http.retries.AwsRetryPolicy
import aws.sdk.kotlin.services.bedrockagent.auth.BedrockAgentAuthSchemeProvider
import aws.sdk.kotlin.services.bedrockagent.auth.DefaultBedrockAgentAuthSchemeProvider
import aws.sdk.kotlin.services.bedrockagent.endpoints.BedrockAgentEndpointParameters
import aws.sdk.kotlin.services.bedrockagent.endpoints.BedrockAgentEndpointProvider
import aws.sdk.kotlin.services.bedrockagent.endpoints.DefaultBedrockAgentEndpointProvider
import aws.sdk.kotlin.services.bedrockagent.model.AssociateAgentKnowledgeBaseRequest
import aws.sdk.kotlin.services.bedrockagent.model.AssociateAgentKnowledgeBaseResponse
import aws.sdk.kotlin.services.bedrockagent.model.CreateAgentActionGroupRequest
import aws.sdk.kotlin.services.bedrockagent.model.CreateAgentActionGroupResponse
import aws.sdk.kotlin.services.bedrockagent.model.CreateAgentAliasRequest
import aws.sdk.kotlin.services.bedrockagent.model.CreateAgentAliasResponse
import aws.sdk.kotlin.services.bedrockagent.model.CreateAgentRequest
import aws.sdk.kotlin.services.bedrockagent.model.CreateAgentResponse
import aws.sdk.kotlin.services.bedrockagent.model.CreateDataSourceRequest
import aws.sdk.kotlin.services.bedrockagent.model.CreateDataSourceResponse
import aws.sdk.kotlin.services.bedrockagent.model.CreateKnowledgeBaseRequest
import aws.sdk.kotlin.services.bedrockagent.model.CreateKnowledgeBaseResponse
import aws.sdk.kotlin.services.bedrockagent.model.DeleteAgentActionGroupRequest
import aws.sdk.kotlin.services.bedrockagent.model.DeleteAgentActionGroupResponse
import aws.sdk.kotlin.services.bedrockagent.model.DeleteAgentAliasRequest
import aws.sdk.kotlin.services.bedrockagent.model.DeleteAgentAliasResponse
import aws.sdk.kotlin.services.bedrockagent.model.DeleteAgentRequest
import aws.sdk.kotlin.services.bedrockagent.model.DeleteAgentResponse
import aws.sdk.kotlin.services.bedrockagent.model.DeleteAgentVersionRequest
import aws.sdk.kotlin.services.bedrockagent.model.DeleteAgentVersionResponse
import aws.sdk.kotlin.services.bedrockagent.model.DeleteDataSourceRequest
import aws.sdk.kotlin.services.bedrockagent.model.DeleteDataSourceResponse
import aws.sdk.kotlin.services.bedrockagent.model.DeleteKnowledgeBaseRequest
import aws.sdk.kotlin.services.bedrockagent.model.DeleteKnowledgeBaseResponse
import aws.sdk.kotlin.services.bedrockagent.model.DisassociateAgentKnowledgeBaseRequest
import aws.sdk.kotlin.services.bedrockagent.model.DisassociateAgentKnowledgeBaseResponse
import aws.sdk.kotlin.services.bedrockagent.model.GetAgentActionGroupRequest
import aws.sdk.kotlin.services.bedrockagent.model.GetAgentActionGroupResponse
import aws.sdk.kotlin.services.bedrockagent.model.GetAgentAliasRequest
import aws.sdk.kotlin.services.bedrockagent.model.GetAgentAliasResponse
import aws.sdk.kotlin.services.bedrockagent.model.GetAgentKnowledgeBaseRequest
import aws.sdk.kotlin.services.bedrockagent.model.GetAgentKnowledgeBaseResponse
import aws.sdk.kotlin.services.bedrockagent.model.GetAgentRequest
import aws.sdk.kotlin.services.bedrockagent.model.GetAgentResponse
import aws.sdk.kotlin.services.bedrockagent.model.GetAgentVersionRequest
import aws.sdk.kotlin.services.bedrockagent.model.GetAgentVersionResponse
import aws.sdk.kotlin.services.bedrockagent.model.GetDataSourceRequest
import aws.sdk.kotlin.services.bedrockagent.model.GetDataSourceResponse
import aws.sdk.kotlin.services.bedrockagent.model.GetIngestionJobRequest
import aws.sdk.kotlin.services.bedrockagent.model.GetIngestionJobResponse
import aws.sdk.kotlin.services.bedrockagent.model.GetKnowledgeBaseRequest
import aws.sdk.kotlin.services.bedrockagent.model.GetKnowledgeBaseResponse
import aws.sdk.kotlin.services.bedrockagent.model.ListAgentActionGroupsRequest
import aws.sdk.kotlin.services.bedrockagent.model.ListAgentActionGroupsResponse
import aws.sdk.kotlin.services.bedrockagent.model.ListAgentAliasesRequest
import aws.sdk.kotlin.services.bedrockagent.model.ListAgentAliasesResponse
import aws.sdk.kotlin.services.bedrockagent.model.ListAgentKnowledgeBasesRequest
import aws.sdk.kotlin.services.bedrockagent.model.ListAgentKnowledgeBasesResponse
import aws.sdk.kotlin.services.bedrockagent.model.ListAgentVersionsRequest
import aws.sdk.kotlin.services.bedrockagent.model.ListAgentVersionsResponse
import aws.sdk.kotlin.services.bedrockagent.model.ListAgentsRequest
import aws.sdk.kotlin.services.bedrockagent.model.ListAgentsResponse
import aws.sdk.kotlin.services.bedrockagent.model.ListDataSourcesRequest
import aws.sdk.kotlin.services.bedrockagent.model.ListDataSourcesResponse
import aws.sdk.kotlin.services.bedrockagent.model.ListIngestionJobsRequest
import aws.sdk.kotlin.services.bedrockagent.model.ListIngestionJobsResponse
import aws.sdk.kotlin.services.bedrockagent.model.ListKnowledgeBasesRequest
import aws.sdk.kotlin.services.bedrockagent.model.ListKnowledgeBasesResponse
import aws.sdk.kotlin.services.bedrockagent.model.ListTagsForResourceRequest
import aws.sdk.kotlin.services.bedrockagent.model.ListTagsForResourceResponse
import aws.sdk.kotlin.services.bedrockagent.model.PrepareAgentRequest
import aws.sdk.kotlin.services.bedrockagent.model.PrepareAgentResponse
import aws.sdk.kotlin.services.bedrockagent.model.StartIngestionJobRequest
import aws.sdk.kotlin.services.bedrockagent.model.StartIngestionJobResponse
import aws.sdk.kotlin.services.bedrockagent.model.TagResourceRequest
import aws.sdk.kotlin.services.bedrockagent.model.TagResourceResponse
import aws.sdk.kotlin.services.bedrockagent.model.UntagResourceRequest
import aws.sdk.kotlin.services.bedrockagent.model.UntagResourceResponse
import aws.sdk.kotlin.services.bedrockagent.model.UpdateAgentActionGroupRequest
import aws.sdk.kotlin.services.bedrockagent.model.UpdateAgentActionGroupResponse
import aws.sdk.kotlin.services.bedrockagent.model.UpdateAgentAliasRequest
import aws.sdk.kotlin.services.bedrockagent.model.UpdateAgentAliasResponse
import aws.sdk.kotlin.services.bedrockagent.model.UpdateAgentKnowledgeBaseRequest
import aws.sdk.kotlin.services.bedrockagent.model.UpdateAgentKnowledgeBaseResponse
import aws.sdk.kotlin.services.bedrockagent.model.UpdateAgentRequest
import aws.sdk.kotlin.services.bedrockagent.model.UpdateAgentResponse
import aws.sdk.kotlin.services.bedrockagent.model.UpdateDataSourceRequest
import aws.sdk.kotlin.services.bedrockagent.model.UpdateDataSourceResponse
import aws.sdk.kotlin.services.bedrockagent.model.UpdateKnowledgeBaseRequest
import aws.sdk.kotlin.services.bedrockagent.model.UpdateKnowledgeBaseResponse
import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider
import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProviderConfig
import aws.smithy.kotlin.runtime.awsprotocol.ClockSkewInterceptor
import aws.smithy.kotlin.runtime.client.AbstractSdkClientBuilder
import aws.smithy.kotlin.runtime.client.IdempotencyTokenConfig
import aws.smithy.kotlin.runtime.client.IdempotencyTokenProvider
import aws.smithy.kotlin.runtime.client.LogMode
import aws.smithy.kotlin.runtime.client.RetryClientConfig
import aws.smithy.kotlin.runtime.client.RetryStrategyClientConfig
import aws.smithy.kotlin.runtime.client.RetryStrategyClientConfigImpl
import aws.smithy.kotlin.runtime.client.SdkClient
import aws.smithy.kotlin.runtime.client.SdkClientConfig
import aws.smithy.kotlin.runtime.client.SdkClientFactory
import aws.smithy.kotlin.runtime.http.auth.AuthScheme
import aws.smithy.kotlin.runtime.http.auth.HttpAuthConfig
import aws.smithy.kotlin.runtime.http.config.HttpClientConfig
import aws.smithy.kotlin.runtime.http.config.HttpEngineConfig
import aws.smithy.kotlin.runtime.http.engine.HttpClientEngine
import aws.smithy.kotlin.runtime.http.engine.HttpEngineConfigImpl
import aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor
import aws.smithy.kotlin.runtime.net.url.Url
import aws.smithy.kotlin.runtime.retries.RetryStrategy
import aws.smithy.kotlin.runtime.retries.policy.RetryPolicy
import aws.smithy.kotlin.runtime.telemetry.Global
import aws.smithy.kotlin.runtime.telemetry.TelemetryConfig
import aws.smithy.kotlin.runtime.telemetry.TelemetryProvider
import aws.smithy.kotlin.runtime.util.LazyAsyncValue
import kotlin.collections.List
import kotlin.jvm.JvmStatic


public const val ServiceId: String = "Bedrock Agent"
public const val SdkVersion: String = "1.1.21"
public const val ServiceApiVersion: String = "2023-06-05"

/**
 * Describes the API operations for creating and managing Amazon Bedrock agents.
 */
public interface BedrockAgentClient : SdkClient {
    /**
     * BedrockAgentClient's configuration
     */
    public override val config: Config

    public companion object : AbstractAwsSdkClientFactory() {
        @JvmStatic
        override fun builder(): Builder = Builder()

        override suspend fun finalizeConfig(builder: Builder, sharedConfig: LazyAsyncValue, activeProfile: LazyAsyncValue) {
            builder.config.endpointUrl = builder.config.endpointUrl ?: resolveEndpointUrl(
                sharedConfig,
                "BedrockAgent",
                "BEDROCK_AGENT",
                "bedrock_agent",
            )
            builder.config.interceptors.add(0, ClockSkewInterceptor())
        }
    }

    public class Builder internal constructor(): AbstractSdkClientBuilder() {
        override val config: Config.Builder = Config.Builder()
        override fun newClient(config: Config): BedrockAgentClient = DefaultBedrockAgentClient(config)
    }

    public class Config private constructor(builder: Builder) : AwsSdkClientConfig, CredentialsProviderConfig, HttpAuthConfig, HttpClientConfig, HttpEngineConfig by builder.buildHttpEngineConfig(), IdempotencyTokenConfig, RetryClientConfig, RetryStrategyClientConfig by builder.buildRetryStrategyClientConfig(), SdkClientConfig, TelemetryConfig {
        override val clientName: String = builder.clientName
        override val region: String? = builder.region
        override val authSchemes: kotlin.collections.List = builder.authSchemes
        override val credentialsProvider: CredentialsProvider = builder.credentialsProvider ?: DefaultChainCredentialsProvider(httpClient = httpClient, region = region).manage()
        public val endpointProvider: BedrockAgentEndpointProvider = builder.endpointProvider ?: DefaultBedrockAgentEndpointProvider()
        public val endpointUrl: Url? = builder.endpointUrl
        override val idempotencyTokenProvider: IdempotencyTokenProvider = builder.idempotencyTokenProvider ?: IdempotencyTokenProvider.Default
        override val interceptors: kotlin.collections.List = builder.interceptors
        override val logMode: LogMode = builder.logMode ?: LogMode.Default
        override val retryPolicy: RetryPolicy = builder.retryPolicy ?: AwsRetryPolicy.Default
        override val telemetryProvider: TelemetryProvider = builder.telemetryProvider ?: TelemetryProvider.Global
        override val useDualStack: Boolean = builder.useDualStack ?: false
        override val useFips: Boolean = builder.useFips ?: false
        override val applicationId: String? = builder.applicationId
        public val authSchemeProvider: BedrockAgentAuthSchemeProvider = builder.authSchemeProvider ?: DefaultBedrockAgentAuthSchemeProvider()
        public companion object {
            public inline operator fun invoke(block: Builder.() -> kotlin.Unit): Config = Builder().apply(block).build()
        }

        public fun toBuilder(): Builder = Builder().apply {
            clientName = [email protected]
            region = [email protected]
            authSchemes = [email protected]
            credentialsProvider = [email protected]
            endpointProvider = [email protected]
            endpointUrl = [email protected]
            httpClient = [email protected]
            idempotencyTokenProvider = [email protected]
            interceptors = [email protected]()
            logMode = [email protected]
            retryPolicy = [email protected]
            retryStrategy = [email protected]
            telemetryProvider = [email protected]
            useDualStack = [email protected]
            useFips = [email protected]
            applicationId = [email protected]
            authSchemeProvider = [email protected]
        }

        public class Builder : AwsSdkClientConfig.Builder, CredentialsProviderConfig.Builder, HttpAuthConfig.Builder, HttpClientConfig.Builder, HttpEngineConfig.Builder by HttpEngineConfigImpl.BuilderImpl(), IdempotencyTokenConfig.Builder, RetryClientConfig.Builder, RetryStrategyClientConfig.Builder by RetryStrategyClientConfigImpl.BuilderImpl(), SdkClientConfig.Builder, TelemetryConfig.Builder {
            /**
             * A reader-friendly name for the client.
             */
            override var clientName: String = "Bedrock Agent"

            /**
             * The AWS region (e.g. `us-west-2`) to make requests to. See about AWS
             * [global infrastructure](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/) for more
             * information
             */
            override var region: String? = null

            /**
             * Register new or override default [AuthScheme]s configured for this client. By default, the set
             * of auth schemes configured comes from the service model. An auth scheme configured explicitly takes
             * precedence over the defaults and can be used to customize identity resolution and signing for specific
             * authentication schemes.
             */
            override var authSchemes: kotlin.collections.List = emptyList()

            /**
             * The AWS credentials provider to use for authenticating requests. If not provided a
             * [aws.sdk.kotlin.runtime.auth.credentials.DefaultChainCredentialsProvider] instance will be used.
             * NOTE: The caller is responsible for managing the lifetime of the provider when set. The SDK
             * client will not close it when the client is closed.
             */
            override var credentialsProvider: CredentialsProvider? = null

            /**
             * The endpoint provider used to determine where to make service requests. **This is an advanced config
             * option.**
             *
             * Endpoint resolution occurs as part of the workflow for every request made via the service client.
             *
             * The inputs to endpoint resolution are defined on a per-service basis (see [EndpointParameters]).
             */
            public var endpointProvider: BedrockAgentEndpointProvider? = null

            /**
             * A custom endpoint to route requests to. The endpoint set here is passed to the configured
             * [endpointProvider], which may inspect and modify it as needed.
             *
             * Setting a custom endpointUrl should generally be preferred to overriding the [endpointProvider] and is
             * the recommended way to route requests to development or preview instances of a service.
             *
             * **This is an advanced config option.**
             */
            public var endpointUrl: Url? = null

            /**
             * Override the default idempotency token generator. SDK clients will generate tokens for members
             * that represent idempotent tokens when not explicitly set by the caller using this generator.
             */
            override var idempotencyTokenProvider: IdempotencyTokenProvider? = null

            /**
             * Add an [aws.smithy.kotlin.runtime.client.Interceptor] that will have access to read and modify
             * the request and response objects as they are processed by the SDK.
             * Interceptors added using this method are executed in the order they are configured and are always
             * later than any added automatically by the SDK.
             */
            override var interceptors: kotlin.collections.MutableList = kotlin.collections.mutableListOf()

            /**
             * Configure events that will be logged. By default clients will not output
             * raw requests or responses. Use this setting to opt-in to additional debug logging.
             *
             * This can be used to configure logging of requests, responses, retries, etc of SDK clients.
             *
             * **NOTE**: Logging of raw requests or responses may leak sensitive information! It may also have
             * performance considerations when dumping the request/response body. This is primarily a tool for
             * debug purposes.
             */
            override var logMode: LogMode? = null

            /**
             * The policy to use for evaluating operation results and determining whether/how to retry.
             */
            override var retryPolicy: RetryPolicy? = null

            /**
             * The telemetry provider used to instrument the SDK operations with. By default, the global telemetry
             * provider will be used.
             */
            override var telemetryProvider: TelemetryProvider? = null

            /**
             *            Flag to toggle whether to use dual-stack endpoints when making requests.
             *            See [https://docs.aws.amazon.com/sdkref/latest/guide/feature-endpoints.html] for more information.
             * `          Disabled by default.
             */
            override var useDualStack: Boolean? = null

            /**
             *            Flag to toggle whether to use [FIPS](https://aws.amazon.com/compliance/fips/) endpoints when making requests.
             * `          Disabled by default.
             */
            override var useFips: Boolean? = null

            /**
             * An optional application specific identifier.
             * When set it will be appended to the User-Agent header of every request in the form of: `app/{applicationId}`.
             * When not explicitly set, the value will be loaded from the following locations:
             *
             * - JVM System Property: `aws.userAgentAppId`
             * - Environment variable: `AWS_SDK_UA_APP_ID`
             * - Shared configuration profile attribute: `sdk_ua_app_id`
             *
             * See [shared configuration settings](https://docs.aws.amazon.com/sdkref/latest/guide/settings-reference.html)
             * reference for more information on environment variables and shared config settings.
             */
            override var applicationId: String? = null

            /**
             * Configure the provider used to resolve the authentication scheme to use for a particular operation.
             */
            public var authSchemeProvider: BedrockAgentAuthSchemeProvider? = null

            override fun build(): Config = Config(this)
        }
    }

    /**
     * Associates a knowledge base with an agent. If a knowledge base is associated and its `indexState` is set to `Enabled`, the agent queries the knowledge base for information to augment its response to the user.
     */
    public suspend fun associateAgentKnowledgeBase(input: AssociateAgentKnowledgeBaseRequest): AssociateAgentKnowledgeBaseResponse

    /**
     * Creates an agent that orchestrates interactions between foundation models, data sources, software applications, user conversations, and APIs to carry out tasks to help customers.
     * + Specify the following fields for security purposes.
     *    + `agentResourceRoleArn` – The Amazon Resource Name (ARN) of the role with permissions to invoke API operations on an agent.
     *    + (Optional) `customerEncryptionKeyArn` – The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent.
     *    + (Optional) `idleSessionTTLinSeconds` – Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequent `InvokeAgent` request begins a new session.
     * + To override the default prompt behavior for agent orchestration and to use advanced prompts, include a `promptOverrideConfiguration` object. For more information, see [Advanced prompts](https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts.html).
     * + If you agent fails to be created, the response returns a list of `failureReasons` alongside a list of `recommendedActions` for you to troubleshoot.
     */
    public suspend fun createAgent(input: CreateAgentRequest): CreateAgentResponse

    /**
     * Creates an action group for an agent. An action group represents the actions that an agent can carry out for the customer by defining the APIs that an agent can call and the logic for calling them.
     *
     * To allow your agent to request the user for additional information when trying to complete a task, add an action group with the `parentActionGroupSignature` field set to `AMAZON.UserInput`. You must leave the `description`, `apiSchema`, and `actionGroupExecutor` fields blank for this action group. During orchestration, if your agent determines that it needs to invoke an API in an action group, but doesn't have enough information to complete the API request, it will invoke this action group instead and return an [Observation](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Observation.html) reprompting the user for more information.
     */
    public suspend fun createAgentActionGroup(input: CreateAgentActionGroupRequest): CreateAgentActionGroupResponse

    /**
     * Creates an alias of an agent that can be used to deploy the agent.
     */
    public suspend fun createAgentAlias(input: CreateAgentAliasRequest): CreateAgentAliasResponse

    /**
     * Sets up a data source to be added to a knowledge base.
     *
     * You can't change the `chunkingConfiguration` after you create the data source.
     */
    public suspend fun createDataSource(input: CreateDataSourceRequest): CreateDataSourceResponse

    /**
     * Creates a knowledge base that contains data sources from which information can be queried and used by LLMs. To create a knowledge base, you must first set up your data sources and configure a supported vector store. For more information, see [Set up your data for ingestion](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-setup.html).
     *
     * If you prefer to let Amazon Bedrock create and manage a vector store for you in Amazon OpenSearch Service, use the console. For more information, see [Create a knowledge base](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-create).
     *
     * + Provide the `name` and an optional `description`.
     * + Provide the Amazon Resource Name (ARN) with permissions to create a knowledge base in the `roleArn` field.
     * + Provide the embedding model to use in the `embeddingModelArn` field in the `knowledgeBaseConfiguration` object.
     * + Provide the configuration for your vector store in the `storageConfiguration` object.
     *    + For an Amazon OpenSearch Service database, use the `opensearchServerlessConfiguration` object. For more information, see [Create a vector store in Amazon OpenSearch Service](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-setup-oss.html).
     *    + For an Amazon Aurora database, use the `RdsConfiguration` object. For more information, see [Create a vector store in Amazon Aurora](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-setup-rds.html).
     *    + For a Pinecone database, use the `pineconeConfiguration` object. For more information, see [Create a vector store in Pinecone](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-setup-pinecone.html).
     *    + For a Redis Enterprise Cloud database, use the `redisEnterpriseCloudConfiguration` object. For more information, see [Create a vector store in Redis Enterprise Cloud](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-setup-redis.html).
     */
    public suspend fun createKnowledgeBase(input: CreateKnowledgeBaseRequest): CreateKnowledgeBaseResponse

    /**
     * Deletes an agent.
     */
    public suspend fun deleteAgent(input: DeleteAgentRequest): DeleteAgentResponse

    /**
     * Deletes an action group in an agent.
     */
    public suspend fun deleteAgentActionGroup(input: DeleteAgentActionGroupRequest): DeleteAgentActionGroupResponse

    /**
     * Deletes an alias of an agent.
     */
    public suspend fun deleteAgentAlias(input: DeleteAgentAliasRequest): DeleteAgentAliasResponse

    /**
     * Deletes a version of an agent.
     */
    public suspend fun deleteAgentVersion(input: DeleteAgentVersionRequest): DeleteAgentVersionResponse

    /**
     * Deletes a data source from a knowledge base.
     */
    public suspend fun deleteDataSource(input: DeleteDataSourceRequest): DeleteDataSourceResponse

    /**
     * Deletes a knowledge base. Before deleting a knowledge base, you should disassociate the knowledge base from any agents that it is associated with by making a [DisassociateAgentKnowledgeBase](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_DisassociateAgentKnowledgeBase.html) request.
     */
    public suspend fun deleteKnowledgeBase(input: DeleteKnowledgeBaseRequest): DeleteKnowledgeBaseResponse

    /**
     * Disassociates a knowledge base from an agent.
     */
    public suspend fun disassociateAgentKnowledgeBase(input: DisassociateAgentKnowledgeBaseRequest): DisassociateAgentKnowledgeBaseResponse

    /**
     * Gets information about an agent.
     */
    public suspend fun getAgent(input: GetAgentRequest): GetAgentResponse

    /**
     * Gets information about an action group for an agent.
     */
    public suspend fun getAgentActionGroup(input: GetAgentActionGroupRequest): GetAgentActionGroupResponse

    /**
     * Gets information about an alias of an agent.
     */
    public suspend fun getAgentAlias(input: GetAgentAliasRequest): GetAgentAliasResponse

    /**
     * Gets information about a knowledge base associated with an agent.
     */
    public suspend fun getAgentKnowledgeBase(input: GetAgentKnowledgeBaseRequest): GetAgentKnowledgeBaseResponse

    /**
     * Gets details about a version of an agent.
     */
    public suspend fun getAgentVersion(input: GetAgentVersionRequest): GetAgentVersionResponse

    /**
     * Gets information about a data source.
     */
    public suspend fun getDataSource(input: GetDataSourceRequest): GetDataSourceResponse

    /**
     * Gets information about a ingestion job, in which a data source is added to a knowledge base.
     */
    public suspend fun getIngestionJob(input: GetIngestionJobRequest): GetIngestionJobResponse

    /**
     * Gets information about a knoweldge base.
     */
    public suspend fun getKnowledgeBase(input: GetKnowledgeBaseRequest): GetKnowledgeBaseResponse

    /**
     * Lists the action groups for an agent and information about each one.
     */
    public suspend fun listAgentActionGroups(input: ListAgentActionGroupsRequest): ListAgentActionGroupsResponse

    /**
     * Lists the aliases of an agent and information about each one.
     */
    public suspend fun listAgentAliases(input: ListAgentAliasesRequest): ListAgentAliasesResponse

    /**
     * Lists knowledge bases associated with an agent and information about each one.
     */
    public suspend fun listAgentKnowledgeBases(input: ListAgentKnowledgeBasesRequest): ListAgentKnowledgeBasesResponse

    /**
     * Lists the versions of an agent and information about each version.
     */
    public suspend fun listAgentVersions(input: ListAgentVersionsRequest): ListAgentVersionsResponse

    /**
     * Lists the agents belonging to an account and information about each agent.
     */
    public suspend fun listAgents(input: ListAgentsRequest = ListAgentsRequest { }): ListAgentsResponse

    /**
     * Lists the data sources in a knowledge base and information about each one.
     */
    public suspend fun listDataSources(input: ListDataSourcesRequest): ListDataSourcesResponse

    /**
     * Lists the ingestion jobs for a data source and information about each of them.
     */
    public suspend fun listIngestionJobs(input: ListIngestionJobsRequest): ListIngestionJobsResponse

    /**
     * Lists the knowledge bases in an account and information about each of them.
     */
    public suspend fun listKnowledgeBases(input: ListKnowledgeBasesRequest = ListKnowledgeBasesRequest { }): ListKnowledgeBasesResponse

    /**
     * List all the tags for the resource you specify.
     */
    public suspend fun listTagsForResource(input: ListTagsForResourceRequest): ListTagsForResourceResponse

    /**
     * Creates a `DRAFT` version of the agent that can be used for internal testing.
     */
    public suspend fun prepareAgent(input: PrepareAgentRequest): PrepareAgentResponse

    /**
     * Begins an ingestion job, in which a data source is added to a knowledge base.
     */
    public suspend fun startIngestionJob(input: StartIngestionJobRequest): StartIngestionJobResponse

    /**
     * Associate tags with a resource. For more information, see [Tagging resources](https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html) in the Amazon Bedrock User Guide.
     */
    public suspend fun tagResource(input: TagResourceRequest): TagResourceResponse

    /**
     * Remove tags from a resource.
     */
    public suspend fun untagResource(input: UntagResourceRequest): UntagResourceResponse

    /**
     * Updates the configuration of an agent.
     */
    public suspend fun updateAgent(input: UpdateAgentRequest): UpdateAgentResponse

    /**
     * Updates the configuration for an action group for an agent.
     */
    public suspend fun updateAgentActionGroup(input: UpdateAgentActionGroupRequest): UpdateAgentActionGroupResponse

    /**
     * Updates configurations for an alias of an agent.
     */
    public suspend fun updateAgentAlias(input: UpdateAgentAliasRequest): UpdateAgentAliasResponse

    /**
     * Updates the configuration for a knowledge base that has been associated with an agent.
     */
    public suspend fun updateAgentKnowledgeBase(input: UpdateAgentKnowledgeBaseRequest): UpdateAgentKnowledgeBaseResponse

    /**
     * Updates configurations for a data source.
     *
     * You can't change the `chunkingConfiguration` after you create the data source. Specify the existing `chunkingConfiguration`.
     */
    public suspend fun updateDataSource(input: UpdateDataSourceRequest): UpdateDataSourceResponse

    /**
     * Updates the configuration of a knowledge base with the fields that you specify. Because all fields will be overwritten, you must include the same values for fields that you want to keep the same.
     *
     * You can change the following fields:
     * + `name`
     * + `description`
     * + `roleArn`
     *
     * You can't change the `knowledgeBaseConfiguration` or `storageConfiguration` fields, so you must specify the same configurations as when you created the knowledge base. You can send a [GetKnowledgeBase](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_GetKnowledgeBase.html) request and copy the same configurations.
     */
    public suspend fun updateKnowledgeBase(input: UpdateKnowledgeBaseRequest): UpdateKnowledgeBaseResponse
}

/**
 * Create a copy of the client with one or more configuration values overridden.
 * This method allows the caller to perform scoped config overrides for one or more client operations.
 *
 * Any resources created on your behalf will be shared between clients, and will only be closed when ALL clients using them are closed.
 * If you provide a resource (e.g. [HttpClientEngine]) to the SDK, you are responsible for managing the lifetime of that resource.
 */
public fun BedrockAgentClient.withConfig(block: BedrockAgentClient.Config.Builder.() -> Unit): BedrockAgentClient {
    val newConfig = config.toBuilder().apply(block).build()
    return DefaultBedrockAgentClient(newConfig)
}

/**
 * Associates a knowledge base with an agent. If a knowledge base is associated and its `indexState` is set to `Enabled`, the agent queries the knowledge base for information to augment its response to the user.
 */
public suspend inline fun BedrockAgentClient.associateAgentKnowledgeBase(crossinline block: AssociateAgentKnowledgeBaseRequest.Builder.() -> Unit): AssociateAgentKnowledgeBaseResponse = associateAgentKnowledgeBase(AssociateAgentKnowledgeBaseRequest.Builder().apply(block).build())

/**
 * Creates an agent that orchestrates interactions between foundation models, data sources, software applications, user conversations, and APIs to carry out tasks to help customers.
 * + Specify the following fields for security purposes.
 *    + `agentResourceRoleArn` – The Amazon Resource Name (ARN) of the role with permissions to invoke API operations on an agent.
 *    + (Optional) `customerEncryptionKeyArn` – The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent.
 *    + (Optional) `idleSessionTTLinSeconds` – Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequent `InvokeAgent` request begins a new session.
 * + To override the default prompt behavior for agent orchestration and to use advanced prompts, include a `promptOverrideConfiguration` object. For more information, see [Advanced prompts](https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts.html).
 * + If you agent fails to be created, the response returns a list of `failureReasons` alongside a list of `recommendedActions` for you to troubleshoot.
 */
public suspend inline fun BedrockAgentClient.createAgent(crossinline block: CreateAgentRequest.Builder.() -> Unit): CreateAgentResponse = createAgent(CreateAgentRequest.Builder().apply(block).build())

/**
 * Creates an action group for an agent. An action group represents the actions that an agent can carry out for the customer by defining the APIs that an agent can call and the logic for calling them.
 *
 * To allow your agent to request the user for additional information when trying to complete a task, add an action group with the `parentActionGroupSignature` field set to `AMAZON.UserInput`. You must leave the `description`, `apiSchema`, and `actionGroupExecutor` fields blank for this action group. During orchestration, if your agent determines that it needs to invoke an API in an action group, but doesn't have enough information to complete the API request, it will invoke this action group instead and return an [Observation](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Observation.html) reprompting the user for more information.
 */
public suspend inline fun BedrockAgentClient.createAgentActionGroup(crossinline block: CreateAgentActionGroupRequest.Builder.() -> Unit): CreateAgentActionGroupResponse = createAgentActionGroup(CreateAgentActionGroupRequest.Builder().apply(block).build())

/**
 * Creates an alias of an agent that can be used to deploy the agent.
 */
public suspend inline fun BedrockAgentClient.createAgentAlias(crossinline block: CreateAgentAliasRequest.Builder.() -> Unit): CreateAgentAliasResponse = createAgentAlias(CreateAgentAliasRequest.Builder().apply(block).build())

/**
 * Sets up a data source to be added to a knowledge base.
 *
 * You can't change the `chunkingConfiguration` after you create the data source.
 */
public suspend inline fun BedrockAgentClient.createDataSource(crossinline block: CreateDataSourceRequest.Builder.() -> Unit): CreateDataSourceResponse = createDataSource(CreateDataSourceRequest.Builder().apply(block).build())

/**
 * Creates a knowledge base that contains data sources from which information can be queried and used by LLMs. To create a knowledge base, you must first set up your data sources and configure a supported vector store. For more information, see [Set up your data for ingestion](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-setup.html).
 *
 * If you prefer to let Amazon Bedrock create and manage a vector store for you in Amazon OpenSearch Service, use the console. For more information, see [Create a knowledge base](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-create).
 *
 * + Provide the `name` and an optional `description`.
 * + Provide the Amazon Resource Name (ARN) with permissions to create a knowledge base in the `roleArn` field.
 * + Provide the embedding model to use in the `embeddingModelArn` field in the `knowledgeBaseConfiguration` object.
 * + Provide the configuration for your vector store in the `storageConfiguration` object.
 *    + For an Amazon OpenSearch Service database, use the `opensearchServerlessConfiguration` object. For more information, see [Create a vector store in Amazon OpenSearch Service](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-setup-oss.html).
 *    + For an Amazon Aurora database, use the `RdsConfiguration` object. For more information, see [Create a vector store in Amazon Aurora](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-setup-rds.html).
 *    + For a Pinecone database, use the `pineconeConfiguration` object. For more information, see [Create a vector store in Pinecone](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-setup-pinecone.html).
 *    + For a Redis Enterprise Cloud database, use the `redisEnterpriseCloudConfiguration` object. For more information, see [Create a vector store in Redis Enterprise Cloud](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-setup-redis.html).
 */
public suspend inline fun BedrockAgentClient.createKnowledgeBase(crossinline block: CreateKnowledgeBaseRequest.Builder.() -> Unit): CreateKnowledgeBaseResponse = createKnowledgeBase(CreateKnowledgeBaseRequest.Builder().apply(block).build())

/**
 * Deletes an agent.
 */
public suspend inline fun BedrockAgentClient.deleteAgent(crossinline block: DeleteAgentRequest.Builder.() -> Unit): DeleteAgentResponse = deleteAgent(DeleteAgentRequest.Builder().apply(block).build())

/**
 * Deletes an action group in an agent.
 */
public suspend inline fun BedrockAgentClient.deleteAgentActionGroup(crossinline block: DeleteAgentActionGroupRequest.Builder.() -> Unit): DeleteAgentActionGroupResponse = deleteAgentActionGroup(DeleteAgentActionGroupRequest.Builder().apply(block).build())

/**
 * Deletes an alias of an agent.
 */
public suspend inline fun BedrockAgentClient.deleteAgentAlias(crossinline block: DeleteAgentAliasRequest.Builder.() -> Unit): DeleteAgentAliasResponse = deleteAgentAlias(DeleteAgentAliasRequest.Builder().apply(block).build())

/**
 * Deletes a version of an agent.
 */
public suspend inline fun BedrockAgentClient.deleteAgentVersion(crossinline block: DeleteAgentVersionRequest.Builder.() -> Unit): DeleteAgentVersionResponse = deleteAgentVersion(DeleteAgentVersionRequest.Builder().apply(block).build())

/**
 * Deletes a data source from a knowledge base.
 */
public suspend inline fun BedrockAgentClient.deleteDataSource(crossinline block: DeleteDataSourceRequest.Builder.() -> Unit): DeleteDataSourceResponse = deleteDataSource(DeleteDataSourceRequest.Builder().apply(block).build())

/**
 * Deletes a knowledge base. Before deleting a knowledge base, you should disassociate the knowledge base from any agents that it is associated with by making a [DisassociateAgentKnowledgeBase](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_DisassociateAgentKnowledgeBase.html) request.
 */
public suspend inline fun BedrockAgentClient.deleteKnowledgeBase(crossinline block: DeleteKnowledgeBaseRequest.Builder.() -> Unit): DeleteKnowledgeBaseResponse = deleteKnowledgeBase(DeleteKnowledgeBaseRequest.Builder().apply(block).build())

/**
 * Disassociates a knowledge base from an agent.
 */
public suspend inline fun BedrockAgentClient.disassociateAgentKnowledgeBase(crossinline block: DisassociateAgentKnowledgeBaseRequest.Builder.() -> Unit): DisassociateAgentKnowledgeBaseResponse = disassociateAgentKnowledgeBase(DisassociateAgentKnowledgeBaseRequest.Builder().apply(block).build())

/**
 * Gets information about an agent.
 */
public suspend inline fun BedrockAgentClient.getAgent(crossinline block: GetAgentRequest.Builder.() -> Unit): GetAgentResponse = getAgent(GetAgentRequest.Builder().apply(block).build())

/**
 * Gets information about an action group for an agent.
 */
public suspend inline fun BedrockAgentClient.getAgentActionGroup(crossinline block: GetAgentActionGroupRequest.Builder.() -> Unit): GetAgentActionGroupResponse = getAgentActionGroup(GetAgentActionGroupRequest.Builder().apply(block).build())

/**
 * Gets information about an alias of an agent.
 */
public suspend inline fun BedrockAgentClient.getAgentAlias(crossinline block: GetAgentAliasRequest.Builder.() -> Unit): GetAgentAliasResponse = getAgentAlias(GetAgentAliasRequest.Builder().apply(block).build())

/**
 * Gets information about a knowledge base associated with an agent.
 */
public suspend inline fun BedrockAgentClient.getAgentKnowledgeBase(crossinline block: GetAgentKnowledgeBaseRequest.Builder.() -> Unit): GetAgentKnowledgeBaseResponse = getAgentKnowledgeBase(GetAgentKnowledgeBaseRequest.Builder().apply(block).build())

/**
 * Gets details about a version of an agent.
 */
public suspend inline fun BedrockAgentClient.getAgentVersion(crossinline block: GetAgentVersionRequest.Builder.() -> Unit): GetAgentVersionResponse = getAgentVersion(GetAgentVersionRequest.Builder().apply(block).build())

/**
 * Gets information about a data source.
 */
public suspend inline fun BedrockAgentClient.getDataSource(crossinline block: GetDataSourceRequest.Builder.() -> Unit): GetDataSourceResponse = getDataSource(GetDataSourceRequest.Builder().apply(block).build())

/**
 * Gets information about a ingestion job, in which a data source is added to a knowledge base.
 */
public suspend inline fun BedrockAgentClient.getIngestionJob(crossinline block: GetIngestionJobRequest.Builder.() -> Unit): GetIngestionJobResponse = getIngestionJob(GetIngestionJobRequest.Builder().apply(block).build())

/**
 * Gets information about a knoweldge base.
 */
public suspend inline fun BedrockAgentClient.getKnowledgeBase(crossinline block: GetKnowledgeBaseRequest.Builder.() -> Unit): GetKnowledgeBaseResponse = getKnowledgeBase(GetKnowledgeBaseRequest.Builder().apply(block).build())

/**
 * Lists the action groups for an agent and information about each one.
 */
public suspend inline fun BedrockAgentClient.listAgentActionGroups(crossinline block: ListAgentActionGroupsRequest.Builder.() -> Unit): ListAgentActionGroupsResponse = listAgentActionGroups(ListAgentActionGroupsRequest.Builder().apply(block).build())

/**
 * Lists the aliases of an agent and information about each one.
 */
public suspend inline fun BedrockAgentClient.listAgentAliases(crossinline block: ListAgentAliasesRequest.Builder.() -> Unit): ListAgentAliasesResponse = listAgentAliases(ListAgentAliasesRequest.Builder().apply(block).build())

/**
 * Lists knowledge bases associated with an agent and information about each one.
 */
public suspend inline fun BedrockAgentClient.listAgentKnowledgeBases(crossinline block: ListAgentKnowledgeBasesRequest.Builder.() -> Unit): ListAgentKnowledgeBasesResponse = listAgentKnowledgeBases(ListAgentKnowledgeBasesRequest.Builder().apply(block).build())

/**
 * Lists the versions of an agent and information about each version.
 */
public suspend inline fun BedrockAgentClient.listAgentVersions(crossinline block: ListAgentVersionsRequest.Builder.() -> Unit): ListAgentVersionsResponse = listAgentVersions(ListAgentVersionsRequest.Builder().apply(block).build())

/**
 * Lists the agents belonging to an account and information about each agent.
 */
public suspend inline fun BedrockAgentClient.listAgents(crossinline block: ListAgentsRequest.Builder.() -> Unit): ListAgentsResponse = listAgents(ListAgentsRequest.Builder().apply(block).build())

/**
 * Lists the data sources in a knowledge base and information about each one.
 */
public suspend inline fun BedrockAgentClient.listDataSources(crossinline block: ListDataSourcesRequest.Builder.() -> Unit): ListDataSourcesResponse = listDataSources(ListDataSourcesRequest.Builder().apply(block).build())

/**
 * Lists the ingestion jobs for a data source and information about each of them.
 */
public suspend inline fun BedrockAgentClient.listIngestionJobs(crossinline block: ListIngestionJobsRequest.Builder.() -> Unit): ListIngestionJobsResponse = listIngestionJobs(ListIngestionJobsRequest.Builder().apply(block).build())

/**
 * Lists the knowledge bases in an account and information about each of them.
 */
public suspend inline fun BedrockAgentClient.listKnowledgeBases(crossinline block: ListKnowledgeBasesRequest.Builder.() -> Unit): ListKnowledgeBasesResponse = listKnowledgeBases(ListKnowledgeBasesRequest.Builder().apply(block).build())

/**
 * List all the tags for the resource you specify.
 */
public suspend inline fun BedrockAgentClient.listTagsForResource(crossinline block: ListTagsForResourceRequest.Builder.() -> Unit): ListTagsForResourceResponse = listTagsForResource(ListTagsForResourceRequest.Builder().apply(block).build())

/**
 * Creates a `DRAFT` version of the agent that can be used for internal testing.
 */
public suspend inline fun BedrockAgentClient.prepareAgent(crossinline block: PrepareAgentRequest.Builder.() -> Unit): PrepareAgentResponse = prepareAgent(PrepareAgentRequest.Builder().apply(block).build())

/**
 * Begins an ingestion job, in which a data source is added to a knowledge base.
 */
public suspend inline fun BedrockAgentClient.startIngestionJob(crossinline block: StartIngestionJobRequest.Builder.() -> Unit): StartIngestionJobResponse = startIngestionJob(StartIngestionJobRequest.Builder().apply(block).build())

/**
 * Associate tags with a resource. For more information, see [Tagging resources](https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html) in the Amazon Bedrock User Guide.
 */
public suspend inline fun BedrockAgentClient.tagResource(crossinline block: TagResourceRequest.Builder.() -> Unit): TagResourceResponse = tagResource(TagResourceRequest.Builder().apply(block).build())

/**
 * Remove tags from a resource.
 */
public suspend inline fun BedrockAgentClient.untagResource(crossinline block: UntagResourceRequest.Builder.() -> Unit): UntagResourceResponse = untagResource(UntagResourceRequest.Builder().apply(block).build())

/**
 * Updates the configuration of an agent.
 */
public suspend inline fun BedrockAgentClient.updateAgent(crossinline block: UpdateAgentRequest.Builder.() -> Unit): UpdateAgentResponse = updateAgent(UpdateAgentRequest.Builder().apply(block).build())

/**
 * Updates the configuration for an action group for an agent.
 */
public suspend inline fun BedrockAgentClient.updateAgentActionGroup(crossinline block: UpdateAgentActionGroupRequest.Builder.() -> Unit): UpdateAgentActionGroupResponse = updateAgentActionGroup(UpdateAgentActionGroupRequest.Builder().apply(block).build())

/**
 * Updates configurations for an alias of an agent.
 */
public suspend inline fun BedrockAgentClient.updateAgentAlias(crossinline block: UpdateAgentAliasRequest.Builder.() -> Unit): UpdateAgentAliasResponse = updateAgentAlias(UpdateAgentAliasRequest.Builder().apply(block).build())

/**
 * Updates the configuration for a knowledge base that has been associated with an agent.
 */
public suspend inline fun BedrockAgentClient.updateAgentKnowledgeBase(crossinline block: UpdateAgentKnowledgeBaseRequest.Builder.() -> Unit): UpdateAgentKnowledgeBaseResponse = updateAgentKnowledgeBase(UpdateAgentKnowledgeBaseRequest.Builder().apply(block).build())

/**
 * Updates configurations for a data source.
 *
 * You can't change the `chunkingConfiguration` after you create the data source. Specify the existing `chunkingConfiguration`.
 */
public suspend inline fun BedrockAgentClient.updateDataSource(crossinline block: UpdateDataSourceRequest.Builder.() -> Unit): UpdateDataSourceResponse = updateDataSource(UpdateDataSourceRequest.Builder().apply(block).build())

/**
 * Updates the configuration of a knowledge base with the fields that you specify. Because all fields will be overwritten, you must include the same values for fields that you want to keep the same.
 *
 * You can change the following fields:
 * + `name`
 * + `description`
 * + `roleArn`
 *
 * You can't change the `knowledgeBaseConfiguration` or `storageConfiguration` fields, so you must specify the same configurations as when you created the knowledge base. You can send a [GetKnowledgeBase](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_GetKnowledgeBase.html) request and copy the same configurations.
 */
public suspend inline fun BedrockAgentClient.updateKnowledgeBase(crossinline block: UpdateKnowledgeBaseRequest.Builder.() -> Unit): UpdateKnowledgeBaseResponse = updateKnowledgeBase(UpdateKnowledgeBaseRequest.Builder().apply(block).build())




© 2015 - 2024 Weber Informatics LLC | Privacy Policy