Attempting to implement ChatGPT's new API

Hello.
I am attempting to implement ChatGPT's new API into my app. I have successfully been able to make a post request, and that works like this

(do feel free to use it if you wish)

Where my problem lies is converting the response and I get an error Can someone help me with that? Here's what an API response from ChatGPT looks like:

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      **"content": "\n\nHello there, how may I assist you today?",**
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 12,
    "total_tokens": 21
  }
}

I need help with getting the content of the message

That is where I'm at.

1 Like

You need to invert the stack of blocks because they are executed from the innermost to the outermost. Although in this case I'd recommend the get value at key path block:

1 Like

Thank you for the help.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.