课程连接:https://learn.deeplearning.ai/courses/knowledge-graphs-rag

github连接:https://github.com/MSzgy/Knowledge-Graphs-for-RAG

Introduction

在本章课程中,以SEC(美国证券交易委员会)官网的数据通过Neo4J数据库构建了Knowledge Graph,并且结合LLM对knowledge Graph做RAG(检索增强)。

Knowledge Graph Fundamentals

这里先介绍了node的概念,每个node代表一个Entity,node之间的edge代表节点之间的某种关系。

每个节点都有一些key/value的属性

Querying Knowledge Graphs

在本节代码中,展示了对节点的CRUD操作,对于相关数据结构有了基本认识。

Preparing Text for RAG

在本节,介绍了neo4j 中knowledge graph如何运用openai的embedding model 进行相似度查询。

Consturcting a Knowledge Graph from Text Documents

在本节,使用财经数据举了个例子,演示了如何将源数据存到数据库,构建知识图谱。

具体处理步骤

首先需要进行数据清理

Adding Relationships to the SEC Knowledge Graph

Just see code, talk is nothing !

Expanding the SEC Knowledge Graph

在做vector similarity search中,通过引入knowledge graph的context可以提高搜索的准确度以及匹配度。

Chatting with the SEC Knowledge Graph

https://x.com/graceides/status/1887113374737305843