Gel
Gel 是一个基于 PostgreSQL 构建的强大数据平台。
- 以对象和图而非表和 JOIN 进行思考。
- 使用高级 Python SDK、集成 GUI、迁移引擎、身份验证和 AI 层,以及更多功能。
- 可在本地、远程或 完全托管的云 中运行。
安装
pip install langchain-gel
设置
- 运行
gel project init - 编辑 schema。您需要以下类型才能使用 LangChain vectorstore:
using extension pgvector;
module default {
scalar type EmbeddingVector extending ext::pgvector::vector<1536>;
type Record {
required collection: str;
text: str;
embedding: EmbeddingVector;
external_id: str {
constraint exclusive;
};
metadata: json;
index ext::pgvector::hnsw_cosine(m := 16, ef_construction := 128)
on (.embedding)
}
}
注意:这是最基础的设置。您可以随意添加任意数量的类型、属性和链接! 阅读 文档 了解如何充分利用 Gel 的 schema。
- 运行迁移:
gel migration create && gel migrate。
用法
from langchain_gel import GelVectorStore
vector_store = GelVectorStore(
embeddings=embeddings,
)
在此处查看完整的用法示例:/docs/integrations/vectorstores/gel。