MCPcopy Create free account
hub / github.com/LLMQuant/quant-mind / TreeNode

Class TreeNode

quantmind/knowledge/_tree.py:22–44  ·  view source on GitHub ↗

A single node in a TreeKnowledge. `summary` is mandatory because agents navigate by reading it. `content` is the optional full-text body (typically populated only on leaves to keep the tree small in memory). `children_ids` is an adjacency list; the parent `TreeKnowledge` resolves th

Source from the content-addressed store, hash-verified

20
21
22class StructureTreeValidationError(ValueError):
23 """A structure tree failed its code-owned integrity gate."""
24
25
26class TreeNode(BaseModel):
27 """A single node in a TreeKnowledge.
28
29 `summary` is mandatory because agents navigate by reading it. `content`
30 is the optional full-text body (typically populated only on leaves to
31 keep the tree small in memory). `children_ids` is an adjacency list; the
32 parent `TreeKnowledge` resolves them via its `nodes` map.
33 """
34
35 model_config = ConfigDict(extra="forbid", frozen=True)
36
37 node_id: UUID = Field(default_factory=uuid4)
38 parent_id: UUID | None = None
39 position: int = 0
40 title: str
41 summary: str
42 content: str | None = None
43 citations: list[Citation] = Field(default_factory=list)
44 children_ids: list[UUID] = Field(default_factory=list)
45
46
47class StructureTree(BaseModel):

Callers 9

_build_paperMethod · 0.90
_make_treeFunction · 0.90
test_minimalMethod · 0.90
test_extra_forbiddenMethod · 0.90
test_frozenMethod · 0.90
_single_node_paperFunction · 0.90
_stub_paperFunction · 0.90

Calls

no outgoing calls

Tested by 9

_build_paperMethod · 0.72
_make_treeFunction · 0.72
test_minimalMethod · 0.72
test_extra_forbiddenMethod · 0.72
test_frozenMethod · 0.72
_single_node_paperFunction · 0.72
_stub_paperFunction · 0.72