commonMain.aws.sdk.kotlin.services.bedrockruntime.model.DocumentBlock.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.bedrockruntime.model
import aws.smithy.kotlin.runtime.SdkDsl
/**
* A document to include in a message.
*/
public class DocumentBlock private constructor(builder: Builder) {
/**
* The format of a document, or its extension.
*/
public val format: aws.sdk.kotlin.services.bedrockruntime.model.DocumentFormat = requireNotNull(builder.format) { "A non-null value must be provided for format" }
/**
* A name for the document. The name can only contain the following characters:
* + Alphanumeric characters
* + Whitespace characters (no more than one in a row)
* + Hyphens
* + Parentheses
* + Square brackets
*
* This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name.
*/
public val name: kotlin.String = requireNotNull(builder.name) { "A non-null value must be provided for name" }
/**
* Contains the content of the document.
*/
public val source: aws.sdk.kotlin.services.bedrockruntime.model.DocumentSource? = builder.source
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.bedrockruntime.model.DocumentBlock = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("DocumentBlock(")
append("format=$format,")
append("name=$name,")
append("source=$source")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = format.hashCode()
result = 31 * result + (name.hashCode())
result = 31 * result + (source?.hashCode() ?: 0)
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 DocumentBlock
if (format != other.format) return false
if (name != other.name) return false
if (source != other.source) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.bedrockruntime.model.DocumentBlock = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* The format of a document, or its extension.
*/
public var format: aws.sdk.kotlin.services.bedrockruntime.model.DocumentFormat? = null
/**
* A name for the document. The name can only contain the following characters:
* + Alphanumeric characters
* + Whitespace characters (no more than one in a row)
* + Hyphens
* + Parentheses
* + Square brackets
*
* This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name.
*/
public var name: kotlin.String? = null
/**
* Contains the content of the document.
*/
public var source: aws.sdk.kotlin.services.bedrockruntime.model.DocumentSource? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.bedrockruntime.model.DocumentBlock) : this() {
this.format = x.format
this.name = x.name
this.source = x.source
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.bedrockruntime.model.DocumentBlock = DocumentBlock(this)
internal fun correctErrors(): Builder {
if (format == null) format = DocumentFormat.SdkUnknown("no value provided")
if (name == null) name = ""
return this
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy