GET OPENAI response problem

Support
  • Hi, I've been working on this for 2 days, I can connect to OpenAI but I can't get the final response in [[RISPOSTA_FINALE]]. Can you please help me?

    // Invio della richiesta
    var response = httpRequest("POST", "https://api.openai.com/v1/chat/completions", request, JSON.stringify(body));

    // Verifica la risposta
    if (response.status == 200) {
    var jsonResponse = JSON.parse(response.text);

    // Estrai il contenuto della risposta
    var responseResult = jsonResponse.choices[0].message.content;
    
    // Salva il risultato nella variabile di output
    SetVariable("RISPOSTA_FINALE", responseResult);
    
    
    // Logga la risposta per debug
    log(responseResult);
    

    } else {
    // Gestione degli errori
    log(Errore: ${response.status} - ${response.text});
    }

  • how can i get this part

    Support
    0 Votes
    2 Posts
    498 Views
  • -1 Votes
    9 Posts
    1921 Views
  • 0 Votes
    1 Posts
    526 Views
  • 0 Votes
    7 Posts
    1007 Views
  • How to get Image Id ?

    Support
    0 Votes
    5 Posts
    877 Views