Parse Json to use in HTTP activity

Hi All,

Need help in Json parsing.

I am using below json as a body in http request activity but it is not working. Please help.

{
“messages”: [{“role”:“user”,“content”:replace}],
“max_tokens”: 800,
“temperature”: 0,
“frequency_penalty”: 0,
“presence_penalty”: 0,
“top_p”: 1,
“stop”: null
}

In the above JSON I have to replace ‘replace’ keyword with a different text which I am doing using assign activity still getting error. Currently I am reading this json from a text file and replacing the keyword with needed string

Thanks

A quick dirty method could be:

textfile:

{
"messages": [{"role":"user","content":"#Para1#"}],
"max_tokens": 800,
"temperature": 0,
"frequency_penalty": 0,
"presence_penalty": 0,
"top_p": 1,
"stop": null
}

read text file
replace #Para1# with the value
we surrounded with " and assumed that the value needed as a string

Thankyou @ppr

Also in the below response, can you please help me in fetching the “content” key value!!

{
“id”: “chatcmpl-7”,
“object”: “chat.completion”,
“created”: 169720,
“model”: “gpt”,
“choices”: [
{
“index”: 0,
“finish_reason”: “stop”,
“message”: {
“role”: “assistant”,
“content”: “I am a Robot”
}
}
],
“usage”: {
“completion_tokens”: 33,
“prompt_tokens”: 10,
“total_tokens”: 43
}
}

The output I want is - I am a Robot
Thanks

we prefer to scope 1 Topic = 1 case

If further assistance on the retrieval is needed please open a new topic:
grafik

first statement we used for the access analysis
second statement is doing the extraction

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