How to Use SharePoint Knowledge Base in Copilot Studio for RAG Implementation

As I begin learning about Copilot Studio, I’m documenting my findings.

In this article, I’ll explain how to generate responses using RAG by accessing SharePoint knowledge directly from topics.

スポンサーリンク

Previous Implementation Using “Conversational Boosting” Topic

In my previous article, I demonstrated accessing SharePoint knowledge using “Conversational boosting” and “orchestration.”
Screenshot showing previous implementation with Conversational boosting

While this approach works well for simple agents, it becomes limiting when dealing with multiple knowledge sources, especially when you need to selectively use specific knowledge bases for particular types of questions while excluding others.

For such scenarios, we can achieve better control by using “Topics” combined with “generative responses.”

The Agent We’ll Create

We’ll start with an agent that has the “Use AI in conversation” setting turned off.
Screenshot showing agent configuration with AI conversation disabled
We’ll create a sample implementation using this SharePoint site, where the agent will exclusively use this knowledge base when responding to vacation-related queries.
Screenshot showing SharePoint site with vacation-related knowledge base

Implementation

First, select [Add topic] from [Topics],
Screenshot showing how to add a new topic
Configure vacation-related trigger phrases (these are simplified examples for this demonstration).
Screenshot showing trigger phrase configuration
Next, add a [Generative response] from [Advanced],
Screenshot showing how to add generative response
Set the system variable “Activity.Text” (the user’s last sent message) as input.
Screenshot showing Activity.Text configuration
In [Properties], check [Search only selected sources] and turn OFF [Use AI’s general knowledge].
Note: This prevents the AI from retrieving information from unspecified knowledge bases or using its own knowledge (differences in behavior are detailed in the bonus section).
Screenshot showing knowledge source settings
Scroll down to turn ON [Send message] (this node will handle user responses), select [Create new] from [Save response],
Screenshot showing message settings
Save the generative response output to a variable (in this case, “response”).
Screenshot showing variable configuration
Then add a “Condition”,
Screenshot showing condition addition
For the text output from the generative response (Text.Content or Text.MarkdownContent),
Screenshot showing text output configuration
Perform a blank check and send a “Information not found” message if blank.
Screenshot showing blank check configuration
Finally, add [End current topic] to complete the implementation.
Screenshot showing end topic configuration

Testing the Implementation

Turn ON [Cross-topic tracking],
Screenshot showing cross-topic tracking setting
When you send a question matching the trigger phrases, the trigger activates,
Screenshot showing trigger activation
The [Generative response] then searches the specified data source and creates a RAG-based response.
Screenshot showing RAG response generation

By carefully managing which data sources to use for specific topics, we can potentially create agents with higher response accuracy.

Bonus 1: When Information is Not Found in Data Source

For example, if we add trigger phrases for questions that have no information in the data source (though you probably wouldn’t do this in practice),
Screenshot showing trigger phrase configuration for questions without data
When such a question is asked, the generative response text will be empty, and the configured fallback message will be sent.
Screenshot showing empty response handling

Bonus 2: When “Allow AI to Use its General Knowledge” is Enabled

If we enable the “Allow AI to Use its General Knowledge” option that we turned off during setup, and ask a question about special leave (which isn’t in our data source),
Screenshot showing AI general knowledge setting
The AI will generate a response using its own knowledge base. Whether this is beneficial or detrimental depends on your specific topic requirements.
Screenshot showing AI-generated response using general knowledge

Related Articles

コメント

Copied title and URL