structures
__all__ = ['Structure', 'Agent', 'Pipeline', 'Workflow']
module-attribute
Agent
Bases: Structure
Source code in griptape/structures/agent.py
fail_fast: bool = field(default=False, kw_only=True)
class-attribute
instance-attribute
input: str | list | tuple | BaseArtifact | Callable[[BaseTask], BaseArtifact] = field(default=lambda task: task.full_context['args'][0] if task.full_context['args'] else TextArtifact(value=''))
class-attribute
instance-attribute
max_meta_memory_entries: Optional[int] = field(default=20, kw_only=True)
class-attribute
instance-attribute
prompt_driver: BasePromptDriver = field(default=Factory(lambda: Defaults.drivers_config.prompt_driver), kw_only=True)
class-attribute
instance-attribute
stream: bool = field(default=Factory(lambda: Defaults.drivers_config.prompt_driver.stream), kw_only=True)
class-attribute
instance-attribute
task: BaseTask
property
tools: list[BaseTool] = field(factory=list, kw_only=True)
class-attribute
instance-attribute
__attrs_post_init__()
Source code in griptape/structures/agent.py
add_task(task)
add_tasks(*tasks)
try_run(*args)
validate_fail_fast(_, fail_fast)
Pipeline
Bases: Structure
Source code in griptape/structures/pipeline.py
__run_from_task(task)
add_task(task)
Source code in griptape/structures/pipeline.py
context(task)
Source code in griptape/structures/pipeline.py
insert_task(parent_task, task)
Source code in griptape/structures/pipeline.py
Structure
Bases: ABC
Source code in griptape/structures/structure.py
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 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
|
conversation_memory: Optional[BaseConversationMemory] = field(default=Factory(lambda: ConversationMemory()), kw_only=True)
class-attribute
instance-attribute
execution_args: tuple
property
fail_fast: bool = field(default=True, kw_only=True)
class-attribute
instance-attribute
finished_tasks: list[BaseTask]
property
id: str = field(default=Factory(lambda: uuid.uuid4().hex), kw_only=True)
class-attribute
instance-attribute
input_task: Optional[BaseTask]
property
meta_memory: MetaMemory = field(default=Factory(lambda: MetaMemory()), kw_only=True)
class-attribute
instance-attribute
output: BaseArtifact
property
output_task: Optional[BaseTask]
property
rules: list[BaseRule] = field(factory=list, kw_only=True)
class-attribute
instance-attribute
rulesets: list[Ruleset] = field(factory=list, kw_only=True)
class-attribute
instance-attribute
task_memory: TaskMemory = field(default=Factory(lambda self: TaskMemory(), takes_self=True), kw_only=True)
class-attribute
instance-attribute
tasks: list[BaseTask]
property
__add__(other)
__attrs_post_init__()
add_task(task)
abstractmethod
add_tasks(*tasks)
Source code in griptape/structures/structure.py
after_run()
Source code in griptape/structures/structure.py
before_run(args)
Source code in griptape/structures/structure.py
context(task)
find_task(task_id)
is_executing()
is_finished()
resolve_relationships()
Source code in griptape/structures/structure.py
run(*args)
try_find_task(task_id)
try_run(*args)
abstractmethod
validate_rules(_, rules)
Source code in griptape/structures/structure.py
validate_rulesets(_, rulesets)
Source code in griptape/structures/structure.py
Workflow
Bases: Structure
, FuturesExecutorMixin
Source code in griptape/structures/workflow.py
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 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
input_task: Optional[BaseTask]
property
input_tasks: list[BaseTask]
property
output_task: Optional[BaseTask]
property
output_tasks: list[BaseTask]
property
outputs: list[BaseArtifact]
property
__link_task_to_children(task, child_tasks)
Source code in griptape/structures/workflow.py
__link_task_to_parents(task, parent_tasks)
Source code in griptape/structures/workflow.py
__remove_old_parent_child_relationships(parent_tasks, child_tasks)
Source code in griptape/structures/workflow.py
add_task(task)
context(task)
Source code in griptape/structures/workflow.py
insert_task(parent_tasks, task, child_tasks, *, preserve_relationship=False)
Source code in griptape/structures/workflow.py
insert_tasks(parent_tasks, tasks, child_tasks, *, preserve_relationship=False)
Insert tasks between parent and child tasks in the workflow.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent_tasks |
BaseTask | list[BaseTask]
|
The tasks that will be the parents of the new tasks. |
required |
tasks |
BaseTask | list[BaseTask]
|
The tasks to insert between the parent and child tasks. |
required |
child_tasks |
BaseTask | list[BaseTask]
|
The tasks that will be the children of the new tasks. |
required |
preserve_relationship |
bool
|
Whether to preserve the parent/child relationship when inserting between parent and child tasks. |
False
|