2025-01-25 00:11:00 +01:00
|
|
|
from pydantic import BaseModel
|
2025-02-13 17:32:51 +08:00
|
|
|
from typing import List, Dict, Any
|
2025-01-25 00:11:00 +01:00
|
|
|
|
2025-01-25 00:55:07 +01:00
|
|
|
|
2025-01-25 00:11:00 +01:00
|
|
|
class GPTKeywordExtractionFormat(BaseModel):
|
|
|
|
high_level_keywords: List[str]
|
|
|
|
low_level_keywords: List[str]
|
2025-02-13 17:32:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
class KnowledgeGraphNode(BaseModel):
|
|
|
|
id: str
|
|
|
|
labels: List[str]
|
|
|
|
properties: Dict[str, Any] # anything else goes here
|
|
|
|
|
|
|
|
|
|
|
|
class KnowledgeGraphEdge(BaseModel):
|
|
|
|
id: str
|
|
|
|
type: 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] = []
|