Template Guidelines
Knowledge Library
Explains how to organize Knowledge Library content and design retrieval so an AI agent can use large amounts of unstructured text.
The Knowledge Library stores unstructured information for an AI agent to use, such as plain text, PDFs, Word documents and other document-based content. See Using the Knowledge Library for how to add and manage articles.
Getting good answers from it depends on two things:
- how the content is organized
- how the content is retrieved
Good organization improves search precision, and good retrieval configuration improves answer quality.
Organizing content
Organize content using rooms and shelves:
- rooms for broad categories
- shelves for narrower categories within a room
Group content the way the AI agent will need to retrieve it later.
Recommended retrieval pattern
A direct search using only the user's question is often not enough. A stronger pattern is:
- use
ai_enrichto improve the search query - use a broader initial
limit, typically8to16 - use
rerankto reorder the results by relevance - use
ai_summarizeto condense the best snippets - pass the result back into the main AI conversation
This improves recall first, then precision.
ai_enrich
Use ai_enrich when the user's wording may not closely match the wording in the stored articles. It can:
- expand the user's question with keywords and contextual phrasing
- generate an example of the kind of content likely to contain the answer
This helps most when the user's question is vague, or when the stored content uses different terminology.
rerank
Use rerank after the initial retrieval to improve the order of the returned snippets. It is especially useful when ai_enrich broadens the query and a wider set of candidate snippets comes back.
ai_summarize
Use ai_summarize when a concise result would help the main conversational agent. It:
- keeps the main conversation focused
- reduces token usage
- gives the AI agent a cleaner result to work with
Summarization can lose detail, so use it carefully when nuance matters.
Implementing retrieval in a template
When you add Knowledge Library retrieval to a template:
- use the
search_knowledge_librarytask - filter to the correct
roomandshelfwhere possible - use
ai_enrichto improve recall - use a broader initial result limit
- use
rerankto improve relevance ordering - use
ai_summarizewhere a concise result is useful - return only the data that is useful to the AI agent
Recommended workflow
- Decide what knowledge the AI agent needs.
- Organize it into sensible rooms and shelves.
- Create and manage the articles in the Knowledge Library.
- Store and publish the articles.
- Implement retrieval in the template.
- Test retrieval quality with realistic user questions.
- Refine the article structure or retrieval configuration if needed.
Flowpilot can help you plan rooms and shelves and build the retrieval actions, but you create, upload, edit and publish the articles yourself in the Stubber Platform.