LASER Meta AI 的激光语言无关句子表示嵌入集
LASER 是由 Meta AI 研究团队开发的 Python 库,截至 2024 年 2 月 25 日,该库支持超过 147 种语言的多语言句子嵌入。
依赖
要将 LaserEmbed 与 LangChain 一起使用,请安装 laser_encoders Python 包。
%pip install laser_encoders
导入
from langchain_community.embeddings.laser import LaserEmbeddings
API Reference:LaserEmbeddings
实例化 Laser
参数
# Ex Instantiationz
embeddings = LaserEmbeddings(lang="eng_Latn")
用法
生成文档嵌入
document_embeddings = embeddings.embed_documents(
["This is a sentence", "This is some other sentence"]
)
生成查询嵌入
query_embeddings = embeddings.embed_query("This is a query")
Related
- Embedding model conceptual guide
- Embedding model how-to guides