mirror of
https://github.com/HKUDS/LightRAG.git
synced 2025-06-26 22:00:19 +00:00
30 lines
702 B
Python
30 lines
702 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] = []
|
|
is_truncated: bool = False
|