I am trying to build the prompt for an OpenAI query from an array in Camunda 8 SaaS. The array is built with information from a Camunda form via a repeating text field dynamically as follows:
[
{
"city": "Berlin"
"distance": "100km",
},
{
"city": "London",
"distance": "1000km",
},
{
"city": "San Francisco",
"distance": "8000km",
}
]
I would like to build the following text prompt for the OpenAI Connector prompt
field:
If I am 100km away from Berlin, 1000km away from London and 8000km away from San Francisco, where am I?
Note: the input array can be of length 1..n
as the user can choose how many cities to define in the form, and the prompt
field accepts either plain text or a FEEL expression.
Is there a way to use a for loop to stich such text together? An alternative solution could be to dump the array to json and provide the json text to chatGPT?
Is there any native Camunda 8 SaaS way to achieve this?