Announcements
Hi! I am testing some different features of copilot studio, and I got interested in testing using the "Generative answers" action using "Custom data".
Looking at the documentation, it seems like it would be possible to use the output from a power automate flow, send it back to copilot studio, and create a generative answer based on this. The documentation shows that the input to the "custom data" field takes a json array of objects.
As an initial test I wanted to return the sample json in the screenshot above from power automate, send it to copilot studio and use this data to set the custom data field in the "Create generative answer" action.
Inside power automate.
I set the example data from the screenshot above inside "compose", parse it and then return it to copilot.
I return the "body" and this is how it looks like inside power automate. I return it as a string type because it does not seem like it is any other suitable alternatives to return a json/array or table.
Below is a screenshot of the "output", I return the "body"-field.
Inside Copilot studio.
I call the ComposeCustomData flow (ignore the input as I do not really use it for anything).
First of all, if I try to run this inside copilot studio, I get the error message:
Error: The parameter with name customdata on the flow ComposeCustomData (bd97892b-1db1-ee11-a569-000d3adf9328) was evaluated to the type TableDataType, expected type StringDataType Error-code: FlowActionBadRequest Conversation-ID: d6fe75a7-de90-4fdb-8a74-494e303f3b71 Tid (UTC): 2024-01-12T10:02:10.696Z
Which makes sense I guess (?), since I try to return a json, but defined it as a string.
The reason why I'm trying to do this is because the custom data field (in the screenshot below) requires a table type. So even if I try to pass the "customData"-output from the flow, it complains that it is a string and not a table type.
Am I missing something here? 😅 I am a bit confused that I cannot return any other suitable type from power automate apart from "string", and the "Custom data" field requires a "Table", but in the documentation it says that input should be a json array of objects (maybe it is the same?). Also the documentation says that the data in the "Custom data" field could be supplied from a power automate flow, so I guess it should be possible somehow.
Any suggestions would be highly appreciated 😀
Hey,
I was able to resolve the issue by modifying the response parameter to remove the JSON content type.
Originally: response.Content = new StringContent(outputString, Encoding.UTF8, "application/json");
Updated to: response.Content = new StringContent(outputString, Encoding.UTF8);
By doing this, the HTTP response was treated as a plain string instead of JSON. I then parsed it as a table before sending it to the genAI node.
got the same error
I got a similar Error Message: The parameter with name ‘spanswer’ on flow ‘POC - G&E Disclosures’ (‘6cc82777-3b7a-07a0-929b-16c38389d0e7’) evaluated to type ‘TableDataType’ , expected type ‘StringDataType’ Error Code: FlowActionBadRequest Conversation Id: cbae0d28-bd3b-448c-8ac3-b42eedb9012f Time (UTC): 2024-04-30T18:28:08.771Z
It seems the error complained the output of the node below. It expects a string data type but receive a table. This is true the output of the flow is a table, but there is no table output option in "Respond to Copilot" in Power Automate.
I have a Parse value node after the Action node. But the Parse value node didn't call because it was failed in the previous Action node.
Thank you!! This solved my problem 🙂
Hi @victoriag
Before you pass it to Generative Answers, you should use a "Parse value" node.
You can use your sample JSON payload to automatically detect the schema for the format.
From what you describe, you'll then be able to pass the desired custom data table as Topic.YourParsedVariable.body.customdata.
Henry
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.