Feast
Feast (Feature Store) 是一个开源的特征库,通过允许团队定义、管理、验证和为生产 AI/ML 提供特征,帮助他们大规模地运营生产 ML 系统。
Qdrant 在 Feast 中作为受支持的向量存储可用,以便集成到您的工作流中。
安装
要使用 Qdrant 在线存储,您需要安装带有 qdrant
额外组件的 Feast。
pip install 'feast[qdrant]'
用法
使用 Qdrant 的配置示例可能如下所示
project: my_feature_repo
registry: data/registry.db
provider: local
online_store:
type: qdrant
host: xyz-example.eu-central.aws.cloud.qdrant.io
port: 6333
api_key: <your-own-key>
vector_len: 384
# Reference: https://qdrant.org.cn/documentation/concepts/vectors/#named-vectors
# vector_name: text-vec
write_batch_size: 100
您可以参考 Feast 文档以获取完整的配置选项列表。
检索文档
Qdrant 在线存储支持为给定的实体键列表检索文档向量。文档向量以字典形式返回,其中键是实体键,值是向量。
from feast import FeatureStore
feature_store = FeatureStore(repo_path="feature_store.yaml")
query_vector = [1.0, 2.0, 3.0, 4.0, 5.0]
top_k = 5
feature_values = feature_store.retrieve_online_documents(
feature="my_feature",
query=query_vector,
top_k=top_k
)