Hey everyone, today I wanted to show you a pretty cool feature within Copilot Studio called 'Direct Line', that allows you to use your Copilot in a number of different channels and situations. Specifically I will get generative AI answers from my Copilot by feeding it a list of questions within power automate.
Let's go take a look!
Okay, I'm in Copilot Studio, I've created a Copilot for this demo, and I've uploaded a document to the generative AI section called Terrible IT Security Policies. This document has been added and it's been indexed and it's ready to go.
Then if we navigate over to Security and click on 'Web Channel Security', you'll see the 'Direct Line' secrets that are generated for this Copilot. And, we would regenerate them if they were ever compromised. But, you can copy them.
Then I'm going to navigate over to the flow. And, I've added that to the 'Direct Line' key variable.
I've added an answers array that's empty, and a question array that we're going to Loop through.
I've added an HTTP endpoint for the 'Create a Conversation' in the 'Direct Line' API.
I then parse that.
I then send an activity to that conversation that I created.
So, I use the conversation ID that was generated from the previous call. I then parse the send activity, and the response that I got from that. Which is just an ID of that activity.
So, we submit our question that submits an activity for the Copilot to process. Then I go and get the activities from this conversation. Which is going to be a list of user, and then a bot response. So, I take that bot response, I parse it, and then grab that and append it to the array. At the end of that I can see my list of questions and their answers.
Now that the flow has run, and I have my questions and their answers; I can see it took about 11 seconds for that to run. I have a delay in there just to let the Copilot actually process the question. I do 3 seconds. And, then in my answers array I can see the question and its answer.
Pretty awesome.
All right, so that's all I have for you today. I know that was a quick demo, but I hope you learned a lot about the capabilities of 'Direct Line' and Copilot. It certainly opens up some possibilities when building a Copilot from Copilot Studio.
I hope you all have a great day, and happy power platforming!