T5 question answering inference

Hello everyone, I am trying to use inference API javascript to get answers from the model
This is the javascript code :

async function query(data) {
const response = await fetch(
headers: { Authorization: “Bearer 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” },
method: “POST”,
body: JSON.stringify(data),
const result = await response.json();
return result;

const { messages, user_text } = inputs

let past_user_inputs = ;
let generated_responses = ;

for (const message of messages){

// Prepare Query
const queryInput = {“inputs”: {
“past_user_inputs”: past_user_inputs,
“generated_responses”: generated_responses,
“text”: user_text

let newMessages = […messages]
datetime: moment().format(),

const response = await query(queryInput);
let result =
for (var i = 0; i < response.conversation.generated_responses.length; i++) {
datetime: newMessages[i].datetime,
id: String(i + 1),
response: response.conversation.generated_responses[i],
user_input: response.conversation.past_user_inputs[i],

console.log(“result”, result)
return { result };
but when I run the program I get the error:

{“error”:" args[0]: {‘past_user_inputs’: , ‘generated_responses’: , ‘text’: ‘hello’} have the wrong format. The should be either of type str or type list",“warnings”:[“There was an inference error: args[0]: {‘past_user_inputs’: , ‘generated_responses’: , ‘text’: ‘hello’} have the wrong format. The should be either of type str or type list”]}

Any idea on how to solve this?

Thanks a bunch