I know there have been a few questions on this, but I'm still struggling to get me head around it! Hopefully all these questions can help newcomers in the future 😆
I'm trying to get a single value out of a nested json response - it's a response from the OpenAI chat completions API. I want to get the "content" value from the first (if any) element of the "choices" array of objects. But I'm struggling to come up with an appropriate Dynamic incantation. Any wizards out there?
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1677858242,
"model": "gpt-3.5-turbo-0613",
"usage": {
"prompt_tokens": 13,
"completion_tokens": 7,
"total_tokens": 20
},
"choices": [
{
"message": {
"role": "assistant",
"content": "\n\nThis is a test!"
},
"logprobs": null,
"finish_reason": "stop",
"index": 0
}
]
}