RAG Query Skill

Perform Retrieval-Augmented Generation on a private knowledge base (RAG Container)

While a regular LLM is great for general knowledge, what if you want it to answer questions using your company's specific data (like policy manuals, internal documents, or product catalogs)?

The RAG Query Skill is your workflow's knowledge-powered assistant. It allows you to ask a question, and it intelligently searches your private knowledge base (a "RAG Container") to find the most relevant information before generating a precise and fact-based answer. This ensures your AI Agent's responses are not only helpful but also accurate and grounded in your own data.

Answering Financial Advisors' Policy Questions

Imagine your AI Agent is used by financial advisors who need quick answers to complex questions about internal lending policies. Instead of searching through long, technical documents, they can simply ask the Agent in natural language, like "What is our policy on SBLOC loans for new businesses?"

The Challenge:

Your internal policy documents are too long for an LLM to read in a single prompt. A simple search might not understand the advisor's intent.

The Solution:

By using a RAG Query Skill, you can send the advisor's question to a RAG Container that has been pre-loaded with all your policy documents. The node will automatically find the most relevant sections of those documents and use that information to generate a correct, policy-based answer.

Setting Up the RAG Query Skill

Let's walk through how to set up this Skill to answer a financial advisor's question.

  1. Locate the Skill: Drag and drop the RAG Query Skill onto your Workflow Builder canvas. Place it at the point where you need to answer a question by using your knowledge base.

  2. Configure "RAG Container ID": First, choose the knowledge base you want to query.

    • Click on the RAG Query Skill to open its configuration panel.

    • In the "RAG Container ID" dropdown, select the ID of the container that holds your policy documents.

  3. Define "Instruction to LLM" (System Message): This sets the tone and role for the AI.

    • In this field, you can give instructions like: "You are a helpful and knowledgeable financial policy assistant. Provide clear and concise answers based on the provided context

  4. Set the "Query": This is the question you want the RAG Query Skill to answer.

    • In the "Query" field, use the output from a previous Skill that contains the advisor's question. For our use case, you would enter $input.userQuestion (assuming userQuestion is the field containing the text).

  5. Add "Filters" (Optional): This allows you to pre-filter the search to be more specific.

    • In the "Filters" field, you can provide a stringified JSON object to narrow down the search. For example, {"loan_type": "SBLOC"} would only search within documents tagged for that loan type, making the result even more accurate.

  6. Advanced Configurations (Optional):

    • Response Format : You can choose to get the answer as text or as a structured JSON object for use in other nodes.

    • Temperature: Controls the creativity of the response. Lower values (e.g.,0.2) are better for factual, grounded answers.

    • Num of Conversation Turns: Allows the LLM to consider previous messages for conversational context.

Understanding the Outcome:

After the RAG Query Skill runs, it provides a comprehensive, fact-based answer from your data.

  • content: The final, generated answer from the RAG container, in either text or JSON format.

  • statusCode: A number indicating the result (200 for success, 400 for a bad request, 500 for an internal error).

By using the RAG Query Skill, you turn your private documents into a powerful, searchable knowledge base for your AI Agent, enabling it to provide accurate, reliable, and contextually relevant answers every time.