Output

Name

flow.output

Description

Used to map values to the Pipeline's output fields.

Used as the last Node in the Pipeline.

Example

index.ts

//...
flow.node(replaceString, () => ({
text: 'Boopsy',
modifier: 'Hello $(text)$',
}))
.output(({ prev }) => ({
name: prev.text, // <-- "name" is the Pipeline's output field
}))

Input

The output Node is special in that its input is dynamic and set by the output of the Pipeline itself.

index.ts

export const jokeGptPipeline =
aigur.pipeline.create({
id: 'jokegpt',
input: z.object({
subject: z.string(),
}),
output: z.object({
joke: z.string(),
}),
flow: (flow) =>
flow
.node(replaceString, ({ input }) => ({
text: input.subject,
modifier: 'tell me a joke about $(text)$',
}))
.node(gpt3Prediction, ({ prev }) => ({
prompt: prev.text,
}))
.output(({ prev }) => ({
joke: prev.text,
})
});

Output

The output of the output Node is the Pipeline's output.