diff --git a/griptape/structures/agent.py b/griptape/structures/agent.py index f767d74a2..22937338c 100644 --- a/griptape/structures/agent.py +++ b/griptape/structures/agent.py @@ -1,10 +1,11 @@ from __future__ import annotations from typing import TYPE_CHECKING, Optional, Callable from attrs import define, field +from griptape.artifacts.text_artifact import TextArtifact from griptape.tools import BaseTool from griptape.memory.structure import Run from griptape.structures import Structure -from griptape.tasks import PromptTask, ToolkitTask, BaseTextInputTask +from griptape.tasks import PromptTask, ToolkitTask from griptape.artifacts import BaseArtifact if TYPE_CHECKING: @@ -14,7 +15,7 @@ @define class Agent(Structure): input: str | list | tuple | BaseArtifact | Callable[[BaseTask], BaseArtifact] = field( - default=BaseTextInputTask.DEFAULT_INPUT_TEMPLATE + default=lambda task: task.full_context["args"][0] if task.full_context["args"] else TextArtifact(value="") ) tools: list[BaseTool] = field(factory=list, kw_only=True) max_meta_memory_entries: Optional[int] = field(default=20, kw_only=True) diff --git a/griptape/tasks/base_text_input_task.py b/griptape/tasks/base_text_input_task.py index 40b6e75c5..f0b5bd9e0 100644 --- a/griptape/tasks/base_text_input_task.py +++ b/griptape/tasks/base_text_input_task.py @@ -14,10 +14,9 @@ @define class BaseTextInputTask(RuleMixin, BaseTask, ABC): - DEFAULT_INPUT_TEMPLATE = "{{ args[0] }}" - _input: str | list | tuple | BaseArtifact | Callable[[BaseTask], BaseArtifact] = field( - default=DEFAULT_INPUT_TEMPLATE, alias="input" + default=lambda task: task.full_context["args"][0] if task.full_context["args"] else TextArtifact(value=""), + alias="input", ) @property