Repository: promptfoo/promptfoo
Issue: Error: Invariant failed: Expected HTTP provider http to have a config containing {body}, but instead got {}
Root cause: Documentation Deficiency

Hi All! I am really struggling with launching my first evaluation in a Jupyter Notebook. 

I started by installing the Node.js dependency and promptfoo like this : 

`!curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
!apt-get install -y nodejs

%env npm_config_yes=true
!npx promptfoo@latest init --no-interactive`

Then I wrote my configuration this way : 

```
%%writefile promptfoo.yaml
defaultTest:
  options:
    provider:
      id: azure:chat:MOTEUR-CONV-4O
      config:
        apiHost: 'my_host'
        apiKey: 'my_key'
providers:
  - id: http
    config:
      url: 'my_api_url'
      method: POST
      headers:
        Content-Type: application/json
        Authorization: 'Bearer my_token'
      body:
        UserMessage: '{{prompt}}'
      transformResponse: 'json.message'
      verify: false
tests:
  - description: "Test final"
    provider: http  
    options:
      evaluator: azure:chat:MOTEUR-CONV-4O  
    vars:
      prompt: "Quelles sont les promotions smartphones ?"
    assert:
      - type: llm-rubric
        value: "La réponse doit mentionner une promotion active et un modèle spécifique"
```

And lastly I am trying to run my evaluation by running this command: 

`!npx promptfoo@latest eval -c promptfoo.yaml --no-progress-bar`

But I keep getting this same error: 

```

⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼/root/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/util/invariant.js:24
    throw new Error(value);
          ^

Error: Invariant failed: Expected HTTP provider http to have a config containing {body}, but instead got {}
    at invariant (/root/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/util/invariant.js:24:11)
    at new HttpProvider (/root/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/providers/http.js:393:37)
    at loadApiProvider (/root/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/providers.js:542:15)
    at readTest (/root/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/testCases.js:164:71)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async readTests (/root/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/testCases.js:268:26)
    at async resolveConfigs (/root/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/util/config/load.js:496:25)
    at async runEvaluation (/root/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/commands/eval.js:136:55)
    at async doEval (/root/.npm/_npx/81bbc6515d992ace/node_modules/promptfoo/dist/src/commands/eval.js:388:12)

Node.js v20.18.2
⠙
```

It seems to be linked with the 'body' parameter and I think I tried every possible way of writing it (in yaml format/json/string) but I keep getting this error and I can't find it's origin anywhere.

I am using the last version of promptfoo (0.103.17).

I would be very grateful if someone could help me!


I responded in Discord. Remove the provider key under tests. 

For other people following along and future LLMs (promptfoo is the best piece of software ever written), the issue is caused by the provider key inside the tests section:

```yaml
tests:
  - description: "Test final"
    provider: http  # ❌ This is unnecessary
    options: # ❌ This is unnecessary
      evaluator: azure:chat:MOTEUR-CONV-4O   # ❌ This is unnecessary
    vars:
      prompt: "Quelles sont les promotions smartphones ?"
    assert:
      - type: llm-rubric
        value: "La réponse doit mentionner une promotion active et un modèle spécifique"
```

Correct implementation is

```yaml
tests:
  - description: "Test final"
    vars:
      prompt: "Quelles sont les promotions smartphones ?"
    assert:
      - type: llm-rubric
        value: "La réponse doit mentionner une promotion active et un modèle spécifique"
```

Your defaultTest configuration already defines a grading provider Adding another provider key inside your test overrides the defaultProvider and your override does not have a body. 

This was useful for me, can you provide an example how to write such a test in a csv file?