Class AbstractBedrockEmbeddingModel<T extends BedrockEmbeddingResponse>

java.lang.Object
dev.langchain4j.model.bedrock.internal.AbstractBedrockEmbeddingModel<T>
All Implemented Interfaces:
EmbeddingModel
Direct Known Subclasses:
BedrockTitanEmbeddingModel

public abstract class AbstractBedrockEmbeddingModel<T extends BedrockEmbeddingResponse> extends Object implements EmbeddingModel
Abstract bedrock embedding model
  • Constructor Details

    • AbstractBedrockEmbeddingModel

      public AbstractBedrockEmbeddingModel()
  • Method Details

    • embedAll

      public Response<List<Embedding>> embedAll(List<TextSegment> textSegments)
      Description copied from interface: EmbeddingModel
      Embeds the text content of a list of TextSegments.
      Specified by:
      embedAll in interface EmbeddingModel
      Parameters:
      textSegments - the text segments to embed.
      Returns:
      the embeddings.
    • getRequestParameters

      protected abstract List<Map<String,Object>> getRequestParameters(List<TextSegment> textSegments)
      Get request body
      Parameters:
      textSegments - Input texts to convert to embedding
      Returns:
      request body
    • getModelId

      protected abstract String getModelId()
      Get model id
      Returns:
      model id
    • getResponseClassType

      protected abstract Class<T> getResponseClassType()
      Get response class type
      Returns:
      response class type
    • invoke

      protected software.amazon.awssdk.services.bedrockruntime.model.InvokeModelResponse invoke(String body)
      Invoke model
      Parameters:
      body - body
      Returns:
      invoke model response
    • of

      protected static Map<String,Object> of(String key, Object value)
      Create map with single entry
      Parameters:
      key - key
      value - value
      Returns:
      map