跳转到内容

Qdrant FastEmbed 嵌入

LlamaIndex 支持 FastEmbed 用于嵌入生成。

如果您在 Colab 上打开这个笔记本,您可能需要安装 LlamaIndex 🦙。

%pip install llama-index-embeddings-fastembed
%pip install llama-index

要使用此提供程序,需要安装 fastembed 包。

%pip install fastembed

支持的模型列表可在此处查看

from llama_index.embeddings.fastembed import FastEmbedEmbedding
embed_model = FastEmbedEmbedding(model_name="BAAI/bge-small-en-v1.5")
100%|██████████| 76.7M/76.7M [00:18<00:00, 4.23MiB/s]
embeddings = embed_model.get_text_embedding("Some text to embed.")
print(len(embeddings))
print(embeddings[:5])
384
[-0.04166769981384277, 0.0018720313673838973, 0.02632238157093525, -0.036030545830726624, -0.014812108129262924]