Prompt Chain

Store and Reuse Prompt Outputs Across Evaluation Runs

Persist and reuse prompt evaluation outputs across runs to build efficient multi-phase testing pipelines and reduce API costs.

Works with openaipromptfoo

73
Spark score
out of 100
Updated 19 days ago
Version 0.121.18
Models
gpt 3 5gpt 4

Add to Favorites

Why it matters

Enable developers to persist and reuse outputs from prompt evaluations, creating efficient testing pipelines where results from one evaluation phase can be fed into subsequent phases without re-running expensive API calls.

Outcomes

What it gets done

01

Store prompt evaluation outputs to a persistent configuration store

02

Retrieve previously generated outputs for use in downstream prompts

03

Chain multiple prompt evaluation phases using stored intermediate results

04

Reduce API costs by reusing outputs instead of regenerating them

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/pfoo-config-store-and-reuse-outputs | bash

Steps

Steps in the chain

01
Initialize example project
02
Navigate to project directory
03
Set OpenAI API key
04
Edit configuration file
05
Run evaluation
06
View results

Overview

Config Store And Reuse Outputs

A promptfoo configuration example showing output storage and reuse patterns When you want to learn how to configure promptfoo to store and reuse outputs between steps

What it does

This promptfoo configuration example demonstrates how to store outputs from one prompt step and reuse them as inputs in subsequent steps. The example is named "Store And Reuse Outputs" and provides a working configuration you can run and customize.

When to use - and when NOT to

Use this pattern when you want to explore how to configure promptfoo to pass outputs between steps in a workflow. Use it as a starting point for building evaluations where later prompts may need access to earlier outputs.

Do not use this if you need a simple single-prompt evaluation or if your prompts are independent and don't require output storage between steps.

What you provide and what you receive

You provide your OPENAI_API_KEY environment variable and can edit the promptfooconfig.yaml file to customize the configuration.

You receive evaluation results that you can view through the promptfoo interface after running the evaluation.

How to use it

Initialize the example with:

npx promptfoo@latest init --example config-store-and-reuse-outputs
cd config-store-and-reuse-outputs

Set your OPENAI_API_KEY environment variable, then edit the promptfooconfig.yaml file to customize your workflow. Run the evaluation:

promptfoo eval

After evaluation completes, view the results by running promptfoo view.

Who it's for

This example is for prompt engineers and developers who want to learn how to configure output storage and reuse in promptfoo. It provides a concrete starting point for understanding this configuration pattern. If you're testing simple single-prompt scenarios, a basic promptfoo configuration without output storage would be more appropriate.

Source README

config-store-and-reuse-outputs (Store And Reuse Outputs)

You can run this example with:

npx promptfoo@latest init --example config-store-and-reuse-outputs
cd config-store-and-reuse-outputs

Usage

To get started, set your OPENAI_API_KEY environment variable.

Next, edit promptfooconfig.yaml.

Then run:

promptfoo eval

Afterwards, you can view the results by running promptfoo view

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.