Knowledge Base Search
A guide to the Knowledge Retrieval action for finding relevant information within your datasets.
The Knowledge Retrieval Action (internally known as knowledge_retrieval
) allows you to perform a powerful "semantic search" across your private Datasets. Instead of just matching keywords, a semantic search understands the meaning and intent behind your query, allowing it to find the most conceptually relevant information, even if the exact words aren't used.
This is the core of Retrieval-Augmented Generation (RAG). Use this action to:
Find the most relevant internal documents to answer a specific question.
Provide context to an LLM so it can answer questions based on your private data.
Power a customer support bot that uses your help articles to find answers.
How It Works
First, you must create a Dataset in AgenticFlow by uploading your documents (e.g., text files, PDFs, markdown files). AgenticFlow processes these documents, breaking them down into chunks and creating "embeddings" for each chunk—a numerical representation of its meaning.
When you use the search action, it creates an embedding for your query and then compares it to the embeddings of all the chunks in your Dataset to find the best matches via a similarity search API.
Configuration
Input Parameters
Dataset
Select
Choose the specific Dataset you want to search from the dropdown list. This corresponds to a unique dataset ID.
Query
Text
The question or search term you want to find information about. This can be a full sentence.
Top K
Number
The maximum number of documents (chunks) to return. Defaults to 5.
Output Parameters
documents
Array
An array of document objects that are most relevant to the query. Each object in the array has a specific structure.
A single document object in the documents
array looks like this:
Example: Answering a Question with a Dataset
Let's say you have a Dataset containing all of your company's internal HR policies. You want to build a workflow that can answer employee questions.
Get the Question: The workflow starts with a Text Input action where an employee asks a question, like:
"How many sick days do I get per year?"
Configure the Knowledge Retrieval Action:
Dataset: Select your "HR Policies" dataset.
Query: Connect the output from the Text Input action:
{{text_input_action.output}}
.Top K:
3
(to get the three most relevant policy documents).
Provide Context to an LLM:
The output of the action will be an array of document objects, available at
{{knowledge_retrieval_action.output.documents}}
.Connect this output to an LLM Action.
Set the LLM's prompt to correctly iterate through the documents and extract their content:
This workflow doesn't just guess the answer; it finds the relevant, up-to-date information from your private datasets and uses it to construct a factual, reliable answer.
Last updated
Was this helpful?