AIAction
graphorchestrator.ai.ai_action
AIActionBase
Bases: ABC
Abstract base class for defining AI actions within the graph orchestration framework.
This class serves as a template for creating specialized nodes that can interact with and modify the state of a graph using an underlying AI model.
Attributes:
Name | Type | Description |
---|---|---|
config |
dict
|
A dictionary containing configuration parameters for the AI model. |
_model_built |
bool
|
A flag indicating whether the AI model has been built. |
model |
Any
|
The AI model instance. |
is_node_action |
bool
|
A flag indicating that this object is an AI node action. |
__name__ |
str
|
The name of the AI action, which defaults to the class name. |
Source code in graphorchestrator\ai\ai_action.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
__call__(state)
async
Invokes the AI action's processing logic.
Source code in graphorchestrator\ai\ai_action.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
__init__(config)
Initializes an AIActionBase instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
dict
|
Configuration parameters for the AI model. |
required |
Source code in graphorchestrator\ai\ai_action.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
build_model()
abstractmethod
Build and configure the AI model.
This method should be implemented by subclasses to handle the creation and configuration of the AI model. It is typically called before processing any state.
Subclasses must set the following attributes
self.model: The constructed AI model instance. self._model_built: Set to True to indicate the model is built.
Raises:
Type | Description |
---|---|
NotImplementedError
|
If the method is not implemented by a subclass. |
Source code in graphorchestrator\ai\ai_action.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
process_state(state)
abstractmethod
async
Process the state using the AI model.
This is the main method where the AI model logic is applied to the current state. Subclasses must implement this method to define how the AI model modifies the state.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
State
|
The current state to be processed. |
required |
Returns:
Name | Type | Description |
---|---|---|
State |
State
|
The new state after processing. |
Source code in graphorchestrator\ai\ai_action.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|