連接 Notion 與 Cognee:為 AI 智能體建立長期記憶
Connecting Notion to Cognee: Building Long-Term Memory for AI Agents
NotionLoader 將 Notion 工作區文件匯入 Cognee,轉化為互相關聯的知識圖譜,為 AI 智能體提供跨工作階段的長期記憶。它使用官方 notion-client Python SDK 擷取頁面和資料庫的文字內容,再交由 Cognee 的匯入流程處理。
AI agents often lose context across sessions. By integrating Notion with Cognee, agents can automatically ingest workspace documentation and convert it into an interconnected Knowledge Graph.
How it works
I developed NotionLoader using the official notion-client Python SDK. It fetches pages and databases, extracts text content, and passes it to Cognee's ingestion pipeline.
Python
from notion_loader import NotionLoader
import cognee
loader = NotionLoader()
pages = loader.load_data()
for page in pages:
cognee.add(f"Title: {page['title']}\n\n{page['content']}")
cognee.cognify()
This brings seamless knowledge graph memory to any Cognee agent working with Notion documents!
來源:DEV Community · dev.to