autogen.agents.experimental.ThinkNode
ThinkNode
A node in a tree structure representing a step in the reasoning process.
This class implements a tree node that stores content (text describing a reasoning step),
maintains parent-child relationships, tracks node statistics, and provides utilities
for traversing/visualizing the reasoning path.
Name | Description |
---|---|
content | Type: str |
parent | Type: ForwardRef(‘ThinkNode’) | None Default: None |
Static Methods
from_dict
Create ThinkNode from dictionary representation.
Name | Description |
---|---|
data | dictionary containing node data Type: dict[str, typing.Any] |
parent | Parent node to attach to Type: ForwardRef(‘ThinkNode’) | None Default: None |
Type | Description |
---|---|
ThinkNode | ThinkNode: Reconstructed node with all children |
Instance Attributes
trajectory
Get a formatted string representation of the path from root to this node.
Returns:
str: A formatted string showing the question and each step in the reasoning process
Instance Methods
backpropagate
Update the score of this node and its parents using moving average.
Name | Description |
---|---|
reward | The reward to backpropagate up the tree. Type: float |
to_dict
Convert ThinkNode to dictionary representation.
Returns:
dict[str, Any]: dictionary containing all node attributes and recursive children
Type | Description |
---|---|
dict[str, typing.Any] | dict[str, Any]: dictionary containing all node attributes and recursive children |
visualize_tree
Visualize the tree of thoughts using graphviz.