Class AllMiniLmL6V2QuantizedEmbeddingModel

java.lang.Object
dev.langchain4j.model.embedding.DimensionAwareEmbeddingModel
dev.langchain4j.model.embedding.onnx.AbstractInProcessEmbeddingModel
dev.langchain4j.model.embedding.onnx.allminilml6v2q.AllMiniLmL6V2QuantizedEmbeddingModel
All Implemented Interfaces:
dev.langchain4j.model.embedding.EmbeddingModel

public class AllMiniLmL6V2QuantizedEmbeddingModel extends dev.langchain4j.model.embedding.onnx.AbstractInProcessEmbeddingModel
Quantized SentenceTransformers all-MiniLM-L6-v2 embedding model that runs within your Java application's process.

Maximum length of text (in tokens) that can be embedded at once: unlimited. However, while you can embed very long texts, the quality of the embedding degrades as the text lengthens. It is recommended to embed segments of no more than 256 tokens.

Embedding dimensions: 384

Uses an Executor to parallelize the embedding process. By default, uses a cached thread pool with the number of threads equal to the number of available processors. Threads are cached for 1 second.

More details here and here

  • Field Summary

    Fields inherited from class dev.langchain4j.model.embedding.DimensionAwareEmbeddingModel

    dimension
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of an AllMiniLmL6V2QuantizedEmbeddingModel.
    Creates an instance of an AllMiniLmL6V2QuantizedEmbeddingModel.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Integer
     
    protected dev.langchain4j.model.embedding.onnx.OnnxBertBiEncoder
     

    Methods inherited from class dev.langchain4j.model.embedding.onnx.AbstractInProcessEmbeddingModel

    embedAll, loadFromJar

    Methods inherited from class dev.langchain4j.model.embedding.DimensionAwareEmbeddingModel

    dimension

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface dev.langchain4j.model.embedding.EmbeddingModel

    addListener, addListeners, embed, embed, modelName
  • Constructor Details

    • AllMiniLmL6V2QuantizedEmbeddingModel

      public AllMiniLmL6V2QuantizedEmbeddingModel()
      Creates an instance of an AllMiniLmL6V2QuantizedEmbeddingModel. Uses a cached thread pool with the number of threads equal to the number of available processors. Threads are cached for 1 second.
    • AllMiniLmL6V2QuantizedEmbeddingModel

      public AllMiniLmL6V2QuantizedEmbeddingModel(Executor executor)
      Creates an instance of an AllMiniLmL6V2QuantizedEmbeddingModel.
      Parameters:
      executor - The executor to use to parallelize the embedding process.
  • Method Details

    • model

      protected dev.langchain4j.model.embedding.onnx.OnnxBertBiEncoder model()
      Specified by:
      model in class dev.langchain4j.model.embedding.onnx.AbstractInProcessEmbeddingModel
    • knownDimension

      protected Integer knownDimension()
      Overrides:
      knownDimension in class dev.langchain4j.model.embedding.DimensionAwareEmbeddingModel