https://promptfoo.dev/ logo
Global var across all tests ?
# ❓|questions
n
Hello ! I can't wrap my head around how I should configure global vars for all my tests. Amongst the things I've tried, this seemed to be the most intuitive but without success. I couldn't find information about this in the documentation. Thank you for your help
Copy code
yaml
defaultTest:
  - vars:
      phi3_template_prompt: file://./prompts/model-templates/phi3.txt
      gemma_template_prompt: file://./prompts/model-templates/gemma.txt
      system_prompt: [ "system_prompt_001", "system_prompt_002" ]
i
you're pretty close. This should do it (
vars
is not an array under a single test):
Copy code
yaml
defaultTest:
  vars:
    phi3_template_prompt: file://./prompts/model-templates/phi3.txt
    gemma_template_prompt: file://./prompts/model-templates/gemma.txt
    system_prompt: [ "system_prompt_001", "system_prompt_002" ]
n
haha i was close indeed, i'd say this "-" close 🤏😆 Thank you very much for your help !
Hey again @ian ! I continue the discussion here as it's quite in the same vein. I've opened an issue here : https://github.com/promptfoo/promptfoo/issues/1227, where the problem is described. I'm exploring the code more and more to better know what's happening under hood and maybe try to help you working on it. I've made a guess regarding a potential source for the problem, wouldn't be surprised if i'm wrong haha The issue can be mitigated with a little maneuver but that implies quite some duplication in the config file.
i
👀 thanks for flagging, probably not a terribly difficult fix. I'll put it on the todo list