apache_beam.ml.rag.embeddings.huggingface module

RAG-specific embedding implementations using HuggingFace models.

class apache_beam.ml.rag.embeddings.huggingface.HuggingfaceTextEmbeddings(model_name: str, *, max_seq_length: int | None = None, **kwargs)[source]

Bases: EmbeddingsManager

Utilizes huggingface SentenceTransformer embeddings for RAG pipeline.

Parameters:
  • model_name – Name of the sentence-transformers model to use

  • max_seq_length – Maximum sequence length for the model

  • **kwargs – Additional arguments passed to

:param EmbeddingsManager: :param constructor including ModelHandler arguments:

get_model_handler()[source]

Returns model handler configured with RAG adapter.

get_ptransform_for_processing(**kwargs) PTransform[PCollection[Chunk], PCollection[Chunk]][source]

Returns PTransform that uses the RAG adapter.