storied
10/20/2025, 8:26 PMmichaelmichaelmichael
10/21/2025, 3:06 AMstoreOutputAs to chain outputs between tests.
Use storeOutputAs to save each model's response, then reference them in a final test that combines all three:
yaml
prompts:
- "{{query}}"
providers:
- openai:gpt-5-nano
tests:
- vars: {query: "What is quantum computing?"}
provider: openai:gpt-5-nano
options:
storeOutputAs: response1
- vars: {query: "What is quantum computing?"}
provider: anthropic:messages:claude-4.5-haiku
options:
storeOutputAs: response2
- vars: {query: "What is quantum computing?"}
provider: google:gemini-2.5-flash
options:
storeOutputAs: response3
# Combine all three
- vars:
query: |
Combine these three responses:
Model 1: {{response1}}
Model 2: {{response2}}
Model 3: {{response3}}
When you use storeOutputAs, promptfoo automatically runs tests sequentially so variables are available to later tests.
Note: Tests run one at a time (not parallel) when using this feature.storied
10/21/2025, 12:54 PMstoried
10/21/2025, 1:03 PMmichaelmichaelmichael
10/21/2025, 2:29 PMprompts:
- "{{query}}"
defines a prompt template. in this case it is a just a pass through to the vars, but many people will have a prefix or system prompt there. You can rename it to whatever you like or even omit it entirely.
vars: {query: "What is quantum computing?"} could also be:
vars: {prompt: "What is quantum computing?"} with `prompts:
- "{{prompt}}" for example. it's a nunjucks string.
As for passing from a python wrapper. Yes you can use https://www.promptfoo.dev/docs/configuration/expected-outputs/python/ within a config or you can even
import subprocess
import json
# Run promptfoo
result = subprocess.run(
['npx', 'promptfoo', 'eval', '-c', 'config.yaml', '-o', '/dev/stdout'],
capture_output=True,
text=True
)
data = json.loads(result.stdout)
depending on what you are trying to do. LLMs + coding agents can be very useful thinking through options here.storied
10/23/2025, 9:22 PMproviders:
- id: openai:chat:openai/gpt-oss-120b
config:
apiHost: "models.k8s.aip.company.com"
apiKey: "sk-abcfoo"
This works fine.
Once I try what you mention above about combining outputs where I put the provider in vars then I start getting errors.
> - vars: {query: "What is quantum computing?"}
> provider: openai:chat:openai/gpt-oss-120b
Any idea how I can get this to work? I've been trying for a day or so and still have been getting errors. Usually the error is:
> Failed to sanitize URL models.k8s.aip.company.com/chat/completions: TypeError: Invalid URLstoried
10/28/2025, 5:41 PM[Promptfoo] Faizan
11/12/2025, 7:42 PMhttps:// part of the url), hence the "Invalid URL" issue. You'll need to set that correctly to proceed.storied
11/14/2025, 7:50 PM[Promptfoo] Faizan
11/14/2025, 7:55 PM: in the second https//?[Promptfoo] Faizan
11/14/2025, 7:55 PMstoried
11/14/2025, 8:00 PMstoried
11/14/2025, 8:01 PM[Promptfoo] Faizan
11/14/2025, 9:13 PM[Promptfoo] Faizan
11/14/2025, 9:14 PMstoried
11/18/2025, 2:37 PMstoried
11/18/2025, 2:48 PM