mirror of
				https://github.com/HKUDS/LightRAG.git
				synced 2025-10-30 17:29:34 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			671 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			671 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from __future__ import annotations
 | |
| 
 | |
| from pydantic import BaseModel
 | |
| from typing import Any, Optional
 | |
| 
 | |
| 
 | |
| class GPTKeywordExtractionFormat(BaseModel):
 | |
|     high_level_keywords: list[str]
 | |
|     low_level_keywords: list[str]
 | |
| 
 | |
| 
 | |
| class KnowledgeGraphNode(BaseModel):
 | |
|     id: str
 | |
|     labels: list[str]
 | |
|     properties: dict[str, Any]  # anything else goes here
 | |
| 
 | |
| 
 | |
| class KnowledgeGraphEdge(BaseModel):
 | |
|     id: str
 | |
|     type: Optional[str]
 | |
|     source: str  # id of source node
 | |
|     target: str  # id of target node
 | |
|     properties: dict[str, Any]  # anything else goes here
 | |
| 
 | |
| 
 | |
| class KnowledgeGraph(BaseModel):
 | |
|     nodes: list[KnowledgeGraphNode] = []
 | |
|     edges: list[KnowledgeGraphEdge] = []
 | 
