commonMain.aws.sdk.kotlin.services.bedrockagent.model.ParsingConfiguration.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bedrockagent-jvm Show documentation
Show all versions of bedrockagent-jvm Show documentation
The AWS SDK for Kotlin client for Bedrock Agent
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.bedrockagent.model
import aws.smithy.kotlin.runtime.SdkDsl
/**
* Settings for parsing document contents. By default, the service converts the contents of each document into text before splitting it into chunks. To improve processing of PDF files with tables and images, you can configure the data source to convert the pages of text into images and use a model to describe the contents of each page.
*
* To use a model to parse PDF documents, set the parsing strategy to `BEDROCK_FOUNDATION_MODEL` and specify the model or [inference profile](https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html) to use by ARN. You can also override the default parsing prompt with instructions for how to interpret images and tables in your documents. The following models are supported.
* + Anthropic Claude 3 Sonnet - `anthropic.claude-3-sonnet-20240229-v1:0`
* + Anthropic Claude 3 Haiku - `anthropic.claude-3-haiku-20240307-v1:0`
*
* You can get the ARN of a model with the [ListFoundationModels](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_ListFoundationModels.html) action. Standard model usage charges apply for the foundation model parsing strategy.
*/
public class ParsingConfiguration private constructor(builder: Builder) {
/**
* Settings for a foundation model used to parse documents for a data source.
*/
public val bedrockFoundationModelConfiguration: aws.sdk.kotlin.services.bedrockagent.model.BedrockFoundationModelConfiguration? = builder.bedrockFoundationModelConfiguration
/**
* The parsing strategy for the data source.
*/
public val parsingStrategy: aws.sdk.kotlin.services.bedrockagent.model.ParsingStrategy = requireNotNull(builder.parsingStrategy) { "A non-null value must be provided for parsingStrategy" }
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.bedrockagent.model.ParsingConfiguration = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("ParsingConfiguration(")
append("bedrockFoundationModelConfiguration=$bedrockFoundationModelConfiguration,")
append("parsingStrategy=$parsingStrategy")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = bedrockFoundationModelConfiguration?.hashCode() ?: 0
result = 31 * result + (parsingStrategy.hashCode())
return result
}
override fun equals(other: kotlin.Any?): kotlin.Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false
other as ParsingConfiguration
if (bedrockFoundationModelConfiguration != other.bedrockFoundationModelConfiguration) return false
if (parsingStrategy != other.parsingStrategy) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.bedrockagent.model.ParsingConfiguration = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* Settings for a foundation model used to parse documents for a data source.
*/
public var bedrockFoundationModelConfiguration: aws.sdk.kotlin.services.bedrockagent.model.BedrockFoundationModelConfiguration? = null
/**
* The parsing strategy for the data source.
*/
public var parsingStrategy: aws.sdk.kotlin.services.bedrockagent.model.ParsingStrategy? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.bedrockagent.model.ParsingConfiguration) : this() {
this.bedrockFoundationModelConfiguration = x.bedrockFoundationModelConfiguration
this.parsingStrategy = x.parsingStrategy
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.bedrockagent.model.ParsingConfiguration = ParsingConfiguration(this)
/**
* construct an [aws.sdk.kotlin.services.bedrockagent.model.BedrockFoundationModelConfiguration] inside the given [block]
*/
public fun bedrockFoundationModelConfiguration(block: aws.sdk.kotlin.services.bedrockagent.model.BedrockFoundationModelConfiguration.Builder.() -> kotlin.Unit) {
this.bedrockFoundationModelConfiguration = aws.sdk.kotlin.services.bedrockagent.model.BedrockFoundationModelConfiguration.invoke(block)
}
internal fun correctErrors(): Builder {
if (parsingStrategy == null) parsingStrategy = ParsingStrategy.SdkUnknown("no value provided")
return this
}
}
}