Integration-Make - Execute JavaScript in Workflows-open-ai

OpenAI

Here you can see how to use Make.com or Integromat with the OpenAI API to generate a JavaScript Code Snippet. To do this, you need to register with OpenAI and create an API key. I can only recommend to go to a paid plan, because then you get fewer times to see that openai is overloaded at the moment. FYI: There is currently no official API to properly query chat.gpt3.

Input-Field

{"json":{"APIKEY":"INSERT-YOUR-APIKEY","prompt":"/* Create an array in javascript of weather temperatures for Los Angeles */"}}

JS-Code-Field

const openai = new OpenAI({ apiKey: input.json.APIKEY}); const completion = await openai.chat.completions.create({ messages: [{ role: "user", content: input.json.prompt }], model: "gpt-3.5-turbo"}); return completion.choices;

Output-Field

{ output: "{"output":[{"index":0,"message":{"role":"assistant","content":"var weatherTemperatures = [];"},"logprobs":null,"finish_reason":"stop"}]}" }