返回顶部
热门问答 更多热门问答
技术文章 更多技术文章

DB-GPT V0.6.1 版本更新:RAG 能力更强,新增 RAG 召回和 Agent 答案评测功能

[复制链接]
链载Ai 显示全部楼层 发表于 4 小时前 |阅读模式 打印 上一主题 下一主题

DB-GPT 全新升级 V0.6.1版本了


在这个版本中,我们引入了一系列创新特性,包括GraphRAG三元组检索、新增RAG召回和Agent答案评测功能,以及对OceanBase向量数据库的新版本的兼容性支持。


让我们一起来看看这些新特性吧~


新特性

1、GraphRAG 三元组检索 + 文档结构检索

新版本在原社区摘要增强的GraphRAG基础上,引入了文档结构(Document Structure)索引,提升了知识图谱的丰富度和知识召回的完备性,并继续兼容基于AntV G6引擎的知识图谱渲染逻辑,让复杂数据关系一目了然。


回顾上个版本(DB-GPT 0.6.0),GraphRAG实现图社区摘要和混合检索的功能,解决了面向总结性查询(QFS)的问题。这次我们依据标准格式文件(目前对 Markdown 文件支持最好)中章节段落的层级信息,将文件结构组织为有向图,并写入到知识图谱(基于TuGraph底座)。图中的节点可以是文件的一个分片(chunk),边则代表了不同切分(chunk)之间在原文档中的结构关系。

ingFang SC", miui, "Hiragino Sans GB", "Microsoft Yahei", sans-serif;text-align: justify;background-color: rgb(255, 255, 255);text-indent: 0em;margin-top: 0px;margin-bottom: 0px;line-height: 1.6em;white-space-collapse: preserve !important;word-break: break-word !important;">

ingFang SC", miui, "Hiragino Sans GB", "Microsoft Yahei", sans-serif;text-align: justify;background-color: rgb(255, 255, 255);text-indent: 0em;margin-top: 0px;margin-bottom: 0px;line-height: 1.6em;white-space-collapse: preserve !important;word-break: break-word !important;">ingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, "Segoe UI";font-size: 0px;letter-spacing: normal;text-align: center;text-wrap: wrap;" width="541"/>

(三元组结构:entity -[relation]-> entity;文档结构:document -> chunk -> chunk)

如图所示,我们拓展了 GraphRAG 中对于 Graph 的定义范畴:知识图谱(Knowledge Graph) = 三元组有向图 (Triplets Graph)+ 文档结构图(Document Structure Graph)。未来,我们希望构建一个更加复杂、覆盖更加全面的信息的 Graph,以便支持更加复杂的检索算法。


用户可以快速地在 DB-GPT 多前端应用中体验到该功能。生成的知识图谱将由 AntV G6 引擎驱动前端中渲染出来,以方便用户清晰直观地观察到图的可视化。


知识图谱构建与可视化(基于 qwen-max 模型):


ingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, "Segoe UI";font-size: 0px;letter-spacing: normal;text-align: start;text-wrap: wrap;" width="1451"/>


知识图谱对话(基于 qwen-max 模型):


ingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: var(--articleFontsize);letter-spacing: 0.034em;" width="1207"/>


针对我们的更新的内容和功能,我们对于以下.env环境变量做一个说明:


  • GRAPH_COMMUNITY_SUMMARY_ENABLED=True

    • 开启社区总结功能。基于指定的算法(默认 Leiden 算法),这个功能将会从知识图谱中找出社区,并通过 LLM 总结社区内容。

  • TRIPLET_GRAPH_ENABLED=True

    • 开启三元组图的构建和检索功能。

  • DOCUMENT_GRAPH_ENABLED=True

    • 开启文档结构图的构建和检索功能。

  • KNOWLEDGE_GRAPH_CHUNK_SEARCH_TOP_SIZE=5

    • 文档检索返回的 topk值。


快速使用:

ingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, "Segoe UI";font-size: 0px;letter-spacing: normal;text-align: start;text-wrap: wrap;" width="1825.5556039162636"/>


选择“知识图谱”,名称不能只有数字(TuGraph 不接受不合规的名字)。


ingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, "Segoe UI";font-size: 0px;letter-spacing: normal;text-align: start;text-wrap: wrap;" width="1826.6667150568092"/>


推荐上传 markdown 文档,我们对 markdown 做了优化,效果更好。


ingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, "Segoe UI";font-size: 0px;letter-spacing: normal;text-align: start;text-wrap: wrap;" width="1821.1111593540816"/>


需要等待好一段时间,请不要取消。


ingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, "Segoe UI";font-size: 0px;letter-spacing: normal;text-align: center;width: 100%;height: auto;" width="375.77783203125"/>


开始聊天。提示,最好问和知识图谱相关的问题。


2、新增RAG召回和Agent答案评测功能

DB-GPT V0.6.1版本中,新增RAG召回和Agent答案评测功能,确保你的应用能够提供最相关的答案ingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 0.034em;">。


召回的文本中是否包含用户问题对应的答案严重影响着最终LLM回答效果;文本切块策略、向量化模型、混合召回策略等因素都会影响最终的召回效果;因此,召回环节的评估流程可以不断优化召回的各个环节,是构建RAG系统的必要步骤。


