FastEmbedEmbedder 类用于通过 FastEmbed 将文本数据嵌入为向量。
用法
cookbook/embedders/qdrant_fastembed.py
参数
开发者资源
- 查看 Cookbook
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
FastEmbedEmbedder 类用于通过 FastEmbed 将文本数据嵌入为向量。
from agno.agent import AgentKnowledge
from agno.vectordb.pgvector import PgVector
from agno.embedder.fastembed import FastEmbedEmbedder
# 将句子嵌入数据库
embeddings = FastEmbedEmbedder().get_embedding("The quick brown fox jumps over the lazy dog.")
# 打印嵌入和它们的维度
print(f"Embeddings: {embeddings[:5]}")
print(f"Dimensions: {len(embeddings)}")
# 在知识库中使用嵌入器
knowledge_base = AgentKnowledge(
vector_db=PgVector(
db_url="postgresql+psycopg://ai:ai@localhost:5532/ai",
table_name="qdrant_embeddings",
embedder=FastEmbedEmbedder(),
),
num_documents=2,
)
| 参数 | 类型 | 默认 | 描述 |
|---|---|---|---|
dimensions | int | - | 生成的嵌入的维度 |
model | str | BAAI/bge-small-en-v1.5 | 要使用的 qdrant_fastembed 模型名称 |