Hi all / @HenryJammes
I want to create the Generative Answers based on the My custom Data Source(JsonData).
As I want to store my jsonData as Custom data in generative answers Source and then based on user input , want to search in json data and give generative answers.
So I tried to set the jsonData in one variable and then parse the value in Table format and then use this variable in custom data source as below,
but getting below error while running,
Error Message: Missing or invalid assignment for variable ‘searchResult.Content’. Error Code: MissingOrInvalidRequiredProperty Conversation Id: dfd6aa0b-e7c2-4ad2-99a2-46c4ee07b31b Time (UTC): 2023-12-18T11:17:57.785Z
input JsonData:
Pls Help...
How can i do that?
In Copilot I am using http request and getting the values from API. And the response is in the following format:
Please help me on this!
Thanks a lot @HenryJammes for help.
now it's working and I have accepted the solution.
Hi @jontydadhania,
I got it to work by using this formula:
ForAll(Topic.Table,
{
Content: task & " - with description " & description & " - with due date is " & dueDate,
ContentLocation: Blank()
}
)
Here's the full topic YAML if you would like to repro and see the steps I've taken to get there:
kind: AdaptiveDialog
beginDialog:
kind: OnRecognizedIntent
id: main
intent:
triggerQueries:
- Custom Data Source Table
actions:
- kind: SetVariable
id: setVariable_UkcD2G
variable: Topic.JSON
value: "[ { \"task\": \"create user\", \"description\": \"This task for create user\", \"dueDate\": \"2024-01-31\" }, { \"task\": \"create admin\", \"description\": \"This task for create admin\", \"dueDate\": \"2024-01-15\" } ]"
- kind: ParseValue
id: PaWmbX
variable: Topic.Table
valueType:
kind: Table
properties:
description: String
dueDate: String
task: String
value: =Topic.JSON
- kind: SetVariable
id: setVariable_APwrEb
variable: Topic.CustomData
value: |-
=ForAll(Topic.Table,
{
Content: task & " - with description " & description & " - with due date is " & dueDate,
ContentLocation: Blank()
}
)
- kind: SearchAndSummarizeContent
id: searchAndSummarizeContent_NCLHgt
userInput: what is due date for user task?
variable: Topic.Answer
additionalInstructions:
publicDataSource: {}
sharePointSearchDataSource: {}
customDataSource:
searchResults: =Topic.CustomData
- kind: ConditionGroup
id: conditionGroup_oacZ3K
conditions:
- id: conditionItem_ak7vHT
condition: =!IsBlank(Topic.Answer)
actions:
- kind: EndDialog
id: xanuPR
Hello @HenryJammes
My Use case: Based on the custom connectors response (Json data), will store this Json response in variable and now based on user input, I want to create generative answers from that json response. I don't want to search from any document.
Please suggest, how can i solve my use case using copilot studio?
Let me know if need more details.
Thanks for Help....
Thank you @hernandezpaul and @HenryJammes for your quick response.
I tried that way, passed below Json to one variable and format the table schema with the attributes/columns:
Json sample data:
But still getting below error,
Error Message: Missing or invalid assignment for variable ‘searchResult.Content’. Error Code: MissingOrInvalidRequiredProperty Conversation Id: b03504f5-019d-406e-8ea8-2c750e637732 Time (UTC): 2023-12-19T13:13:47.534Z
My Usecase: Based on jsonData I want to search and create generative answers on user input.
Example: if user ask in copilot: what is due date for user task?
then based on this json copilot will provide generative answers to user.
Please let me know what am i missing here to get the result?
Thanks for help
Thank you @hernandezpaul, that's exactly it. Custom data expects a specific format for the table: Use a custom data source for generative answers - Microsoft Copilot Studio | Microsoft Learn
Hi @jontydadhania ,
I was facing the same problem.
Basically, you need to format the input as a table with a fixed schema with the attributes/columns:
Example:
Suppose your using the API output schema (from ServiceNow Knowledge Management API)
Formatting:
For each article, an entry with Content and ContentLocation is added.
I learned this from this great video: Copilot Studio Generating Answers from a Custom Index such as ServiceNow Knowledgebase (youtube.com)
Hope that helps.