hey everyone in today's video um I want to show you how you can use generative answers on SharePoint list um so as of today uh the native SharePoint integration for generative answers only covers SharePoint sites but does not include uh SharePoint list also there is no um direct semantic search API available uh for searching data that is within your SharePoint list so for today's demo I will show you three different design patterns um that you can use to reason over your data within um SharePoint list uh these same design patterns can be used on any custom data source that allows um searching for data using a restful API uh one thing to two things to keep in mind when um selecting the right design pattern is um first you want to make sure you understand how your data is structured within your data source and then the second most important thing that you want to keep in mind is what outcome do you want your co-pilot to achieve uh when the bot is making the search so let me explain this with an example uh just to make it easier to understand so for today's demo I have two SharePoint lists so I have a leave request application so this list basically tracks all the uh requests from employees for leave um you can see that every request has a unique identifier or unique ID uh that I can use to identify each request uniquely so for the first scenario where I want my co- Coop Copilot to uh allow employees to search for um the leave request application status I can actually ask employees to provide the Le request ID and then provide them with the updated status so if I go back to copilot studio um you can see here um I have a um option for checking the leave status so employees would click this and then the co-pilot would prompt them to enter their leave request ID so in this case if I put eight what this does is it will uniquely identify the record in that list and then create a um answer uh along with link to that specific record so if I click on this link it takes me directly to that specific record within that list um and here you can see it has provided me provided me with the latest status and and um the way I have done this is I have a topic called check leave status um which gets triggered when I request uh for uh status update and then I have a plugin which is basically using a power automate flow to get the data from uh SharePoint list so going back to the power automate flow um this is how I have designed the power automate flow where I take in the request ID then I'm using the get items action uh which allows me to search for a specific uh record within the list so in this case I want the ID to be equal to the request ID that is provided by the user and then I just format the data and pass it back to the chatbots so now within the chatbot once I have the response back from the plugin I just format it in a way such that I can use it on generative answers node so if you look at this it's using a custom data source so custom data source could be any um data source that you would like to use um that is not covered by uh Native Integrations uh that are supported on copilot studio for example SharePoint public website uh or one drive locations are natively supported uh in EV in an event you want to integrate this with any other data Source you could just use this custom data source um uh to provide the data and then generative answers would use that um to create a summary um just to show you how this has to be configured so you can see here um I have a custom data uh Source that's being past here so you need to create a variable that is in a table structure um and then just pass it here and then uh you can provide any custom instructions uh to format the response so in this case I'm saying your employee assistant chatbot answer in a friendly Manner and then I'm providing an example of how I want the response to be structured so that's the first scenario which is pretty straightforward because we are able to uniquely identify each record in the list um and using the power automate list item action I can easily pull that record as long as I have unique identifier um available within as part of my uh topic or conversational flow okay so now for second scenario um I'm going to use a different list uh it's called FAQ tracker and this has question answer pads um so this would be um similar to uh any of your uh list that tracks uh frequently asked questions or policies or procedure kind of a kind of list where you have question and you have a response um one key thing to keep in mind is every time you have a multi-line column within SharePoint list it does not allow you or power automate flow does not allow you to use that um column to do any kind of um searching or filtering uh your filters can only be applied on a single line column so with that in mind um the second design pattern uh that you can use is you want to Target a column that can basically uniquely identify each record within your data sets so in this case you can see each of these each of these questions are unique so I can use this title column to search and uniquely create a response pack um So based on users questions or utterance I will understand the intent of that question and then search only in um this specific column to see if there's a match if I find a match then I can pull in all the details or all the other columns associated with that specific record so so let's see an example here so if now I go back to my um chatbot uh and I'll restart here so this is the second scenario where I'm searching on a list that has a lot of text based columns so in this case I'll say list search and I can ask a question like can I use corporate credit card to buy tickets for my family and what this does is it will trigger the right topic it will call a power automate flow and then create a response along with link to that specific record um one key thing to highlight here is if you look at the question from the user this question does not match the data that's within this column right the key here is to understand the intent and not just simply do a string match or textt match so for that what I have done is I am making use of a topic so you can see every time the user is asking a question it triggers it captures the user's question or utterance and then it's using this flow um which I'll show you now here which passes the question that user has asked then I'm using a using the prompt Builder Within co-pilot Studio or Power Platform to understand the intent of this question so in this specific example where I asked a question um it will uniquely identify what the intent of that question is so if you look at that question here it's asking can I use my corporate credit card to buy tickets for my family so that this prompt um helps me understand the intent and then extract the information that I need uh just to show you how I created this prompt you can see here's an example um of the prompt that I have created so I'm saying uniquely identify product software name building name historical event cost City and person from the given text and then I have um provided some examples so this is an example of one shot prompting where you have an example so that the model understands what information to extract from a given given text so using this prompt I'm able to understand the intent of the question um and then I'm using the get items uh action within power automate to search for that specific text within this list that I showed here with so using that text I'm searching this column and then getting the response back so this is scenario 2 where um I'm first understanding the intent uh you can see here understanding the intent of the question using a prompt and then using that int intent to filter the result from the SharePoint list once that's done I just format the data and send the record details back to copilot and over here again I'm using the um custom data source So within generative answers I have configured a custom data source that allows me to format my answer and provides a link to the exact record that user can then uh go to uh if they need to update or check any information so that's scenario number two so the key thing to keep in mind for this uh scenario is the search is targeted on a specific column which is very unique uh so every question in this uh column is unique and then you also can identify the intents or intent associated with each question so as long as you can do that um you can use this uh second design pattern where you can Target a specific column um to uh provide a response based on the intent of the question but there might be scenarios where you might have multiple columns that you would like to Target and all of these columns might be multi-line text um so in that scenario where you want to uh reason over a SharePoint list that has um multiple multi-line text columns uh you need to make use of uh graph API so that's going to be your scenario number three where um you can search across any column within your SharePoint list so in this example if you look at um this column here called content um this has M multi-line text and what I'm going to do is I'll ask a question that is related to or the information is available within one of these um rows here within the content column but the there's no way for your co-pilot to uniquely identify the record so in this case so if I go back to my um co-pilot here I have a action that allows me to search using graph graph API and for this what I can do is I can ask uh something like victory in the American Revolutionary War um when I ask this question you can see that this information is with within one of the rows with um within the content column um but there's no direct question that is associated with um with this text so in this case you can see here um it's providing me a response along with the um link to a specific uh row um and if I go back and open this record you can see the content um column here has reference to uh this text here so this is how it was able to uniquely identify a specific row within the list so same way if I want to ask a different question so let's uh look at this so I'm going to click on graphly search and this time I'll ask what is the contribution of native Egyptian agriculture laborers so this text is within one of the rows within that content column but there's no direct reference to this text so what we are trying to do is understand the intent of users utterance or users question and then once we have the match on the intent it will search across the entire SharePoint list um to provide a summary and then list all all the records that match um that intent so in this case if it had to pull uh from multiple columns you would see multiple links but since it's pulling from a single column uh or single row um we have only one link so if I click on that link it will take me directly to that specific record record where um we have reference to uh Native Egyptian agricultural laboras so this is how you can use graph API uh to optimize your search uh when you're working with a SharePoint list that has multi multiple multi-line columns um the advantage of this third design pattern is you're not restricted to a single column um you can search across entire um SharePoint list to find the informations um so just to show you how this has been designed again I have a separate topic which is used use every time I call that action um so this topic gets triggered uh I have a flow so if I go back to the flow here um this flow is slightly lengthy because of all the manipulation you have to do to get the data in the right uh format so you can see I'm passing the users question here um and then I have initialized bunch of variables but the key actions here is first I'm making use of the same prompt that I showed you so that I can understand the intent of the question then I'm calling the graph API um and then searching with the intent rather than user's question um so in this case uh I'm using the extracted information from users question um and then once I have the response back I use um all these U actions within the flow to format it in a way that I can pass it back to co-pilot once the answer is um found uh I just make use of the generative answers node uh in this case again the data source is custom data because we are working with um a restful API so in this case it's a SharePoint list but this same design could be applied to any other data source uh so as long as you format your result correctly so just to show you here's an example so this is um this is the format that it expects so you can see this is how you can create the uh table that needs to be passed to this um generative answers node um and once you pass that um you can use the custom instructions in in case you want to format the response in a in a uh certain tone or uh you want to give it an example uh you can do that using custom instruction so um that's how you can make use of um any data source in order to uh create a summary and also provide a reference to the original data source um the last thing that you have to keep in mind is when you're working with custom data source um you can only provide the top three results from your search query uh to this gener generative answers Noe if your table that you create here has more than three rows um it will only look at the top three hits or top three uh search results and exclude any information that um that is not part of the top three hits so that's something you have to keep in mind so making sure your search is optimized is going to be key when you are working with custom data source so these were the three different design patterns I wanted to share since um we get a lot of questions around um integrating co-pilot with with SharePoint list um I hope this was useful uh if there are any questions uh feel free to reach out to me thanks for watching bye