https://promptfoo.dev/ logo
Array variables
# ❓|questions
c
Sorry for the dumb question, but is there a way I can have a variable be an array? For example, imagine I want a prompt to analyze one or more documents. In my tests, I’d like to have an array called documents and in my nunjucks template I could have a for loop over each document text.
i
yeah that should work. you might need to set an envar though try setting envar
PROMPTFOO_DISABLE_VAR_EXPANSION=1
and then using an array for a variable 🙂
c
Ah got it. The environment variable will prevent promptfoo from doing the thing where it just runs the same prompt with different scenarios for the same variable but instead treat the variable as an array?
i
Exactly!