Extract JSON value Function

Sample Json
{"id":"chatcmpl-7ceff50a-a5f1","object":"chat.completion","created":
1736604854,"model": "llama3-8b-8192","choices":
[{"index":0,"message":{"role":"assistant","content":"Hello! It's nice to meet you. Is there something I can help you with or would you like to chat?"},"logprobs":null,"finish_reason":"stop"}],"usage": {"queue_time":0.017792521000000002,"prompt_tokens":
11,"prompt_time":0.001729597,"completion_tokens": 25,"completion_time":0.020833333,"total_tokens":
36,"total_time":0.02256293},"system_fin
gerprint":"fp_a9","x_groq": {"id":"req_01jhavea"}}
- choices[0].message.content : Get content of message sent by assistant
- choices[0].finish_reason: Get the reason for the stop of the generation
- model : Get the model name
- usage.queue_time : Get the queue time
- usage.prompt_tokens : Get the prompt tokens
- usage.completion_rokens : Get the completion tokens
1 Like