New to Telerik UI for Blazor? Start a free 30-day trial

AI service that generates and refines component configurations.

Definition

Namespace:Telerik.Blazor.Components.DatAInsightsComposer

Assembly:Telerik.Blazor.DatAInsightsComposer.dll

Syntax:

C#
public class DatAInsightsComposerAIService : IDatAInsightsComposerAIService

Inheritance: objectDatAInsightsComposerAIService

Implements: IDatAInsightsComposerAIService

Constructors

C#
public DatAInsightsComposerAIService(DatAInsightsComposerAIServiceDependencies dependencies)
Parameters:dependenciesDatAInsightsComposerAIServiceDependencies

Properties

C#
protected ChatOptions ArcGaugeConfigChatOptions { get; set; }
C#
protected ChatOptions ChartConfigChatOptions { get; set; }

ChatClient

IChatClient

C#
protected IChatClient? ChatClient { get; set; }
C#
protected ChatOptions CircularGaugeConfigChatOptions { get; set; }
C#
protected ChatOptions DatasetAndComponentSelectionChatOptions { get; set; }
C#
protected ChatOptions GridConfigChatOptions { get; set; }
C#
protected ChatOptions LinearGaugeConfigChatOptions { get; set; }
C#
protected ChatOptions RadialGaugeConfigChatOptions { get; set; }

Methods

Selects the dataset AND the component in a single LLM call, then generates the component configuration(s) for each selection.

C#
public virtual Task<ComponentConfigAIResponse> GenerateComponentsAsync(GenerateComponentsRequest request, CancellationToken ct = default)
Parameters:requestGenerateComponentsRequestctCancellationTokenReturns:

Task<ComponentConfigAIResponse>

Implements: IDatAInsightsComposerAIService.GenerateComponentsAsync(GenerateComponentsRequest, CancellationToken)

Builds the ChatOptions used for ArcGauge configuration generation. Override to customize the schema or add provider-specific ChatOptions settings.

C#
protected virtual ChatOptions GetArcGaugeConfigChatOptions()
Returns:

ChatOptions

C#
protected virtual string GetArcGaugeConfigPromptRules()
Returns:

string

Builds the ChatOptions used for Chart configuration generation. Override to customize the schema or add provider-specific ChatOptions settings.

C#
protected virtual ChatOptions GetChartConfigChatOptions()
Returns:

ChatOptions

C#
protected virtual string GetChartConfigPromptRules()
Returns:

string

Builds the ChatOptions used for CircularGauge configuration generation. Override to customize the schema or add provider-specific ChatOptions settings.

C#
protected virtual ChatOptions GetCircularGaugeConfigChatOptions()
Returns:

ChatOptions

C#
protected virtual string GetCircularGaugeConfigPromptRules()
Returns:

string

C#
protected virtual string GetComponentCapabilityPromptRules()
Returns:

string

The shared Grid/Chart/Gauge classification heuristics (signal keywords, disambiguation rules, and worked examples) used when selecting a dataset+component pair (GetSelectDatasetAndComponentPrompt(List<DatasetDescriptor>)) and in follow-up routing. Kept in one place so the prompts can't drift apart on how they interpret the same wording.

C#
protected virtual string GetComponentClassificationPromptRules()
Returns:

string

Returns the same per-component-type opt-in rules used by BuildConfigPrompt(string, ComponentType, ComponentConfig), so the merged multi-component pipeline gets identical guidance about which properties to omit unless the user explicitly asks for them. Without this, the model has no instruction to leave feature flags null and tends to set them all to enabled. Split into one virtual method per component type so consumers can override just one type's rules instead of this whole switch.

C#
protected virtual string GetComponentTypeRules(ComponentType componentType)
Parameters:componentTypeComponentTypeReturns:

string

Builds the ChatOptions used for the multi-dataset-to-component mapping step. Override to customize the schema or add provider-specific ChatOptions settings.

C#
protected virtual ChatOptions GetDatasetAndComponentSelectionOptions()
Returns:

ChatOptions

The dataset config prompt rules.

C#
protected virtual string GetDatasetConfigPromptRules()
Returns:

string

Builds the ChatOptions used for Grid configuration generation. Override to customize the schema or add provider-specific ChatOptions settings.

