已开启
为DocsGPT 新增openGauss DataVec作为向量数据库选项 #101
HLY-cloud创建于 5月31日
为DocsGPT 新增openGauss DataVec作为向量数据库选项 #101
已开启
合并受阻
5月31日 添加了label:sig/Infra
opengauss_bot
5月31日 评论:
5月31日 评论:
Welcome To openGauss Community
Hey @huliyan , thanks for your contribution to the community.
Bot Usage Manual
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.
Contact Guide
If you have any questions, please contact the SIG: Infra ,
and any of the maintainers: @CarrotGo, @chendong76, @chenxiaobin19, @congzhou2603, @dodders, @hwworkholic, @jemappellehc, @muyulinzhong, @quemingjian, @shenzheng4, @shirley_zhengx, @superlchf, @totaj, @wlff234, @ywzq1161327784 ,
and any of the committers: @ailoooong, @gzbang, @libiao2024, @zhangxubo .


5月31日 添加了label:opengauss-cla/yes
opengauss_bot
5月31日 评论:
5月31日 评论:
【实现内容】:
为 DocsGPT 新增openGauss DataVec作为向量数据库选项
DocsGPT 是一个开源的本地私有知识库问答(Q&A)系统,在 GitHub 上已获得超过 17k Star。其支持milvus,pgvector等向量数据库,但还不支持opengauss datavec
【实现方案】:
所有文档共用一张表
documents。由于不同文档的元数据字段各异,采用 JSONB 类型统一存储:CREATE TABLE IF NOT EXISTS documents ( id BIGSERIAL PRIMARY KEY, text TEXT NOT NULL, embedding vector(xxx), -- 维度由 embedding 模型动态决定 metadata JSONB, source_id TEXT NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );索引策略
建立 3 个索引,分别服务于向量检索和等值过滤:
-- 向量近邻检索(IVFFlat,lists=100) CREATE INDEX documents_embedding_ivfflat_idx ON documents USING ivfflat (embedding vector_l2_ops) WITH (lists = 100); -- 按文档源过滤(删除、查询时按 source_id 定位) CREATE INDEX documents_source_id_idx ON documents (source_id); -- 主键 id 自带 B-tree 索引,用于单条 chunk 删除【开发自验报告】:
以及本地部署DocsGPT测试可行,不过需要openGauss的资源分配较多,默认16MB的配置建立向量索引就会崩溃。
其他说明:
DocsGPT PR 链接