New to KendoReact? Start a free 30-day trial

AI orchestration client used by DatAInsightsComposer. Implementations receive only field metadata — never data rows — and return a DatAInsightsComposerAIResponse.

A production implementation should call a backend endpoint rather than an LLM directly, since the browser cannot hold AI provider credentials — see createDefaultAIClient, which posts to a host-provided backend endpoint.

Configs are always validated before rendering, but only createDefaultAIClient sanitizes the rest of the response. A custom client should pass its model output through toDatAInsightsComposerAIResponse; otherwise message and candidateKeys render as given.

Definition

Package:@progress/kendo-react-datainsights-composer

Methods

Initial generation — no existing configs. May return more than one config to render together.

Parameters:promptstringfieldsFieldDescriptor[]options?DatAInsightsComposerAIRequestOptionsReturns:

Promise​<DatAInsightsComposerAIResponse>

Follow-up refinement — passes the current set of configs as context.

Parameters:followUpPromptstringfieldsFieldDescriptor[]currentConfigsDatAInsightsConfig[]options?DatAInsightsComposerAIRequestOptionsReturns:

Promise​<DatAInsightsComposerAIResponse>

Resolves which dataset(s) and component type(s) a prompt is asking for, when the host has more than one dataset available (datasets) and this instance is already bound to one of them. Runs before generation on every generateAsync call, so a bound module can still route part of a request to a different dataset — e.g. "grid with sales orders and a chart with sales people" while bound to sales_orders resolves to [{ datasetId: 'sales_orders', componentType: 'Grid' }, { datasetId: 'sales_persons', componentType: 'Chart' }]. DatAInsightsComposer then calls generateAsync once per selection (scoped to that dataset's own fields, steered to that componentType via allowedComponentTypes) and stamps datasetId onto each resulting config itself — the AI is never asked to read or write datasetId directly.

Optional — a client without it never routes across datasets; every config renders against the active dataset's fields, exactly as when datasets has one entry.

Parameters:promptstringdatasetsDatasetDescriptor[]options?DatAInsightsComposerAIRequestOptionsReturns:

Promise​<DatasetsAndComponentsSelectionResult>

Resolves which dataset best matches a prompt when this instance has no active dataset.

Optional — a host without it binds datasets by its own means, driven by onPromptSubmit. A bare string return is equivalent to { datasetId }.

Parameters:promptstringdatasetsDatasetDescriptor[]options?DatAInsightsComposerAIRequestOptionsReturns:

Promise​<null | string | DatasetSelectionResult>

Decides, before a follow-up prompt refines the single config on screen, whether the prompt still fits the current dataset or needs another one — e.g. a chart of sales_orders followed by "show open support tickets by priority". Runs only when more than one dataset with fields is available. datasets carries metadata only, never rows.

With intent: 'Valid' and the current datasetId, DatAInsightsComposer refines the current config as usual. With another datasetId, it generates a new config against that dataset (no previous config is sent) and stamps datasetId onto it itself. The component validates the result whatever the client returns: an unknown intent, dataset or component type keeps the current report and shows a "couldn't find a dataset" message.

Optional — a client without it never routes a follow-up; every refine stays on the dataset its config is bound to. Failures are reported through onError as operation: 'refine'.

Parameters:promptstringdatasetsDatasetDescriptor[]currentFollowUpCurrentSelectionoptions?DatAInsightsComposerAIRequestOptionsReturns:

Promise​<FollowUpSelectionResult>