C#
protected virtual ChatOptions GetGridConfigChatOptions()
Returns:

ChatOptions

C#
protected virtual string GetGridConfigPromptRules()
Returns:

string

Builds the ChatOptions used for LinearGauge configuration generation. Override to customize the schema or add provider-specific ChatOptions settings.

C#
protected virtual ChatOptions GetLinearGaugeConfigChatOptions()
Returns:

ChatOptions

C#
protected virtual string GetLinearGaugeConfigPromptRules()
Returns:

string

Builds the ChatOptions used for RadialGauge configuration generation. Override to customize the schema or add provider-specific ChatOptions settings.

C#
protected virtual ChatOptions GetRadialGaugeConfigChatOptions()
Returns:

ChatOptions

C#
protected virtual string GetRadialGaugeConfigPromptRules()
Returns:

string

C#
protected virtual string GetRefineFollowUpRoutingPrompt(List<DatasetDescriptor> datasets, ComponentConfig currentConfig, string restrictions)
Parameters:datasetsList<DatasetDescriptor>currentConfigComponentConfigrestrictionsstringReturns:

string

C#
protected virtual string GetSelectDatasetAndComponentPrompt(List<DatasetDescriptor> datasets)
Parameters:datasetsList<DatasetDescriptor>Returns:

string

Routes a single current visualization using its context and the eligible dataset catalog, then refines on the same dataset or generates fresh configuration on a different dataset. Successful single-visualization follow-ups use two model calls. Multiple current visualizations retain their existing dataset/type selections and configuration pipeline. Caller-owned configurations are not modified.

C#
public virtual Task<ComponentConfigAIResponse> RefineComponentsAsync(RefineComponentsRequest request, CancellationToken ct = default)
Parameters:requestRefineComponentsRequestctCancellationTokenReturns:

Task<ComponentConfigAIResponse>

Implements: IDatAInsightsComposerAIService.RefineComponentsAsync(RefineComponentsRequest, CancellationToken)

The main extension point for calling an LLM: override this to route the request to your own backend (which then calls the LLM on your behalf). If you don't override it, the base implementation falls back to the IChatClient registered via ChatClient (e.g. through Microsoft.Extensions.AI); if neither is available, it throws an InvalidOperationException that explains what to implement.

C#
protected virtual Task<ChatResponse> SendChatRequestAsync(IList<ChatMessage> messages, ChatOptions options, CancellationToken ct)
Parameters:messagesIList<ChatMessage>optionsChatOptionsctCancellationTokenReturns:

Task<ChatResponse>

The IChatClient path's generate-flow seam: gives a consuming service the real list and ChatOptions the base pipeline built (e.g. to log schema size or timing) before forwarding to . Only reached when nothing overrides SendGenerateComponentsRequestAsync(GenerateComponentsAIRequest, CancellationToken) above it.

C#
protected virtual Task<ChatResponse> SendGenerateComponentsChatRequestAsync(GenerateComponentsAIRequest request, IList<ChatMessage> messages, ChatOptions options, CancellationToken ct)
Parameters:requestGenerateComponentsAIRequestmessagesIList<ChatMessage>optionsChatOptionsctCancellationTokenReturns:

Task<ChatResponse>

Sends one AI request that is part of the generate flow (GenerateComponentsAsync(GenerateComponentsRequest, CancellationToken)), with no dependency on ChatOptions/ChatMessage — this is the seam a service that doesn't use an in-process IChatClient at all should override: request already carries everything needed (operation, prompts, schema) to package for an external backend, and GenerateComponentsAIResponse is all it needs to return (just the raw text answer and whether the model refused). Default implementation rebuilds the messages/options an in-process IChatClient call needs and forwards to .

C#
protected virtual Task<GenerateComponentsAIResponse> SendGenerateComponentsRequestAsync(GenerateComponentsAIRequest request, CancellationToken ct)
Parameters:requestGenerateComponentsAIRequestctCancellationTokenReturns:

Task<GenerateComponentsAIResponse>

Refine-flow counterpart of .

C#
protected virtual Task<ChatResponse> SendRefineComponentsChatRequestAsync(RefineComponentsAIRequest request, IList<ChatMessage> messages, ChatOptions options, CancellationToken ct)
Parameters:requestRefineComponentsAIRequestmessagesIList<ChatMessage>optionsChatOptionsctCancellationTokenReturns:

