trustgraph-ai/trustgraph

GitHub: trustgraph-ai/trustgraph

一个图原生的上下文开发平台,为构建认知型 AI 应用提供结构化知识的存储、丰富、检索和可移植的上下文管理能力。

Stars: 1894 | Forks: 199

[![PyPI version](https://img.shields.io/pypi/v/trustgraph.svg)](https://pypi.org/project/trustgraph/) [![License](https://img.shields.io/github/license/trustgraph-ai/trustgraph?color=blue)](LICENSE) ![E2E Tests](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/5d44bcce26182928.svg) [![Discord](https://img.shields.io/discord/1251652173201149994 )](https://discord.gg/sQMwkRz5GX) [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/trustgraph-ai/trustgraph) [**网站**](https://trustgraph.ai) | [**文档**](https://docs.trustgraph.ai) | [**YouTube**](https://www.youtube.com/@TrustGraphAI?sub_confirmation=1) | [**配置终端**](https://config-ui.demo.trustgraph.ai/) | [**Discord**](https://discord.gg/sQMwkRz5GX) | [**博客**](https://blog.trustgraph.ai/subscribe) trustgraph-ai%2Ftrustgraph | Trendshift # 上下文开发平台
构建需要“认知”的应用程序,仅靠一个数据库是不够的。[TrustGraph](https://trustgraph.ai) 是一个上下文开发平台:原生图基础设施,用于在任何规模下存储、丰富和检索结构化知识。可以把它想象成 [Supabase](https://github.com/supabase/supabase),但它是围绕上下文图构建的:多模型存储、语义检索管道、可移植的[上下文核心](#context-cores),以及开箱即用的完整开发者工具包。支持在本地或云端部署。无需多余的 API 密钥。纯粹的、经过工程化的上下文。 该平台支持: - [x] 多模型和多模态数据库系统 - [x] 表格/关系型、键值对 - [x] 文档、图和向量 - [x] 图像、视频和音频 - [x] 自动化数据摄取和加载 - [x] 基于语义相似度检索的快速摄取 - [x] 用于精确检索的 Ontology 结构化 - [x] 开箱即用的 RAG 管道 - [x] DocumentRAG - [x] GraphRAG - [x] OntologyRAG - [x] 用于探索上下文的 3D GraphViz - [x] 完整的 Agentic 系统 - [x] 单 Agent - [x] 多 Agent - [x] MCP 集成 - [x] 随处运行 - [x] 使用 Docker 在本地部署 - [x] 使用 Kubernetes 在云端部署 - [x] 支持所有主流 LLM - [x] 支持 Anthropic、Cohere、Gemini、Mistral、OpenAI 等的 API - [x] 使用 vLLM、Ollama、TGI、LM Studio 和 Llamafiles 进行模型推理 - [x] 对开发者友好 - [x] REST API [文档](https://docs.trustgraph.ai/reference/apis/rest.html) - [x] Websocket API [文档](https://docs.trustgraph.ai/reference/apis/websocket.html) - [x] Python API [文档](https://docs.trustgraph.ai/reference/apis/python) - [x] CLI [文档](https://docs.trustgraph.ai/reference/cli/) ## 无需 API 密钥 你有多少次克隆了一个代码库,打开 `.env.example` 后,却发现需要几十个第三方依赖的 API 密钥才能让服务运行起来?在 TrustGraph 中,只有 3 种情况可能需要 API 密钥: - 第三方 LLM 服务,如 Anthropic、Cohere、Gemini、Mistral、OpenAI 等。 - 第三方 OCR,如 Mistral OCR - 你为 TrustGraph API 网关*自行设置*的 API 密钥 其他所有都已包含在内。 - [x] 在 [Cassandra](https://cassandra.apache.org/_/index.html) 中托管的多模型存储 - [x] 在 [Qdrant](https://github.com/qdrant/qdrant) 中托管的向量嵌入存储 - [x] 在 [Garage](https://github.com/deuxfleurs-org/garage) 中托管的文件和对象存储(兼容 S3) - [x] 使用 [Pulsar](https://github.com/apache/pulsar) 托管的高速 Pub/Sub 消息架构 - [x] 使用 [vLLM](https://github.com/vllm-project/vllm)、[TGI](https://github.com/huggingface/text-generation-inference)、[Ollama](https://github.com/ollama/ollama)、[LM Studio](https://github.com/lmstudio-ai) 和 [Llamafiles](https://github.com/mozilla-ai/llamafile) 的完整开源 LLM 推理技术栈 ## 快速开始 ``` npx @trustgraph/config ``` TrustGraph 以 Docker 容器的形式下载,可以使用 Docker、Podman 或 Minikube 在本地运行。配置工具将生成: - `deploy.zip`,其中包含用于 Docker/Podman 部署的 `docker-compose.yaml` 文件,或用于 Kubernetes 的 `resources.yaml` 文件 - 部署说明文件 `INSTALLATION.md`

如需基于浏览器的快速入门,请尝试 [配置终端](https://config-ui.demo.trustgraph.ai/)。
目录
- [**什么是上下文图?**](#watch-what-is-a-context-graph)
- [**上下文图实战**](#watch-context-graphs-in-action)
- [**入门指南**](#getting-started-with-trustgraph)
- [**上下文核心**](#context-cores)
- [**技术栈**](#tech-stack)
- [**可观测性与遥测**](#observability--telemetry)
- [**贡献**](#contributing)
- [**许可证**](#license)
- [**支持与社区**](#support--community)
## 观看:什么是上下文图? [![What is a Context Graph?](https://img.youtube.com/vi/gZjlt5WcWB4/maxresdefault.jpg)](https://www.youtube.com/watch?v=gZjlt5WcWB4) ## 观看:上下文图实战 [![Context Graphs in Action with TrustGraph](https://img.youtube.com/vi/sWc7mkhITIo/maxresdefault.jpg)](https://www.youtube.com/watch?v=sWc7mkhITIo) ## TrustGraph 入门 - [**入门指南**](https://docs.trustgraph.ai/getting-started) - [**使用工作台**](#workbench) - [**开发者 API 和 CLI**](https://docs.trustgraph.ai/reference) - [**部署指南**](https://docs.trustgraph.ai/deployment) ## 工作台 **工作台**为 TrustGraph 的所有主要功能提供了工具。**工作台**默认运行在 `8888` 端口。 - **Vector Search**:搜索已安装的知识库 - **Agentic、GraphRAG 和 LLM Chat**:用于 Agent、GraphRAG 查询或直接与 LLM 对话的聊天界面 - **Relationships**:分析已安装知识库中的深层关系 - **Graph Visualizer**:已安装知识库的 3D GraphViz 可视化 - **Library**:用于安装知识库的暂存区 - **Flow Classes**:工作流预设配置 - **Flows**:创建自定义工作流并在运行时调整 LLM 参数 - **Knowledge Cores**:管理可复用的知识库 - **Prompts**:在运行时管理和调整 Prompt - **Schemas**:为结构化数据知识库定义自定义 Schema - **Ontologies**:为非结构化数据知识库定义自定义 Ontology - **Agent Tools**:使用集合、知识核心、MCP 连接和工具组定义工具 - **MCP Tools**:连接到 MCP 服务器 ## 用于 UI 的 TypeScript 库 有 3 个库可用于 TrustGraph 服务的快速 UI 集成。 - [@trustgraph/client](https://www.npmjs.com/package/@trustgraph/client) - [@trustgraph/react-state](https://www.npmjs.com/package/@trustgraph/react-state) - [@trustgraph/react-provider](https://www.npmjs.com/package/@trustgraph/react-provider) ## 上下文核心 上下文核心是一个**可移植、版本化的上下文包**,你可以在项目和环境之间传输它、在生产环境中固定它,并在多个 Agent 中复用它。它将“Agent 需要知道的内容”(结构化知识 + 嵌入 + 证据 + 策略)打包成一个单一的工件,因此你可以像对待代码一样对待上下文:构建、测试、版本化、提升和回滚。TrustGraph 正是为了支持这种端到端的上下文工程和编排工作流而构建的。 ### 上下文核心里有什么 上下文核心通常包括: - Ontology(你的领域 Schema)和映射 - 上下文图(实体、关系、支持性证据) - 嵌入 / 向量索引,用于快速的语义入口点查找 - 来源清单 + 血缘关系(事实的来源、时间及推导方式) - 检索策略(遍历规则、新鲜度、权威性排名) ## 技术栈 TrustGraph 提供组件灵活性以优化 Agent 工作流。
LLM API
- Anthropic
- AWS Bedrock
- AzureAI
- AzureOpenAI
- Cohere
- Google AI Studio
- Google VertexAI
- Mistral
- OpenAI
LLM 编排
- LM Studio
- Llamafiles
- Ollama
- TGI
- vLLM
多模型存储
- Apache Cassandra
VectorDB
- Qdrant
文件和对象存储
- Garage
可观测性
- Prometheus
- Grafana
- Loki
数据流
- Apache Pulsar
云平台
- AWS
- Azure
- Google Cloud
- OVHcloud
- Scaleway
## 可观测性与遥测 平台运行后,可通过以下地址访问 Grafana 仪表板: ``` http://localhost:3000 ``` 默认凭证为: ``` user: admin password: admin ``` 默认的 Grafana 仪表板会跟踪以下指标:
遥测
- LLM 延迟
- 错误率
- 服务请求率
- 队列积压
- 分块直方图
- 按服务划分的错误来源
- 速率限制事件
- 按服务划分的 CPU 使用率
- 按服务划分的内存使用率
- 已部署的模型
- Token 吞吐量 (Tokens/秒)
- 成本吞吐量 (成本/秒)
## 贡献 [开发者指南](https://docs.trustgraph.ai/guides/building/introduction.html) ## 许可证 **TrustGraph** 采用 [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) 许可证。 版权所有 2024-2025 TrustGraph 根据 Apache 许可证 2.0 版(“许可证”)获得许可; 除非遵守许可证,否则你不得使用此文件。 你可以在以下网址获取许可证的副本: ``` http://www.apache.org/licenses/LICENSE-2.0 ``` 除非适用法律要求或书面同意,否则根据许可证分发的软件 均按“原样”分发, 不附带任何明示或暗示的担保或条件。 请参阅许可证以了解管理权限和 限制的特定语言。 ## 支持与社区 - 错误报告与功能请求:[Discord](https://discord.gg/sQMwkRz5GX) - 讨论与问答:[Discord](https://discord.gg/sQMwkRz5GX) - 文档:[文档](https://docs.trustgraph.ai/)
标签:AI基础设施, AI风险缓解, Apex, Python, RAG, TrustGraph, 上下文开发平台, 上下文核心, 向量化, 向量数据库, 图原生基础设施, 图存储, 多模型存储, 多模态数据库, 子域名突变, 开发工具包, 开源, 数据摄取, 数据流水线, 文档数据库, 无后门, 智能检索, 机器学习, 检索增强生成, 结构化知识, 自定义请求头, 语义检索, 请求拦截, 逆向工具, 键值数据库, 非结构化数据