Hidden Gems - Adding the Custom Data to Generative Answers

In this blog, you will see how to input the string variable as custom data to the Generative Answers component in the Copilot Studio.

Typical Scenario

When you want to process the information that is received as a response from the other sources of information in a raw text/string format, the text will be large to process or reprocess to find information according to the user query.

So, you might want to pass this large amount of data to the Generative Answer component as a source of data.

I will see this in detail.

After you get the large data set as a response from the previous action, add the “Generate Answer” component.

Generate Answer

Click to open the Edit properties of the component.

 Edit properties

Go to the custom data source, which is available under the Classic data section.

Classic data

Variable

Challenges

When you try to add large text directly to this custom data, you will get the binding error.

Custom Data

This component accepts the custom data in table format.

Not just any table format, but it should be formatted to have content to search the data otherwise, you will get an error like the one below.

Content

The solution to overcome the above two challenges is that the custom data must be in the format specified.

[
 {
  Content: "This is a sample piece of text that was provided for testing purposes, to be replaced with content of your choice",
  ContentLocation: "https://contoso.com/p1.htm",
  Title: "Contoso Sample"
 },
 {
  Content: "This is a second bit of sample text that can be replaced with content of your choice",
  ContentLocation: "https://fabrikam.com/p2.htm"
 },
 {
  Content: "This is a third bit of sample text that can be replaced with content of your choice",
  Title: "Adventure Works Cycles Sample"
 }
]

You convert your text/string data to this format using the PowerFx formula. Let's see.

Open the properties of the custom data.

Properties

You can expand the fx section by clicking on theButtonbutton and formatting the content.

Insert

Now, your text content is ready to be processed by the Generative Answer component.

You will get the response as per the prompt you provided.

I wanted to get the status of the issue, so I got the response.

Response