Task<ChatResponse>

Refine-flow counterpart of SendGenerateComponentsRequestAsync(GenerateComponentsAIRequest, CancellationToken) — same "no ChatOptions dependency" seam, driven by RefineComponentsAIRequest/ RefineComponentsAIResponse instead.

C#
protected virtual Task<RefineComponentsAIResponse> SendRefineComponentsRequestAsync(RefineComponentsAIRequest request, CancellationToken ct)
Parameters:requestRefineComponentsAIRequestctCancellationTokenReturns:

Task<RefineComponentsAIResponse>

The IChatClient path's dataset+component-selection seam: gives a consuming service the real list and ChatOptions the base pipeline built before forwarding to . Only reached when nothing overrides above it.

C#
protected virtual Task<ChatResponse> SendSelectDatasetAndComponentChatRequestAsync(SelectDatasetAndComponentAIRequest request, IList<ChatMessage> messages, ChatOptions options, CancellationToken ct)
Parameters:requestSelectDatasetAndComponentAIRequestmessagesIList<ChatMessage>optionsChatOptionsctCancellationTokenReturns:

Task<ChatResponse>

The seam a service that doesn't use an in-process IChatClient should override for the dataset+component selection step, including contextual single-visualization follow-up routing — mirrors SendGenerateComponentsRequestAsync(GenerateComponentsAIRequest, CancellationToken). Integrations must honor the supplied system prompt and schema rather than hardcoding initial selection behavior. Default implementation rebuilds the messages/options an in-process IChatClient call needs and forwards to .

C#
protected virtual Task<SelectDatasetAndComponentAIResponse> SendSelectDatasetAndComponentRequestAsync(SelectDatasetAndComponentAIRequest request, CancellationToken ct)
Parameters:requestSelectDatasetAndComponentAIRequestctCancellationTokenReturns:

Task<SelectDatasetAndComponentAIResponse>

In this article
DefinitionConstructorsDatAInsightsComposerAIService(DatAInsightsComposerAIServiceDependencies)PropertiesArcGaugeConfigChatOptionsChartConfigChatOptionsChatClientCircularGaugeConfigChatOptionsDatasetAndComponentSelectionChatOptionsGridConfigChatOptionsLinearGaugeConfigChatOptionsRadialGaugeConfigChatOptionsMethodsGenerateComponentsAsync(GenerateComponentsRequest, CancellationToken)GetArcGaugeConfigChatOptions()GetArcGaugeConfigPromptRules()GetChartConfigChatOptions()GetChartConfigPromptRules()GetCircularGaugeConfigChatOptions()GetCircularGaugeConfigPromptRules()GetComponentCapabilityPromptRules()GetComponentClassificationPromptRules()GetComponentTypeRules(ComponentType)GetDatasetAndComponentSelectionOptions()GetDatasetConfigPromptRules()GetGridConfigChatOptions()GetGridConfigPromptRules()GetLinearGaugeConfigChatOptions()GetLinearGaugeConfigPromptRules()GetRadialGaugeConfigChatOptions()GetRadialGaugeConfigPromptRules()GetRefineFollowUpRoutingPrompt(List<DatasetDescriptor>, ComponentConfig, string)GetSelectDatasetAndComponentPrompt(List<DatasetDescriptor>)RefineComponentsAsync(RefineComponentsRequest, CancellationToken)SendChatRequestAsync(IList<ChatMessage>, ChatOptions, CancellationToken)SendGenerateComponentsChatRequestAsync(GenerateComponentsAIRequest, IList<ChatMessage>, ChatOptions, CancellationToken)SendGenerateComponentsRequestAsync(GenerateComponentsAIRequest, CancellationToken)SendRefineComponentsChatRequestAsync(RefineComponentsAIRequest, IList<ChatMessage>, ChatOptions, CancellationToken)SendRefineComponentsRequestAsync(RefineComponentsAIRequest, CancellationToken)SendSelectDatasetAndComponentChatRequestAsync(SelectDatasetAndComponentAIRequest, IList<ChatMessage>, ChatOptions, CancellationToken)SendSelectDatasetAndComponentRequestAsync(SelectDatasetAndComponentAIRequest, CancellationToken)
Not finding the help you need?
Contact Support