ontocast.util
¶
count_visits_conditional_success(state, current_node)
¶
Track node visits and handle success/failure conditions.
This function increments the visit counter for a node and manages the state based on success/failure conditions and maximum visit limits.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
AgentState
|
The current agent state. |
required |
current_node
|
The node being visited. |
required |
Returns:
Name | Type | Description |
---|---|---|
AgentState |
AgentState
|
Updated agent state after processing visit conditions. |
Source code in ontocast/util.py
setup_logging(debug=False)
¶
Set up logging configuration for the project.
This function configures the logging system with appropriate formatting and log level based on the debug flag.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
debug
|
bool
|
If True, sets logging level to DEBUG, otherwise INFO. |
False
|
Source code in ontocast/util.py
wrap_with(func, node_name, post_func)
¶
Add a visit counter to a function.
This function wraps a given function with logging and post-processing functionality, typically used for workflow node execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
The function to wrap. |
required | |
node_name
|
The name of the node. |
required | |
post_func
|
Function to execute after the main function. |
required |
Returns:
Type | Description |
---|---|
tuple[WorkflowNode, Callable]
|
tuple[WorkflowNode, Callable]: A tuple containing the node name and the wrapped function. |