Hello everyone,
I'm currently working on a Genesys Digital Bot Flow where I utilize a Data Action to call an RAG API. The API response includes an array of follow-up questions and nested arrays of citations containing a title and URL.
In Architect, I'm encountering challenges when trying to parse this response stored as String Collection in the flow.
I only see options like api.citations.url in the output variables. Attempting to use as this even as a simple communication response generates error and I've tried looping through the string collections, but it stops at the initial stage when I use Count() function
Example of API Response:
{
"followup_questions": [
"What types of hosting does Bluehost offer?",
"How do I choose the right hosting plan for my website?"
],
"citations": [
{
"title": "Choosing the Right Hosting Platform",
"url": "https://www.bluehost.com/help/article/choosing-the-right-hosting-platform"
},
{
"title": "About Domain Names",
"url": "https://www.bluehost.com/help/article/about-domain-names"
}
]
}
Current Output Contract:
{
"title": "output_json",
"type": "object",
"required": [
"AiResponse",
"TransactionId",
"Success"
],
"properties": {
"AiResponse": {
"type": "object",
"required": [
"choices",
"created",
"id",
"model",
"object",
"usage"
],
"properties": {
"choices": {
"type": "array",
"items": {
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "object",
"required": [
"content",
"role",
"followup_questions",
"citations"
],
"properties": {
"content": {
"type": "string"
},
"refusal": {
"type": [
"string",
"null"
]
},
"role": {
"type": "string"
},
"tool_calls": {
"type": [
"object",
"null"
]
},
"followup_questions": {
"type": "array",
"items": {
"type": "string"
}
},
"citations": {
"type": "array",
"items": {
"type": "object",
"required": [
"title",
"url"
],
"properties": {
"article_id": {
"type": "string"
},
"filepath": {
"type": "string"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
},
"url": {
"type": "string"
}
}
}
}
}
}
}
}
},
"created": {
"type": "integer"
},
"id": {
"type": "string"
},
"model": {
"type": "string"
},
"object": {
"type": "string"
},
"usage": {
"type": "object",
"required": [
"completion_tokens",
"prompt_tokens",
"total_tokens"
],
"properties": {
"completion_tokens": {
"type": "integer"
},
"completion_tokens_details": {
"type": [
"object",
"null"
]
},
"prompt_tokens": {
"type": "integer"
},
"prompt_tokens_details": {
"type": [
"object",
"null"
]
},
"total_tokens": {
"type": "integer"
}
}
},
"custom_function_response": {
"type": [
"object",
"null"
]
},
"error": {
"type": [
"object",
"null"
]
}
}
},
"TransactionId": {
"type": "string"
},
"Success": {
"type": "boolean"
},
"ErrorMessage": {
"type": [
"string",
"null"
]
},
"ErrorCode": {
"type": [
"string",
"null"
]
}
}
}
Translation Map:
{
"translationMap": {
"citation_urls": "AiResponse.choices[0].message.citations[*].url",
"followup_questions": "AiResponse.choices[0].message.followup_questions"
},
"translationMapDefaults": {},
"successTemplate": "${rawResult}"
}
I am new to Data Actions and any guidance or suggestions would be greatly appreciated.
Thank you!
#DataActions------------------------------
Ramsha Shaikh
Telecom/AI Engineer
Newfold Digital
------------------------------