Class EmbeddingModelHandler

java.lang.Object
com.langchainbeam.EmbeddingModelHandler
All Implemented Interfaces:
Serializable

public class EmbeddingModelHandler extends Object implements Serializable
A handler for managing embedding model operations in an Apache Beam pipeline.

The EmbeddingModelHandler is responsible for configuring and utilizing an embedding model based on the provided EmbeddingModelOptions. It acts as a bridge between the embedding model and the Beam transforms, ensuring that embeddings are generated with the specified model settings.

Key Responsibilities:

  • Holds and manages EmbeddingModelOptions, which define the model name, dimensions, and other relevant settings.
  • Provides access to the model options via the getOptions() method.

Usage:


 EmbeddingModelOptions options = OpenAiEmbeddingModelOptions.builder()
         .apikey("your-api-key")
         .modelName("text-embedding-ada-002")
         .build();
 
 EmbeddingModelHandler handler = new EmbeddingModelHandler(options);
 
 EmbeddingModelOptions retrievedOptions = handler.getOptions();
 System.out.println("Using model: " + retrievedOptions.getModelName());
 
See Also:
  • Constructor Details

    • EmbeddingModelHandler

      public EmbeddingModelHandler(EmbeddingModelOptions modelOptions)
      Constructs an EmbeddingModelHandler with the specified options.
      Parameters:
      modelOptions - the options defining the embedding model configuration. Must not be null.
  • Method Details