• IDD
  • IDD
  • Skybuffer AI
    • Skybuffer AI Installation and Initial Setup
      • On Business Technology Platform (BTP)
        • Skybuffer AI Installation Guide on BTP
      • On Premise: XSA Runtime and SAP HANA EE
        • Installing SAP HANA Including XS Runtime
        • XS Deployment Process
      • Post Installation User Guide
    • AI Agent
      • AI Agent Configurator
        • Register New AI Agent
        • Intents and Entities Creation
        • Skills Creation and Management
          • Standard Action Types
          • Generative AI Action
          • RAG Action
        • Scheduling
        • Communication Channels
          • Webchat Communication Channel Setup
          • Facebook Messenger Communication Channel Setup
          • Zoom Communication Channel Setup
          • MS Teams Communication Channel Setup
          • Slack Communication Channel Setup
          • Telegram Communication Channel Setup
          • Viber Communication Channel Setup
          • WhatsApp Communication Channel Setup
          • AI Agent Communication Channel Setup
        • Monitor Section
      • Destination Management
      • AI Translate
      • Survey Craft
      • Identity Providers
      • Business AI Scenarios
      • ML Models Hub
      • RAG Document Hub
    • AI Connector
      • AI Connector Configurator
      • AI Connector Logs
      • AWS Integration
      • Google Services Integration
      • Twilio Integration
      • Yandex Services Integration
    • SAP Backend for Business AI
      • Business AI Scenarios Package Administration
        • Installation Guide
        • Uninstallation Guide
      • Business AI Scenarios Package Maintenance Guide
        • Product License
        • Configuration of Email Sending Mechanism
          • Configuration Settings
          • Setup of Specific Email Sending Control
        • Technical User Setup
          • Central oData Service Authorization Role Maintenance
          • Technical User ID Creation
        • Assigning Business AI Scenarios to ABAP RIK Classes
        • Simplified User Creation Scenario Setup (Without Approval Workflow)
          • Maintain and Assign Reference Users for User Creation Scenario
          • Activate Notification for New User Creation (Optional)
        • User Creation Scenario Setup with Approval Workflow
          • Configure Approval Workflow for User Creation Scenario
          • Set Up Approval Steps for Different User Types Creation
    • HOW-TO Guides
      • SAP AI Core Integration. Ollama Server Setup
      • MS SharePoint Integration. Add-in Registration
      • MS Teams Integration. Single Sign-On
        • Create Azure Bot Service
        • Configure Azure Bot Service and Connect to Bot Management App
        • Create Middleware SSO Application
        • Configure Bot Service Application SSO
        • Create Azure AD Enterprise Application for SAP Backend
        • Configure oAuth2 in SAP System
        • Assign Identity Provider and Push Nodejs Configuration
        • Deploy Your App into Microsoft Teams
        • Managing Application Keys
    • Troubleshooting
      • Edge Browser Access Issue
    • Hybrid Chats
      • Hybrid Chats Maintenance Guide
        • Business and Technical Users Setup
          • Create Business and Technical Users
          • Create Business Partners
        • Tenant Configuration
        • Live Pool Management and Configuration
          • Start Live Pool
          • Manage Live Pool
        • System Configuration
          • Configure Status Profile
          • Set Up Technical Messages for Hybrid Chats
        • Hybrid Chats Configuration
        • Hybrid Chats Categorization
          • Categorization Management
          • Categorization Mapping
          • Translate Categories
      • Hybrid Chats User Manual
        • Hybrid Chats
          • HC Archive Mode
          • HC Active Mode
        • HC My Data
          • Edit Personal Data and Profile Picture
          • Default Settings Management
          • Notification and Dialogue Manual Mode Management
          • Quick Replies Management
            • Standard User Mode - Quick Replies
            • Administrator User Mode - Quick Replies
        • HC Analytics
          • HC Analytics
          • Operator Activity Analytics
          • Exit Survey Analytics
        • HC Teams
          • Access HC Teams Application
          • Create New Team
          • Create New Team Member
          • Edit Agent
          • Edit Team Name

RAG Action

21 views 0

RAG Action

This Action Type allows you to browse RAG files available in your system and retrieve text fragments corresponding to your question/query.

Step 1. Press the Rag Action button at the bottom of an Action Group. New action will be created.

Step 2. Setup new action block step by step:

A – Help Dialog

For guidance on the action and some hints, click the Information Icon.

B – RAG Destination
You can choose between using the Default RAG Destination connection, which is assigned to the current AI Model in the RAG Settings section, or selecting a specific one from the list for this action.

C – Input Prompt
The Input Prompt is where you include the user phrase. You can enhance the {{user_phrase}} by adding additional text or memory parameters.

Example Input Prompt 1: {{user_phrase}}
Example Input Prompt 2: Answer this question: {{user_phrase}} in context of {{memory.rt_leave_request_type}}.

Step 3.  Add filtering attributes (optional):

This feature allows you to limit the RAG search by specific attributes associated with the documents in the RAG database. To filter by attributes, use the Add Condition button. You can also create advanced filtering by combining multiple conditions within Condition Sets.

NOTE: To select an attribute from the list, it must first be added to the corresponding RAG model in the ML Models Hub application.

