You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
702 B
30 lines
702 B
3 weeks ago
|
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
|