How to generate dictionary with the key as dynamic text and value as list of Documents in Appian

I am trying to use the DOCX From Dynamic Template smart service which requires the images data to be passed in the form of dictionary such that the key in the dictionary is the imageKey (text) and value is list of documents.

I have input like say, ri!imageKey (text) = "logo" and ri!images (list of documents) = {appianDocument1, appianDocument2}. Here appianDocument1 and appianDocument2 is of type Document and should be of type document in the final dictionary. 

I want to generate:

{

  logo: {appianDocument1, appianDocument2}

}

Can anyone help me to achieve this?

Thanks

  Discussion posts and replies are publicly visible