Tasks
Search Knowledge Library
Searches through your knowledge library.
Overview
This task allows you to search for snippets from knowledge library articles.
Typically you'll supply a query in text and the task will return matching snippets from any articles in the rooms & shelves that you specify.
This task allows building AI Agents with access to large amounts of information and documents.
See the debug block for a visual way to debug this task.
Basic usage
Search all of your knowledge library articles for ~~stubpost.message.
Parameters
branch required string
the branch to search in
query Object
the query to search with
Show child attributes
text_small Object
the text_small query, corresponding to the text_small vector
Show child attributes
content required string
the string/text content of the text_small query
ai_enrich Object
optional configuration for enriching the text_small query with AI
Show child attributes
model string
the model to use for the ai_enrich
Default: gpt-4o
system_prompt string
the system prompt used to enrich the query
enabled Object
whether to enable AI enrichment of the query, allows for easy toggling of AI enrichment.
If undefined, AI enrichment will still be applied if the system prompt is set.
filter Object
allows filtering of the search using arbitrary data
Show child attributes
by_article Object
allows filtering by article
Show child attributes
articleuuids string Array.<string>
filter by one or more articleuuids
by_categorization Object
Show child attributes
knowledge_library Object
filter by knowledge library categorization
Show child attributes
enabled boolean
whether to enable the knowledge library filter
libraries string Array.<string>
the libraries to filter by
rooms string Array.<string>
the rooms to filter by
shelves string Array.<string>
the shelves to filter by
by_score Object
filter by score
Show child attributes
min_threshold number
the minimum score threshold for the search
return Object
the return configuration, controls what data this task returns
Show child attributes
limit number
the maximum number of results to return
rerank Object
optional reranking configuration for the returned results
Show child attributes
enabled boolean
whether to enable reranking
query_with string
which query content to use for reranking, one of text_small or ai_enrich, defaults to text_small
limit number
optional limit for how many snippets to return after reranking
results_array_key string
the key to use for the results array in the return payload
debug boolean
whether to return debug information
item_structure Object.<string, string> string
allows modifying the structure of the returned items using variable substitution
Each matching snippet is available under the ~~with key, example ~~with.payload.snippet.text_small.content
articles Object.<string, string> string
when set, a full copy of each of the articles that matched the query will be temporarily attached to the payload
To attach the full article with all branches, use ~~with else, you can use ~~with.branches[~~params.branch].content.text to get the full text of the relevant branch
ai_summarize Object
optional configuration for summarizing the results with AI, see ai_summary
Show child attributes
model string
the model to use for the ai summary
system_prompt string
the system prompt used to summarize the results
By default, the results_array_key elements are appended to the system prompt.
You can override this behavior by adding your own interpolation to the system_prompt, ex:
Summarize the relevant snippets based on the user's question\n\n{{#to_json_string with.articles}}{{/to_json_string}}
As you can see, you have access to ~~with.articles if you provided return.articles.
Also have access to ~~with.<results_array_key>
Result
Properties
results Array.<Object>
an array of matching points that were found.
if params.return.results_array_key is set, the results will be under that key instead of results
Show child attributes
score float
how closely the snippet matched the query
payload Object
object containing additional data that was stored along with the point
Show child attributes
article Object
contains info about the article this snippet came from
Show child attributes
articleuuid string
the unique identifier for the article
categorization Object
categorization details for the article
Show child attributes
knowledge_library Object
Show child attributes
library string
what library the article is in
room string
what room the article is in
shelf string
what shelf the article is in
details Object
Show child attributes
name string
the name of the article the snippet belongs to
data Object
any additional data stored with the article
snippet Object
represents a small part of the article that matched the query
Show child attributes
text_small Object
Show child attributes
content string
the piece of text that matched the query
hash string
the hash of the text that matched the query
ai_summary Object
object containing the summary of all results, only returned if return.ai_summarize is set
Show child attributes
content string
the summary of all results
debug Object
if return.debug is set, this will contain debug information.
This can be useful to inspect the internals of the task, and is required to use the search_knowledge_library_debug block.
Examples
Advanced usage of ai_enrich, filter and return params
Result
Pass entire article to ai_summarize
Result
Search specific shelves or rooms using string substitution
Result