Guides
Using the Knowledge Library
Guidelines to using the Knowledge Library
Overview
The Knowledge Library allows you to store unstructured information for use by an AI Agent.
The information can be anything from a simple text document to PDFs and Word documents.
To use the Knowledge Library effectively, you need to understand how to structure and organize the information.
Categorization
The first step in using the Knowledge Library is to categorize the information. You have various methods to categorize the information:
- rooms and shelves
- tags
- hierach paths
- custom data
The most commonly used is the rooms and shelves method. This method allows you to categorize the information into broad categories and then further into subcategories.
Recommended Retrieval
To achieve the best results for retrieval you should use as many strategies as possible.
Using only a basic retrieval strategy by passing the question from the user to directly into the search is not always the most effective.
The most effective way to retrieve information is to use a combination of strategies.
- Use the input
ai_enrich
param to generate an enriched piece of text combining the user's question with some additional context about the use case. - Then set the output
limit
param to a higher number to increase the chances of finding the correct information. (typically 8-16) - Then use the output
rerank
param to rerank the snippets based on the user's question. This will order the most relevant snippets first. Use a lowerrerank.limit
for the reranked snippets, typically 4-8. - Then use the output
ai_summarize
param to generate a response from the reranked snippets. This will generate a response that is more likely to be correct. - Finally you can pass the response to the conversational AI Agent to generate a response to the user.
See the Search Knowledge Library Task for more information on how to search your libraries.
Input AI Enrich
The ai_enrich
param is used to generate text that will have a higher chance of matching the information in the knowledge library.
There are 2 main ways that you can use an LLM to generate better matching text.
Enriching Text
You ask the LLM to enrich the text with some keywords or context from the conversation so that you have more information to match against.
This is especially useful when the user's question is vague or ambiguous.
Crafting an exmple You can ask the LLM to craft an example of the information that you are looking for. For example you ask the LLM to generate an example of a piece of documentation that explains how to use a particular feature., this then matches better against the actual documentation in the library.
Output Rerank
The rerank
param is used to reorder the snippets that were returned from the knowledge library based on the original user's question.
This is especially useful when you have used ai_enrich
to generate an enriched piece of text. The snippets returned from the knowledge library may not be returned with equal relevance, so you can use the rerank param to reorder them based on the user's question.
You can also set the text to rerank against, which is usefull if you want to rerank against the original user's question or against the enriched text.
The text that you rerank against can also be a concatenation of the user's last message as well as some contextual data.
Output AI Summarize
The ai_summarize
param is used to summarize the answer outside of the main conversation, this is usefull to keep the conversation focused on the main topic and save on LLM tokens.
Beware as some information and context might be lost in the summarization process.
- You can inject the original user question into the
ai_summarize.system_prompt
to help guide the summary that will be generated. - You can concatenate the original user question and some contextual data about the question.
All these strategies can be used in combination to generate the best response to the user's question.