https://promptfoo.dev/ logo
Utilising file:// with red teaming
# questions
w
Hi there! I'm trying to dabble with and get started exploring red teaming, however I'm having issues getting my http provider to work After checking my API, it appears that the following
file://path
does not work in my http provider
Copy code
yaml
      body:
        query: '{{prompt}}'
        date: '2025-06-03T22:01:13.797Z'
        transactions: file://./test_data/transactions.csv
This works in the normal evals, but not when red teaming it seems?
w
I'll look into this further, but a interim solution would be to use Javascript or Python to define your provider.
w
Yeah that would probably work. Though I just spend a few hours yesterday adapting our API in order to replace our typescript provider with a simple http provider haha
i
This PR extends
file://
loading functionality to
body
https://github.com/promptfoo/promptfoo/pull/5321 will be in next version!
w
Oh awesome!! That was fast, thank you! I'm really liking this framework so far. Trying to integrate promptfoo. First to test our agent against functional requirements, and next to do red teaming. Really liking the look so far
I'm a little confused... I think this already works and is already supported @ian However the difference is, my existing test cases use a providers array, which works fine However the generated readteam.yaml that fails doesn't have a providers array, instead it has a targets array. Is there a difference there? Works:
Copy code
yaml
providers:
  - id: https
    label: Base models
    config:
      url: '{{ env.PROVIDER_URL }}'
      method: POST
      headers:
        'Content-Type': 'application/json'
      body:
        agent:
          query: '{{prompt}}'
          date: '{{date}}'
          transactions: '{{transactions}}'
defaultTest: 
  vars:
    date: '2025-06-03T22:01:13.797Z'
    transactions: file://./test_data/transactions.csv
Does not work:
Copy code
yaml
targets:
  - id: http
    label: my-agent
    config:
      url: http://127.0.0.1:3000/v1/invoke
      method: POST
      headers: {}
      body:
        agent:
          query: '{{prompt}}'
          date: '2025-06-03T22:01:13.797Z'
          transactions: file://./test_data/transactions.csv
Oh!! It looks like it's actually the defaultTest that fixes it, nothing to do with targets. Sorry, I think you can ignore the above If you provide file:// in the vars it works, but not directly in the body. I'm guessing that's what your PR fixes?
i
Yep!