griptape icon indicating copy to clipboard operation
griptape copied to clipboard

For base_task, task.run() will work with context if no structure is provided.

Open Chuan-Zh opened this issue 5 months ago • 2 comments

Is your feature request related to a problem? Please describe.

prompt_task = PromptTask(
    "Respond to the user's following question 'who are you' in the language '{{preferred_language}}' and tone '{{tone}}'.",
    context={"preferred_language": "ENGLISH", "tone": "PLAYFUL"},
)

if just create a task like this, the context will not filled in when prompt_task.run().

Describe the solution you'd like the context for prompt_task work without a structure.

in base_task.py

    @property
    def full_context(self) -> dict[str, Any]:
        if self.structure:
            structure_context = self.structure.context(self)

            structure_context.update(self.context)

            return structure_context
        else:
            return self.context

Describe alternatives you've considered None

Additional context None

Chuan-Zh avatar Sep 07 '24 03:09 Chuan-Zh