Class BedrockTitanEmbeddingModel

java.lang.Object
org.springframework.ai.embedding.AbstractEmbeddingModel
org.springframework.ai.bedrock.titan.BedrockTitanEmbeddingModel
All Implemented Interfaces:
EmbeddingModel, Model<EmbeddingRequest,EmbeddingResponse>

public class BedrockTitanEmbeddingModel extends AbstractEmbeddingModel
EmbeddingModel implementation that uses the Bedrock Titan Embedding API. Titan Embedding supports text and image (encoded in base64) inputs. Note: Titan Embedding does not support batch embedding.
Since:
0.8.0
Author:
Christian Tzolov, Wei Jiang
  • Constructor Details

  • Method Details

    • withInputType

      Titan Embedding API input types. Could be either text or image (encoded in base64).
      Parameters:
      inputType - the input type to use.
    • embed

      public float[] embed(Document document)
      Description copied from interface: EmbeddingModel
      Embeds the given document's content into a vector.
      Parameters:
      document - the document to embed.
      Returns:
      the embedded vector.
    • call

      public EmbeddingResponse call(EmbeddingRequest request)
      Description copied from interface: Model
      Executes a method call to the AI model.
      Parameters:
      request - the request object to be sent to the AI model
      Returns:
      the response from the AI model
    • dimensions

      public int dimensions()
      Specified by:
      dimensions in interface EmbeddingModel
      Overrides:
      dimensions in class AbstractEmbeddingModel
      Returns:
      the number of dimensions of the embedded vectors. It is generative specific.