Knowledge bases
Knowledge bases are collections of documents that your copilot uses to answer user queries. They are crucial for ensuring that your copilot performs well and provides accurate, domain-specific information. Typical knowledge bases include:
- Product documentation
- Marketing materials
- Support knowledge bases
- Real-time user and application data
Continual generates a semantic index of knowledge base documents, allowing copilots to quickly retrieve relevant information before responding to a user.
Overview
Continual supports two types of knowledge bases:
Managed knowledge bases
Continual automatically updates documents pulled from external sources like websites or databases every hour, day, or week. You can also sync the knowledge base manually.
Supported managed data sources:
-
Website - Enter links to product documentation, public knowledge bases, blogs, or other web-based information sources.
-
Cloud Blob Storage - Sync a cloud bucket with a Continual knowledge base. Supported providers:
Unmanaged knowledge bases
Documents are added, updated, and deleted freely without any source constraints. Continual automatically indexes the provided files but does not sync them with an external source.
Supported unmanaged data sources:
-
Files - Upload PDF, text, CSV, YAML, or JSON files. Files are converted into Markdown (opens in a new tab) format and can be edited in the Continual console.
-
Excel/CSV Spreadsheets - Each row maps to a single document in Continual:
Column Required? Description Name Yes Document title Content Yes Document content PublicURL No Allows copilot to provide public reference links in answers PrivateURL No Allows copilot to provide private reference links in answers Metadata1...N No Additional metadata columns (author, dates, content owner, etc.)
Improving performance
There are several ways to improve the performance of your knowledge base.
Monitoring
Continual provides insights into how your knowledge base is being used, such as:
- Statistics on which copilots are using the knowledge base
- Query relevance, speed, and frequently referenced documents
- Insights for content managers to learn what users want to know
Best Practices
Create an FAQ knowledge base
Many times, your existing product documentation or knowledge bases may not cover questions that users often ask. To address this, you can create a knowledge base dedicated to "Frequently Asked Questions."
For optimal query performance, store each question-answer pair as a separate document with the question as the document name and the answer as the document content. This helps the copilot easily find potential answers to user questions and also allows you to easily see which questions are commonly referenced.
As you move into production, you can identify unanswered questions using our monitoring tools and add them to the FAQ knowledge base.
Index both application and user data
To provide timely and precise responses to user queries, you should consider indexing real-time application and user data, instead of only providing it through a tool. This allows the copilot to more efficiently find and combine information.
Make sure to employ metadata filtering to ensure that users only see the information they are authorized to access.
Include specialized, domain-specific knowledge bases
The value your copilot offers increases when you include specialized data that's unique to your domain or product.
For instance, if your application serves the real estate market, you might consider adding a knowledge base filled with information about the various properties listed on your platform.
Metadata filtering
Metadata filters restrict document access based on user, group, team, department, company, or context. The copilot can only access documents relevant to what the user is currently viewing.
By default, knowledge bases are always included in copilot retrievals but can be filtered by a signed JWT grant or client filter if a matching metadata field is provided. Private knowledge bases require a signed JWT grant to be retrievable.
Applying metadata to documents
Set metadata automatically on upload/ingestion or manually in the UI:
-
Manual - Edit document, set metadata key and value, save
-
Automatic
- Cloud Bucket: Sync tags from buckets, folders, and files
- CSV: Additional columns after Name and Content are added as metadata
- Website: Capture metadata fields (title, author, keywords, etc.) from webpage
- Files: No automatic metadata
Applying metadata filters from a copilot
Set filters in your copilot widget client-side or as a JWT grant.
- Client-side - Ad-hoc filters based on user's current application location
<CopilotProvider datasetFilters={{"mydatasetid": {metadata_key: metadata_value}}}>
{...}
</CopilotProvider>
- JWT Grant - Securely filter documents by user or group
const generateUserAccessToken = (userId, copilotId, copilotSecret) => {
const algorithm = "HS256";
const ttl = 86400;
const payload = {
grants: {
identity: userId,
datasets: { mydatasetid: { my_metadata_key: my_metadata_value } },
},
};
const header = {
typ: "JWT",
alg: algorithm,
};
const signOptions = {
header: header,
issuer: copilotId,
expiresIn: ttl,
};
console.log(typeof copilotSecret);
console.log(typeof signOptions);
return jwt.sign(payload, copilotSecret, signOptions);
};
Testing metadata filters
Test metadata filters in the Continual Console Playground:
- Set metadata on connected knowledge bases.
- Set client filters by clicking Impersonate.