New to Telerik Reporting? Download free 30-day trial

AIClient Element Overview

The AIClient element specifies the configuration settings for the GenAI-powered insights functionality of Telerik Reporting. It is used to connect the Reporting engine to a local or remote LLM, as well as configure the behavior of the built-in Reporting AI capabilities.

Attributes and Elements

<AIClient> element

Attributes
  • friendlyName - Required string attribute. Specifies the name that corresponds to the type of AI client to be used. The names of the currently supported AI client types are: MicrosoftExtensionsAzureAIInference, MicrosoftExtensionsAzureOpenAI, MicrosoftExtensionsOllama, and MicrosoftExtensionsOpenAI.
  • model - Required string attribute. Specifies the AI model to be used for generating responses. For example, setting the model to "gpt-4o-mini" indicates that the GPT-4o mini model variant is being utilized.
  • endpoint - Optional string attribute. If set, specifies the URL of the AI service endpoint.
  • credential - Optional string attribute. If set, specifies the authentication credentials used to access the AI service.
  • requireConsent - Optional boolean attribute (true by default). Determines whether users must explicitly consent to the use of AI services before the AI report insights features can be utilized within the application.
  • allowRAG - Optional boolean attribute (true by default). Allows the Retrieval-Augmented Generation (RAG). The ragSettings will be respected only when allowRAG is true.
  • allowCustomPrompts - Optional boolean attribute (true by default). Determines whether users are allowed to freely communicate with the AI model. If set to false, custom queries are forbidden and only the predefined prompts can be used.
Child Elements
  • predefinedPrompts - Optional element. Defines a list of predefined prompts that the AI client can use.
  • ragSettings - Optional element. Configures the Retrieval-Augmented Generation (RAG) options.
Parent Element Telerik.Reporting - Configures all settings that the Telerik Reporting Engine uses.

<predefinedPrompts> element

Attributes None
Child Elements
  • add - Optional element. Adds a prompt to the list of predefined prompts.
Parent Element AIClient

<add> element

Attributes text - The text of a predefined AI prompt.
Child Elements None
Parent Element predefinedPrompts

<ragSettings> element

Attributes
  • tokenizationEncoding - Optional string attribute. If set, specifies the tokenization encoding used for Retrieval-Augmented Generation (RAG). By default, the encoding is determined automatically.
  • modelMaxInputTokenLimit - Optional integer attribute. If set, specifies the maximum number of input tokens allowed by the RAG model. The default value is 15000.
  • maxNumberOfEmbeddingsSent - Optional integer attribute. If set, specifies the maximum number of embeddings that can be sent in a single RAG request. The default value is 15.
  • maxTokenSizeOfSingleEmbedding - Optional integer attribute. If set, specifies the maximum token size allowed for a single embedding in RAG. A value of 0 means there is no limit. The default value is 0.
  • splitTables - Optional boolean attribute (true by default). Indicates whether tables should be split during Retrieval-Augmented Generation (RAG) processing. When the splitting is allowed, only the relevant table cells will be taken into account, significantly reducing the number of tokens
Parent Element AIClient

The ragSettings element is valid only in .NET and .NET Standard. It is not supported in the .NET Framework.

The ragSettings will be respected only when allowRAG is true

Example

The following code example demonstrates how to configure the Reporting engine with an Azure OpenAI client that uses the GPT-4o mini model variant. In addition, the AI functionality is limited to a few predefined prompts that enable it to summarize and translate the report.

XML-based configuration file:

<?xml version="1.0"?>
<configuration>
    <configSections>
        <section name="Telerik.Reporting" type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting" allowLocation="true" allowDefinition="Everywhere" />
    </configSections>
    <Telerik.Reporting>
        <AIClient
            friendlyName="MicrosoftExtensionsAzureOpenAI"
            model="gpt-4o-mini"
            endpoint="https://ai-explorations.openai.azure.com/"
            credential="..."
            requireConsent="true"
            allowCustomPrompts="false">
            <predefinedPrompts>
                <add text="Generate an executive summary of this report."/>
                <add text="Translate the document into German."/>
            </predefinedPrompts>
        </AIClient>
    </Telerik.Reporting>
...
</configuration>

JSON-based configuration file:

"telerikReporting": {
    "AIClient": {
        "friendlyName": "MicrosoftExtensionsAzureOpenAI",
        "model": "gpt-4o-mini",
        "endpoint": "https://ai-explorations.openai.azure.com/",
        "credential": "...",
        "requireConsent": true,
        "allowCustomPrompts": false,
        "allowRAG": true,
        "predefinedPrompts": [
            { "text": "Generate an executive summary of this report." },
            { "text": "Translate the document into German." }
        ],
        "ragSettings": {
            "tokenizationEncoding": "Set Encoding Name Here",
            "modelMaxInputTokenLimit": 15000,
            "maxNumberOfEmbeddingsSent": 15,
            "maxTokenSizeOfSingleEmbedding": 0,
            "splitTables": true
        }
    }
}

When adding the Telerik.Reporting section manually, do not forget to register it in configSections element of the configuration file. Failing to do so will result in a ConfigurationErrorsException with the following text: Configuration system failed to initialize.

In this article