https://promptfoo.dev/ logo
0.94 fails with The body must be a string if the C...
# ❓|questions
r
"Error: Content-Type is not application/json, but body is an object or array. The body must be a string if the Content-Type is not application/json.\n\nError: Content-Type is not application/json, but body is an object or array. The body must be a string if the Content-Type is not application/json.\n at HttpProvider.validateContentTypeAndBody (/usr/local/Cellar/promptfoo/0.94.0/libexec/lib/node_modules/promptfoo/dist/src/providers/http.js:134:19)\n at HttpProvider.callApi (/usr/local/Cellar/promptfoo/0.94.0/libexec/lib/node_modules/promptfoo/dist/src/providers/http.js:160:14)\n at runRedteamConversation (/usr/local/Cellar/promptfoo/0.94.0/libexec/lib/node_modules/promptfoo/dist/src/redteam/providers/iterative.js:75:49)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async Evaluator.runEval (/usr/local/Cellar/promptfoo/0.94.0/libexec/lib/node_modules/promptfoo/dist/src/evaluator.js:172:28)\n at async processEvalStep (/usr/local/Cellar/promptfoo/0.94.0/libexec/lib/node_modules/promptfoo/dist/src/evaluator.js:535:25)","gradingResult":null,"id":"8e45f565-5219-4257-94b8-44e7bbb7065c",
Target looks like
Copy code
targets:
  - id: http://localhost:8080/format
    config:
      method: POST
      headers:
        Content-Type: text/plain
      body:
        my_prompt: '{{prompt}}'
but this local API is not even being called when I do
promptfoo redteam eval
worked fine on 0.93.3
I used brew to both install and update
m
I am sorry about the breaking change. It is from this PR: https://github.com/promptfoo/promptfoo/pull/1920/files You should be able to fix it by specifying a header. I'll speak with @[Promptfoo] Steve later today and see if we can fix this for you
u
I didn’t think this combo would be possible. Can you help me understand your setup a bit?That configuration will generate a json object {“ my_prompt”: {{prompt}} }but you have your headers set to Text/plain.
3 Views