langchain+GPT+neo4j 图数据库

bash 复制代码
neo4j版本是5.11.0,langchain的版本 0.0.288

下载apoc插件

https://neo4j.com/docs/apoc/current/installation/


neo4j.conf文件把apoc.*添加到dbms.security.procedures.unrestricted配置项

使用return apoc.version()来查看是否安装成功

bash 复制代码
pip install neo4j


参考官网:https://python.langchain.com/docs/use_cases/more/graph/graph_cypher_qa

python 复制代码
from langchain.chat_models import ChatOpenAI
from langchain.chains import GraphCypherQAChain
from langchain.graphs import Neo4jGraph
import os
os.environ["OPENAI_API_KEY"] = 'xxx'
graph = Neo4jGraph(
    url="bolt://localhost:7687", username="neo4j", password="xxx"
)

chain = GraphCypherQAChain.from_llm(
    ChatOpenAI(temperature=0), graph=graph, verbose=True, return_intermediate_steps=True
)

result = chain("Who played in Top Gun?")
print(f"Intermediate steps: {result['intermediate_steps']}")
print(f"Final answer: {result['result']}")
相关推荐
kjkdd7 小时前
6.1 核心组件(Agent)
python·ai·语言模型·langchain·ai编程
刘大大Leo7 小时前
GPT-5.3-Codex 炸了:第一个「自己造自己」的 AI 编程模型,到底意味着什么?
人工智能·gpt
渣渣苏11 小时前
Langchain实战快速入门
人工智能·python·langchain
凯子坚持 c11 小时前
CANN 生态中的模型压缩利器:深入 `quant-tool` 项目实现高效 INT8 部署
neo4j
小天呐12 小时前
01—langchain 架构
langchain
小羊不会打字14 小时前
CANN 生态中的模型安全加固:`secure-model-deploy` 项目实践指南
安全·neo4j
香芋Yu14 小时前
【LangChain1.0】第九篇 Agent 架构设计
langchain·agent·架构设计
kjkdd16 小时前
5. LangChain设计理念和发展历程
python·语言模型·langchain·ai编程
ASKED_20191 天前
Langchain学习笔记一 -基础模块以及架构概览
笔记·学习·langchain
zhengfei6111 天前
【AI平台】- 基于大模型的知识库与知识图谱智能体开发平台
vue.js·语言模型·langchain·知识图谱·多分类