本文检查了 txtai 嵌入索引的文件系统并给出了结构的概述。
安装依赖
安装txtai和所有依赖项。
pip install txtai
创建索引
让我们首先创建一个索引来检查。我们将使用经典的 txtai 示例。
from txtai.embeddings import Embeddings
data = [“US tops 5 million confirmed virus cases”,
“Canada’s last fully intact ice shelf has suddenly collapsed, forming a Manhattan-sized iceberg”,
“Beijing mobilises invasion craft along coast as Taiwan tensions escalate”,
“The National Park Service warns against sacrificing slower friends in a bear attack”,
“Maine man wins $1M from $25 lottery ticket”,
“Make huge profits without work, earn up to $100,000 a day”]
embeddings = Embeddings({“path”: “sentence-transformers/nli-mpnet-base-v2”, “content”: True, “objects”: True})</