跳到主要内容
TigerGraph 是一个原生分布式的高性能图数据库。数据以顶点和边的图形式存储,能够形成丰富的关系,非常适合作为 LLM 响应的基础。
这里展示了一个 TigerGraphLangChain 集成的大型示例。

安装和设置

请遵循如何连接到 TigerGraph 数据库的说明。 安装 Python SDK:
pip install pyTigerGraph

示例

要使用 TigerGraph InquiryAI 功能,您可以从 langchain_community.graphs 中导入 TigerGraph
import pyTigerGraph as tg

conn = tg.TigerGraphConnection(host="DATABASE_HOST_HERE", graphname="GRAPH_NAME_HERE", username="USERNAME_HERE", password="PASSWORD_HERE")

### ==== CONFIGURE INQUIRYAI HOST ====
conn.ai.configureInquiryAIHost("INQUIRYAI_HOST_HERE")

from langchain_community.graphs import TigerGraph

graph = TigerGraph(conn)
result = graph.query("How many servers are there?")
print(result)

以编程方式连接这些文档到 Claude、VSCode 等,通过 MCP 获取实时答案。
© . This site is unofficial and not affiliated with LangChain, Inc.