> ## Documentation Index
> Fetch the complete documentation index at: https://nvd-54.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Neo4j 集成

> 使用 LangChain Python 与 Neo4j 集成。

> * Neo4j is an `open-source database management system` that specializes in graph database technology.
> * Neo4j allows you to represent and store data in nodes and edges, making it ideal for handling connected data and relationships.
> * Neo4j provides a `Cypher Query Language`, making it easy to interact with and query your graph data.
> * With Neo4j, you can achieve high-performance `graph traversals and queries`, suitable for production-level systems.

> Get started with Neo4j by visiting [their website](https://neo4j.com/).

## 安装和设置

* Install the Python SDK with `pip install neo4j langchain-neo4j`

## 向量存储

The Neo4j vector index is used as a vectorstore,
无论是用于语义搜索还是示例选择。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_neo4j import Neo4jVector
```

查看[使用示例](/oss/python/integrations/vectorstores/neo4jvector)

## GraphCypherQAChain

存在一个围绕 Neo4j graph database that allows you to generate Cypher statements based on the user input
and use them to retrieve relevant information from the database.

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_neo4j import GraphCypherQAChain, Neo4jGraph
```

查看[使用示例](/oss/python/integrations/graphs/neo4j_cypher)

## Constructing a knowledge graph from text

Text data often contain rich relationships and insights that can be useful for various analytics, recommendation engines, or knowledge management applications.
Diffbot's NLP API allows for the extraction of entities, relationships, and semantic meaning from unstructured text data.
By coupling Diffbot's NLP API with Neo4j, a graph database, you can create powerful, dynamic graph structures based on the information extracted from text.
These graph structures are fully queryable and can be integrated into various applications.

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_neo4j import Neo4jGraph
from langchain_experimental.graph_transformers.diffbot import DiffbotGraphTransformer
```

查看[使用示例](/oss/python/integrations/graphs/diffbot)

## Checkpoint saver

Neo4j implementation of LangGraph checkpoint saver for persistent GitHub agent memory with branching time-travel support. Checkpoint savers persist graph state at every super-step, enabling session memory, human-in-the-loop workflows, time travel, and fault tolerance.
Works with LangGraph graphs and LangChain agents:

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_neo4j import Neo4jSaver

with Neo4jSaver.from_conn_string(
    uri="bolt://localhost:7687",
    user="neo4j",
    password="password"
) as checkpointer:
    checkpointer.setup()  # Create indexes (run once)
    # Create agent with checkpointer
    agent = create_agent(
        model="google_genai:gemini-3.1-pro-preview",
        tools=[get_weather],
        system_prompt="You are a helpful assistant",
        checkpointer=checkpointer
    )
```

***

<div className="source-links">
  <Callout icon="terminal-2">
    [将这些文档连接](/use-these-docs) 到 Claude、VSCode 等工具，通过 MCP 获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/oss/python/integrations/providers/neo4j.mdx)或[提交 issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
