Pipelines

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, otherwise None .

  • parent : parent task if one exists, otherwise None .

  • child : child task if one exists, otherwise None .

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.")