agentkit.base_node.BaseNode

class agentkit.base_node.BaseNode(key: str, prompt: str, graph: ~agentkit.graph.Graph, query_llm: ~collections.abc.Callable, compose_prompt: ~agentkit.compose_prompt.BaseComposePrompt, after_query: ~agentkit.after_query.BaseAfterQuery | None = None, error_msg_fn: ~collections.abc.Callable[[list, str, ~agentkit.exceptions.AfterQueryError], list] = <function error_msg_default>, verbose: bool = False, token_counter: ~collections.abc.Callable | None = None)

Base class for a node in the graph.

Each node in the graph is an instance of the BaseNode class. The node is evaluated by querying the LLM with a prompt.

key

Unique key for the node.

Type:

str

prompt

Prompt for the node.

Type:

str

result

Result of the node evaluation.

Type:

str

temporary_skip

Flag to skip the node evaluation.

Type:

bool

graph

Graph object.

Type:

Graph

adjacent_to

List of nodes that are adjacent to this node.

Type:

list

adjacent_from

List of nodes that are adjacent from this node.

Type:

list

evaluate_after

List of nodes that are evaluated after this node.

Type:

list

counts

List of token counts.

Type:

list

query_llm

Function to query the LLM.

Type:

Callable

_compose_prompt

ComposePrompt object.

Type:

BaseComposePrompt

after_query

AfterQuery object.

Type:

BaseAfterQuery

error_msg_fn

Function to add error message to the prompt.

Type:

Callable

verbose

Verbose flag. Node will print the prompt and answer.

Type:

bool

markdown

Markdown flag. Enables markdown output.

Type:

bool

token_counter

Function to count tokens.

Type:

Callable