https://promptfoo.dev/ logo
Loading multiple values for a variable from extern...
# ❓|questions
h
Hi, I'm trying to load multiple values for a variable from external files. The variables are long strings including new line characters etc. saved in .txt files. Ideally I would like to be able to do something like this:
Copy code
tests:
  - description: valid json
    vars:
        transcript: folder_with_transcripts/*.txt
    assert:
      - type: is-json
        metric: Consistency
Unfortunatelly this does not work - the content of the files don't get pasted in. This is what I get in output: results.prompt.raw:
...CALL TRANSCRIPT: transcripts/test/*.txt"
results.prompt.display:
...CALL TRANSCRIPT: {{transcript}}"
I also tried listing the individual files like this:
Copy code
tests:
  - description: valid json
    vars:
        transcript:
            - file://folder_with_transcripts/transcript_test.txt
            - file://folder_with_transcripts/transcript_test_2.txt
    assert:
      - type: is-json
        metric: Consistency
But doesn't work either (same type of output). Can you please point me to the right direction? Not sure what I'm doing wrong. Thank you.
i
Makes sense. Let me see if I can add this