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

# Memgraph 集成

> 使用 LangChain Python 集成 Memgraph。

> Memgraph 是一款高性能的内存图数据库，专为实时查询和分析而优化。
> 通过访问 [他们的网站](https://memgraph.com/) 开始使用 Memgraph。

## 安装和设置

* 使用 `pip install langchain-memgraph` 安装 Python SDK

## MemgraphQAChain

Memgraph 数据库存在一个包装器，允许您根据用户输入生成 Cypher 语句，并使用它们从数据库中检索相关信息。

```python theme={null}
from langchain_memgraph.chains.graph_qa import MemgraphQAChain
from langchain_memgraph.graphs.memgraph import MemgraphLangChain
```

查看一个 [使用示例](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/graphs/memgraph.md)

## 从非结构化数据构建知识图谱

您可以使用集成从非结构化数据构建知识图谱。

> [!WARNING]
>
> `langchain-experimental` 包已不再维护。从 `langchain_experimental` 导入的示例可能过时或已损坏，请谨慎使用。

```python theme={null}
from langchain_memgraph.graphs.memgraph import MemgraphLangChain
from langchain_neo4j import LLMGraphTransformer
```

查看一个 [使用示例](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/graphs/memgraph.md)

## Memgraph 工具和工具包

Memgraph 还提供了一个工具包，允许您与 Memgraph 数据库交互。
查看一个 [使用示例](https://github.com/memgraph/langchain-memgraph)。

```python theme={null}
from langchain_memgraph import MemgraphToolkit
```

***

> 官方原文：[src/oss/python/integrations/providers/memgraph.mdx](https://github.com/langchain-ai/docs/blob/main/src/oss/python/integrations/providers/memgraph.mdx) · 非官方翻译，译文由 AI 生成，以英文原文为准。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.