open-webui-rag-system / e5_embeddings.py
hugging2021's picture
Upload folder using huggingface_hub
5f3b20a verified
raw
history blame contribute delete
326 Bytes
from langchain_huggingface import HuggingFaceEmbeddings
class E5Embeddings(HuggingFaceEmbeddings):
def embed_documents(self, texts):
texts = [f"passage: {text}" for text in texts]
return super().embed_documents(texts)
def embed_query(self, text):
return super().embed_query(f"query: {text}")