目前DB-GPT指标模块支持RAG召回指标以及Agent答案指标:

1.RAG召回指标(RetrieverEvaluationMetric):

  • RetrieverHitRateMetric:命中率衡量的是RAG retriever召回出现在检索结果前top-k个文档中的比例。

  • RetrieverMRRMetric: Mean Reciprocal Rank通过分析最相关文档在检索结果里的排名来计算每个查询的准确性。更具体地说,它是所有查询的相关文档排名倒数的平均值。例如,若最相关的文档排在第一位,其倒数排名为 1;排在第二位时,为 1/2;以此类推。

  • RetrieverSimilarityMetric: 相似度指标计算,计算召回内容与预测内容的相似度。

2.Agent答案指标:
  • AnswerRelevancyMetric:智能体答案相关性指标,通过智能体答案与用户提问的匹配程度。高相关性的答案不仅要求模型能够理解用户的问题,还要求其能够生成与问题密切相关的答案。这直接影响到用户的满意度和模型的实用性


使用教程:

1.RAG召回评测

  • http方式

POST/api/v2/serve/evaluate/evaluatio

SPACE_ID={YOUR_SPACE_ID}
curl --location --request POST 'http://localhost:5670/api/v2/serve/evaluate/evaluation' \--header 'Content-Type: application/json' \-d'{"scene_key": "recall","scene_value": "'$SPACE_ID'","context":{"top_k":5},"evaluate_metrics":["RetrieverHitRateMetric","RetrieverMRRMetric","RetrieverSimilarityMetric"],"datasets": [{"query": "what awel talked about","doc_name":"awel.md"}]}'

  • python方式

from dbgpt.client import Clientfrom dbgpt.client.evaluation import run_evaluationfrom dbgpt.serve.evaluate.api.schemas import EvaluateServeRequest
DBGPT_API_KEY = "dbgpt"client = Client(api_key=DBGPT_API_KEY)SPACE_ID={YOUR_SPACE_ID}request = EvaluateServeRequest(# The scene type of the evaluation, e.g. support app, recallscene_key="recall",# e.g. app id(when scene_key is app), space id(when scene_key is recall)scene_value=SPACE_ID,context={"top_k": 5},evaluate_metrics=["RetrieverHitRateMetric","RetrieverMRRMetric","RetrieverSimilarityMetric",],datasets=[{"query": "what awel talked about","doc_name": "awel.md",}],)data = await run_evaluation(client, request=request)

2.Agent答案相关性评测

  • http方式

APP_ID={YOUR_APP_ID}PROMPT_ID = {YOUR_PROMPT_ID}
curl --location --request POST 'http://localhost:5670/api/v2/serve/evaluate/evaluation' \--header 'Authorization: Bearer dbgpt' \--header 'Content-Type: application/json' \-d '{"scene_key": "app","scene_value": "'$APP_ID'","context":{"top_k":5, "prompt":"'$PROMPT_ID'","model":"zhipu_proxyllm"},"evaluate_metrics":["AnswerRelevancyMetric"],"datasets": [{"query": "what awel talked about","doc_name":"awel.md"}]}'
  • python方式

APP_ID={YOUR_APP_ID}PROMPT_ID = {YOUR_PROMPT_ID}
curl --location --request POST 'http://localhost:5670/api/v2/serve/evaluate/evaluation' \--header 'Authorization: Bearer dbgpt' \--header 'Content-Type: application/json' \-d '{"scene_key": "app","scene_value": "'$APP_ID'","context":{"top_k":5, "prompt":"'$PROMPT_ID'","model":"zhipu_proxyllm"},"evaluate_metrics":["AnswerRelevancyMetric"],"datasets": [{"query": "what awel talked about","doc_name":"awel.md"}]}'

评测更多说明参考:

https://www.yuque.com/eosphoros/dbgpt-docs/czgl7bsfclc1xsmh


3、支持OceanBase向量数据库兼容4.3.3.0版本

DB-GPT V0.6.1支持兼容OceanBase向量数据库新发布的4.3.3版本,包括filters查询和pyobvector客户端,数据库交互更灵活。


  • 支持了filters查询

  • 支持pyobvector客户端,兼容MilvusSQLAlchemy使用教程参考:https://github.com/oceanbase/pyobvector


4、支持Qwen2.5b

DB-GPT V0.6.1利用最新的Qwen2.5b模型,享受更强大的语言处理能力。

LLM_MODEL=qwen2.5-7b-instruct

5、支持将stop参数传递给 proxyllm


Bug 修复

1、修复了页面多文档上传分片前端问题

2、修复了Tongyi embedding模型bug

3、修复了docx文档特殊格式解析问题

4、修复解决了vllm推理问题

5、解决了doc_token字段不为空的问题



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

链载AI是专业的生成式人工智能教程平台。提供Stable Diffusion、Midjourney AI绘画教程,Suno AI音乐生成指南,以及Runway、Pika等AI视频制作与动画生成实战案例。从提示词编写到参数调整,手把手助您从入门到精通。
  • 官方手机版

  • 微信公众号

  • 商务合作

  • Powered by Discuz! X3.5 | Copyright © 2025-2025. | 链载Ai
  • 桂ICP备2024021734号 | 营业执照 | |广西笔趣文化传媒有限公司|| QQ