Press Add Condition button:

A table will appear with one row filled in. Mark the checkbox on the left of the first row with AND/OR, and press the Add Condition button.

Select an Attribute, Operation, and Value from expandable lists.

You can select only Attributes and Values that are present in RAG Document HUB application and correspond with existing files.

You can use search when selecting Attribute or Value:

Example 1:

Use only documents that have:

“Line of Business” Attribute equal to “Staff” OR 

“Line of Business” Attribute equal to “HR”:

Example 2 :

Use only documents that have:

“Line of Business” Attribute equal to “Staff” OR 

“Line of Business” Attribute equal to “HR”:

AND

“Approval Date” greater than “Jan 1, 2025” AND

“Version Number” greater than 1.

Those are existing documents in RAG Document HUB after applying those filters :

Step 4. Additional Parameters.
Parameters for the RAG Destination are applied by default. You can view these parameters in the AI Model Configurator application, in RAG Settings section. To customize the AI’s behavior further, you can redefine existing parameters or add new ones using Add Parameter function.

Available Parameters:

  • chunks: sets the maximum number of text segments (chunks) that will be retrieved and used for generating a response to the user’s query. Expected Format: Integer (e.g., 3, 5)
  • max_distance: sets the relevance threshold for how closely chunks must match the query. Lower values yield more precise results, higher values include broader context. Expected Format: Integer (e.g., 30, 10)

NOTE: Changing default parameters can significantly influence the AI Model’s performance and responses. Therefore, it is recommended to proceed with caution when making changes.

Step 5. Output Memory Parameter.

The result of the RAG search will be saved as the array structure in the memory parameter specified in the  Output Parameter, rt_rag_output by default. You can change the output name to your liking.

The RAG reply structure (with default rt_rag_output parameter name):

[
    {
        "chunkText": "", // Extracted text segment (chunk) from the document matching the search criteria.
        "distance": "",  // Relevance score indicating how closely the chunk matches the search query (lower values = closer match).
        "docGUID": "",   // Unique identifier (GUID) of the document from which the chunk was extracted.
        "docName": "",   // Name of the document containing the extracted chunk.
        "link": "",      // URL or link to access the document directly.
        "ragGUID": "",   // Unique identifier (GUID) for the RAG document.
        "startPos": ""   // Starting position of the extracted text chunk within the document, indicating where the relevant text begins.
    }
]

To refer to the RAG reply structure, use the following syntax: {{memory.rt_rag_output.[n].field_name}}, where n — ordinal number of element in the array starting from 0, field_name — name of the field of the array element.

Here we display the retrieved chunks in Text Action Block:

Save your changes when done editing.

Postprocessing Hints:
Since the reply by the RAG search engine is saved in a memory parameter there is a full flexibility of referring to the RAG search results. There are several most common options of the RAG search result post-processing.

1. Raw output of RAG search results (can be added as a set of messages of text type): you can display chunks as a text message. 

I was able to find the following facts according to your search request:
**Fact number 1**: {{memory.rt_rag_output.[0].chunkText}}
**Document Name**: {{memory.rt_rag_output.[0].docName}}
**Document Link**: {{memory.rt_rag_output.[0].link}}

**Fact number 2**: {{memory.rt_rag_output.[1].chunkText}}
**Document Name**: {{memory.rt_rag_output.[1].docName}}
**Document Link**: {{memory.rt_rag_output.[1].link}}

**Fact number 3**: {{memory.rt_rag_output.[2].chunkText}}
**Document Name**: {{memory.rt_rag_output.[2].docName}}
**Document Link**: {{memory.rt_rag_output.[2].link}}

NOTE: You may format and refer to the elements of the RAG output structure as required by the specific of your business scenario.

2. RAG reply processing by Gen AI: use retrieved chunks as a source for Generative AI response.

  • Add a Generative AI Action after your RAG action.
  • Add a Processing Instruction: In the Generative AI Action, include an instruction in the Instruction field to define how the RAG results should be processed. Use the memory parameter {{memory.rt_rag_output}} to refer to RAG search results.

Instruction Template: If you need a starting point, use the template below as an example. Copy and paste it into the  Instruction field of your Generative AI Action:

Template 1:
Please create a reply to the Input Prompt using the provided chunks and output them in the following structure:
**Fact number …**: [summary of each chunkText]
**Document Name**: [docName]
**Link**: [Link]
Start with some general phrase, like ‘Here are the facts according to your request’ or similar.
There should be as many facts, document names and links as chunkText elements. If no facts, reply that nothing was found according to the request.
Facts: {{memory.rt_rag_output}}

Template 2:
Generate a consistent reply to the Input Prompt based on the chunkTexts of the following facts: {{memory.rt_rag_output}}. Don’t include any additional information in the reply.

NOTE: You can customize the instruction to fit your specific needs. This template is just an example to help you get started.

Was this helpful?

Yes  No
Related Articles
  • Edge Browser Access Issue
  • Troubleshooting
  • Scheduling
  • AI Agent Communication Channel Setup
  • Post Installation User Guide
  • Installing SAP HANA Including XS Runtime
Copyright 2022 Skybuffer.com. All Rights Reserved.