Upload documents as a source for generative answers (preview) in Copilot Studio

If you attended Microsoft’s Power Platform Conference this month, then you probably heard about some of the new (preview) features that were announced for Power Virtual Agents! If you are not aware, of some of the features I’m referring to, or don’t exactly know what those features entail, then you definitely need to read this article! There are two features that are currently in preview, and I will discuss the first one in todays article. Unfortunately, you’ll need an environment that is in the US region to be able to test this out. This feature is part of the current conversation booster capabilities, which are currently in preview. In case you’re not familiar with conversation booster, this feature went in preview in April 2023. If a customer or prospect initiates a chat and PVA can’t locate a topic to direct the customer to, it will look for information sources configured under the conversation booster to generate an answer. We could already configure the use of URL’s the bot can leverage as a source for there generative answers. (I wrote an article on how to set it up and how it works, which you can read here.) The added functionality that was announced at MPPC is the ability to upload documents as a source as well! Keep in mind both of these features are in preview today, so make sure you don’t use this in your production environment!

How does it work?

This feature is super easy to configure, as the only thing you’ll need to do is upload documents in the AI capabilities section in Power Virtual Agents. You can navigate there by clicking on Settings > AI Capabilities and scrolling down until you see the ‘Upload a document’ section below ‘Bot content moderation’. The total number of documents you can upload here is 100 documents. You can start uploading the documents either by dragging and dropping the files or you can click on ‘click to browse’ and select the documents you want to upload from there. It’s important to understand that the individual files shouldn’t be larger than 3MB. If you have files that are larger, it might be a good idea to break them out in multiple, smaller documents.

All the files that you upload here will be stored in Dataverse, which also means that you will need enough storage in Dataverse in order to store the documents. Please note that all uploaded documents will become part of the PVA solution, which means all uploaded documents will be included when the solution is exported/imported.
Another thing that you should be aware of is that the uploaded docs will not be restricted by any security, which means that uploaded file content is available to anyone chatting with the bot, regardless of file permissions or access controls. I’m hoping that we’ll get some control of this at a later stage, but we will have to wait and see. Image files, videos, audio files etc. are not supported. The document types that are supported for upload are:

  • Word documents (doc, docx)
  • Excel spreadsheets (xls, xlsx)
  • PowerPoint documents (ppt, pptx)
  • PDF documents (pdf)
  • Text documents (.txt, .md, .log)
  • HTML files (html, htm)
  • CSV files (csv)
  • XML files (xml)
  • OpenDocument files (odt, ods, odp)
  • EPUB documents (epub)
  • Rich Text Format documents (rtf)
  • Apple iWork documents (pages, key, numbers)
  • JSON files (json)
  • YAML files (yml, yaml)
  • LaTeX files (tex)

Once the document(s) are uploaded, you’ll see the all these documents’ name and size. From here you have the option to download the document or even delete it if you want to remove it from the bot. Keep in mind that if you upload multiple documents with the same name, the original file will not be overridden, which can result in duplicate files. The best way to handle this is either to give the document another name or to add a document version number to the title. Another thing I want to mention is make sure you wait a few minutes after the upload of the documents, as the files need to be indexed before they can be used by Power Virtual Agents.

Exclude documents from generative answers node

As you might or might not know, we can create additional topics with generative answer nodes. All documents that are uploaded are used as a data source for all topics with generative answer nodes in Power Virtual Agents by default. However, if you have the need to exclude documents (and I mean exclude ALL DOCUMENTS) from a generative answer node, (maybe because you only want to use URL’s), there is a way to do that. You’ll have to open the topic that contains the generative answers node, and open the code editor. You can do that by clicking on the three dots in the top right corner of the screen, and selecting ‘Open code editor’.

As you can see on the screenshot above, you’ll need to enter a few lines of code below the line that reads: “variable: Topic.Answer“. I tried copying and pasting it in, but it seemed to only work when I manually typed out the code shown below.

fileSearchDataSource:
    searchFilesMode: 
       kind: DoNotSearchFiles

Make sure you save the changes you made and give it a few minutes before you test! I hope you enjoyed reading this article! Be sure to check in again next week for a new article or subscribe here to never miss another post!

Share this!

Comments are Closed