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

software.amazon.awssdk.services.bedrockagent.model.OpenSearchServerlessFieldMapping Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Bedrock Agent module holds the client classes that are used for communicating with Bedrock Agent.

There is a newer version: 2.28.4
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.bedrockagent.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Contains the names of the fields to which to map information about the vector store. *

*/ @Generated("software.amazon.awssdk:codegen") public final class OpenSearchServerlessFieldMapping implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField METADATA_FIELD_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("metadataField").getter(getter(OpenSearchServerlessFieldMapping::metadataField)) .setter(setter(Builder::metadataField)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("metadataField").build()).build(); private static final SdkField TEXT_FIELD_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("textField").getter(getter(OpenSearchServerlessFieldMapping::textField)) .setter(setter(Builder::textField)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("textField").build()).build(); private static final SdkField VECTOR_FIELD_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("vectorField").getter(getter(OpenSearchServerlessFieldMapping::vectorField)) .setter(setter(Builder::vectorField)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("vectorField").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(METADATA_FIELD_FIELD, TEXT_FIELD_FIELD, VECTOR_FIELD_FIELD)); private static final long serialVersionUID = 1L; private final String metadataField; private final String textField; private final String vectorField; private OpenSearchServerlessFieldMapping(BuilderImpl builder) { this.metadataField = builder.metadataField; this.textField = builder.textField; this.vectorField = builder.vectorField; } /** *

* The name of the field in which Amazon Bedrock stores metadata about the vector store. *

* * @return The name of the field in which Amazon Bedrock stores metadata about the vector store. */ public final String metadataField() { return metadataField; } /** *

* The name of the field in which Amazon Bedrock stores the raw text from your data. The text is split according to * the chunking strategy you choose. *

* * @return The name of the field in which Amazon Bedrock stores the raw text from your data. The text is split * according to the chunking strategy you choose. */ public final String textField() { return textField; } /** *

* The name of the field in which Amazon Bedrock stores the vector embeddings for your data sources. *

* * @return The name of the field in which Amazon Bedrock stores the vector embeddings for your data sources. */ public final String vectorField() { return vectorField; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(metadataField()); hashCode = 31 * hashCode + Objects.hashCode(textField()); hashCode = 31 * hashCode + Objects.hashCode(vectorField()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof OpenSearchServerlessFieldMapping)) { return false; } OpenSearchServerlessFieldMapping other = (OpenSearchServerlessFieldMapping) obj; return Objects.equals(metadataField(), other.metadataField()) && Objects.equals(textField(), other.textField()) && Objects.equals(vectorField(), other.vectorField()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("OpenSearchServerlessFieldMapping").add("MetadataField", metadataField()) .add("TextField", textField()).add("VectorField", vectorField()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "metadataField": return Optional.ofNullable(clazz.cast(metadataField())); case "textField": return Optional.ofNullable(clazz.cast(textField())); case "vectorField": return Optional.ofNullable(clazz.cast(vectorField())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((OpenSearchServerlessFieldMapping) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the field in which Amazon Bedrock stores metadata about the vector store. *

* * @param metadataField * The name of the field in which Amazon Bedrock stores metadata about the vector store. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metadataField(String metadataField); /** *

* The name of the field in which Amazon Bedrock stores the raw text from your data. The text is split according * to the chunking strategy you choose. *

* * @param textField * The name of the field in which Amazon Bedrock stores the raw text from your data. The text is split * according to the chunking strategy you choose. * @return Returns a reference to this object so that method calls can be chained together. */ Builder textField(String textField); /** *

* The name of the field in which Amazon Bedrock stores the vector embeddings for your data sources. *

* * @param vectorField * The name of the field in which Amazon Bedrock stores the vector embeddings for your data sources. * @return Returns a reference to this object so that method calls can be chained together. */ Builder vectorField(String vectorField); } static final class BuilderImpl implements Builder { private String metadataField; private String textField; private String vectorField; private BuilderImpl() { } private BuilderImpl(OpenSearchServerlessFieldMapping model) { metadataField(model.metadataField); textField(model.textField); vectorField(model.vectorField); } public final String getMetadataField() { return metadataField; } public final void setMetadataField(String metadataField) { this.metadataField = metadataField; } @Override public final Builder metadataField(String metadataField) { this.metadataField = metadataField; return this; } public final String getTextField() { return textField; } public final void setTextField(String textField) { this.textField = textField; } @Override public final Builder textField(String textField) { this.textField = textField; return this; } public final String getVectorField() { return vectorField; } public final void setVectorField(String vectorField) { this.vectorField = vectorField; } @Override public final Builder vectorField(String vectorField) { this.vectorField = vectorField; return this; } @Override public OpenSearchServerlessFieldMapping build() { return new OpenSearchServerlessFieldMapping(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy