griptape-ai / griptape

Modular Python framework for AI agents and workflows with chain-of-thought reasoning, tools, and memory.
https://www.griptape.ai
Apache License 2.0
2.02k stars 170 forks source link

prompt_task.py prompt_stack should check weather self.structure is None #1155

Closed Chuan-Zh closed 1 month ago

Chuan-Zh commented 2 months ago

Describe the bug If use prompt_task without a structure, access to self.structure might raise None exception.

To Reproduce A minimal, reproducible code example.

text_artifact = TextArtifact(
    "Respond to the user's following question 'who are you' in the language '{{preferred_language}}' and tone '{{tone}}'."
)

prompt_task = PromptTask(
    text_artifact,
    context={"preferred_language": "ENGLISH", "tone": "PLAYFUL"},
)

print(prompt_task.prompt_stack.to_json())
collindutter commented 2 months ago

Thanks for the issue @Chuan-Zh! Would an improved exception be sufficient for your use-case, or are you looking to use Tasks without a Structure?

Chuan-Zh commented 2 months ago

An improved exception is ok.

Thanks for the issue @Chuan-Zh! Would an improved exception be sufficient for your use-case, or are you looking to use Tasks without a Structure?