Pipelines#
Overview#
A HuggingFace Pipelines is very similar to an agent , but allows for multiple tasks.
You can access the final output of the Pipeline by using the Structured Output attribute.
Context#
Pipelines have access to the following RAG Context variables in addition to the base context .
task_outputs: dictionary containing mapping of all task IDs to their outputs.parent_output: output from the parent task if one exists, otherwiseNone.parent: parent task if one exists, otherwiseNone.child: child task if one exists, otherwiseNone.
Pipeline#
from griptape.structures import Pipeline
from griptape.tasks import PromptTask
pipeline = Pipeline()
pipeline.add_tasks(
# take the first argument from the pipeline `run` method
PromptTask("{{ args[0] }}"),
# take the output from the previous task and insert it into the prompt
PromptTask("Say the following like a pirate: {{ parent_output }}"),
)
pipeline.run("Write me a haiku about sailing.")