Customize Progress Agentic RAG indexing

Overview

PREREQUISITES: This feature is available as of Sitefinity CMS product update 15.4.8633.

By default, the Progress® Agentic RAG connector builds the resource data sent to the Progress Agentic RAG knowledge box using the AgenticRAGResourceDataBuilder class. You can replace this with a custom implementation to control what indexing data is sent for each content item — for example, to modify the resource title, add custom metadata, or transform field values before they reach the knowledge box.

Create a custom resource data builder

To customize indexing, create a class that extends AgenticRAGResourceDataBuilder and overrides the Build method:

C#
using System.Collections.Generic;
using Telerik.Sitefinity.AgenticRAG.Indexing;
using Telerik.Sitefinity.Publishing;
using Telerik.Sitefinity.Search;

public class CustomAgenticRAGResourceDataBuilder : AgenticRAGResourceDataBuilder
{
    /// <inheritdoc />
    public override AgenticRAGIndexingResourceData Build(WrapperObject wrapperObject, string itemSlug, IEnumerable<SearchIndexAdditionalField> additionalFields)
    {
        // Call the base implementation to get the default indexing data.
        var indexingResourceData = base.Build(wrapperObject, itemSlug, additionalFields);

        // Customize the resource request before it is sent to the Agentic RAG service.
        // For example, override the resource title in RAG.
        var title = wrapperObject.GetPropertyOrDefault<string>(PublishingConstants.FieldTitle);
        if (!string.IsNullOrEmpty(title))
        {
            indexingResourceData.Request.Title = $"{title}-{itemSlug}";
        }

        return indexingResourceData;
    }
}

Register the custom builder

Register the custom implementation in Global.asax by subscribing to the Bootstrapper.Bootstrapped event and using ObjectFactory to replace the default type:

C#
using System;
using Telerik.Microsoft.Practices.Unity;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.AgenticRAG.Indexing;

public class Global : System.Web.HttpApplication
{
    protected void Application_Start(object sender, EventArgs e)
    {
        Bootstrapper.Bootstrapped += Bootstrapper_Bootstrapped;
    }

    private void Bootstrapper_Bootstrapped(object sender, EventArgs e)
    {
        ObjectFactory.Container.RegisterType<IAgenticRAGResourceDataBuilder, CustomAgenticRAGResourceDataBuilder>(
            new ContainerControlledLifetimeManager());
    }
}

After registering the custom builder, Sitefinity uses it for all subsequent indexing operations sent to the Progress Agentic RAG knowledge box.

Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.