跳到主要内容
Gel 是一个基于 PostgreSQL 构建的强大数据平台。
  • 以对象和图的形式思考,而不是表和 JOIN。
  • 使用先进的 Python SDK、集成 GUI、迁移引擎、Auth 和 AI 层等等。
  • 可在本地、远程运行,或在完全托管的云环境中运行。

安装

pip install langchain-gel

设置

  1. 运行 gel project init
  2. 编辑 schema。您需要以下类型才能使用 LangChain 向量存储。
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 的信息。
  1. 运行迁移:gel migration create && gel migrate

用法

from langchain_gel import GelVectorStore

vector_store = GelVectorStore(
    embeddings=embeddings,
)
此处查看完整的使用示例。
以编程方式连接这些文档到 Claude、VSCode 等,通过 MCP 获取实时答案。
© . This site is unofficial and not affiliated with LangChain, Inc.