Class Introduction
Function
Embedding factory class, which is used to produce RAG SDK embeddings.
Prototype
from mx_rag.embedding import EmbeddingFactory class EmbeddingFactory(ABC)
Example
from paddle.base import libpaddle
from mx_rag.embedding import EmbeddingFactory
from mx_rag.utils import ClientParam
txt_embed = EmbeddingFactory.create_embedding(embedding_type="local_text_embedding",
model_path="path to model", dev_id=0)
print(txt_embed.embed_query("abc"))
# Reconfigure the parameters properly.
tei_embed = EmbeddingFactory.create_embedding(embedding_type="tei_embedding",
url="https://ip:port/embed",
client_param=ClientParam(ca_file="/path/to/ca.crt"))
print(tei_embed.embed_query("abc"))
img_embed = EmbeddingFactory.create_embedding(embedding_type="local_images_embedding", model_name="model_name",
model_path="path to model", dev_id=0)
print(img_embed.embed_query("abc"))
Parent topic: EmbeddingFactory