I am calling Gemini API (data call) and getting a JSON string (datatype text) which is being displayed on a group using a workflow.
Here is a sample response
{
“candidates”: [
{
“content”: {
“parts”: [
{
“text”: “dummy text”
}
],
“role”: “model”
},
“finishReason”: “STOP”,
“index”: 0,
“safetyRatings”: [
{
“category”: “HARM_CATEGORY_SEXUALLY_EXPLICIT”,
“probability”: “NEGLIGIBLE”
},
{
“category”: “HARM_CATEGORY_HATE_SPEECH”,
“probability”: “NEGLIGIBLE”
},
{
“category”: “HARM_CATEGORY_HARASSMENT”,
“probability”: “NEGLIGIBLE”
},
{
“category”: “HARM_CATEGORY_DANGEROUS_CONTENT”,
“probability”: “NEGLIGIBLE”
}
]
}
],
“usageMetadata”: {
“promptTokenCount”: 5109,
“candidatesTokenCount”: 532,
“totalTokenCount”: 5641
}
}
All I want is the value for the text field. I tried the JSON machine plugin but I am unable to get the desired output. Here is how I used the plugin,
- On the group where the above string is sent, I added the readJson from the JSON machine.
- The JSON body became the Parent groups’s thing and the key was candidates[0].content.parts[0].text
- I added a text field to the same group, and the value as readJson’s text value
I am getting no results.
Is there a simpler way to do this, or perhaps a different plugin?