-
Notifications
You must be signed in to change notification settings - Fork 26
Created AI-powered-insights.md #1679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
8113d4e
3f3512f
04d3db6
a6b5c7e
46808b8
3cb40d0
849536d
cbd1a79
ea450a3
16d0576
e9d25c6
73ac9aa
ac7867a
0f9f337
f505088
d254766
37112f4
d0af8b3
cf2d483
b91b2dd
7be4ee3
dcad00f
19b897d
dc13158
05817a3
a937224
6a7a5ff
87a3154
3c41bc1
8ecee33
0819125
212d1ad
3177b33
2d4a287
8e91fa6
a53742d
db496e5
b1551aa
30229f1
b2c0472
d1b6ea4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- | ||
title: AIClient Element | ||
page_title: AIClient Element Configuration | ||
description: "Learn how to utilize the AIClient Element to configure the AI model used for GenAI-powered insights during report preview" | ||
slug: telerikreporting/aiclient-element | ||
tags: aiclient,element, ai | ||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
published: True | ||
position: 13 | ||
--- | ||
|
||
<style> | ||
table th:first-of-type { | ||
width: 10%; | ||
} | ||
table th:nth-of-type(2) { | ||
width: 90%; | ||
} | ||
</style> | ||
|
||
# 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|<ul><li>__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`.</li><li>__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-4 model variant is being utilized.</li><li>__endpoint__ - Optional string attribute. If set, specifies the URL of the AI service endpoint.</li><li>__credential__ - Optional string attribute. If set, specifies the authentication credentials used to access the AI service.</li><li>__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.</li><li>__allowCustomPrompts__ - Optional boolean attribute _(true by default)_. Determines whether users are allowed to freely communicate with the AI model. If the switch is set to false, custom queries are forbidden and only the predefined prompts can be used.</li></ul>| | ||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|Child Elements|<ul><li>__predefinedPrompts__ - Optional element. Defines a list of predefined prompts that the AI client can use.</li></ul>| | ||
|Parent Element|__Telerik.Reporting__ - Configures all settings that the Telerik Reporting Engine uses.| | ||
|
||
__`<predefinedPrompts>` element__ | ||
|
||
| | | | ||
| ------ | ------ | | ||
|Attributes|None| | ||
|Child Elements|<ul><li>__add__ - Optional element. Adds a prompt to the list of predefined prompts.</li></ul>| | ||
|Parent Element|__AIClient__| | ||
|
||
__`<add>` element__ | ||
|
||
| | | | ||
| ------ | ------ | | ||
|Attributes|__text__ - The text of a predetermined AI prompt.| | ||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|Child Elements|None| | ||
|Parent Element|__predefinedPrompts__| | ||
|
||
## Example | ||
|
||
The following code example demonstrates how to configure the Reporting engine with an Azure OpenAI client that uses the `gpt-4o-mini` model. In addition, the AI functionality is restricted to using only a couple of predefined prompts for summarizing and translating the report. | ||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
XML-based configuration file: | ||
|
||
````XML | ||
<?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 in German."/> | ||
petar-i-todorov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</predefinedPrompts> | ||
</AIClient> | ||
</Telerik.Reporting> | ||
... | ||
</configuration> | ||
```` | ||
|
||
JSON-based configuration file: | ||
|
||
````JSON | ||
"telerikReporting": { | ||
"AIClient": { | ||
"friendlyName": "MicrosoftExtensionsAzureOpenAI", | ||
"model": "gpt-4o-mini", | ||
"endpoint": "https://ai-explorations.openai.azure.com/", | ||
"credential": "...", | ||
"requireConsent": true, | ||
"allowCustomPrompts": false, | ||
"predefinedPrompts": [ | ||
{ "text": "Generate an executive summary of this report." }, | ||
{ "text": "Translate the document in German." } | ||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
] | ||
} | ||
} | ||
```` | ||
|
||
> 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](https://learn.microsoft.com/en-us/dotnet/api/system.configuration.configurationerrorsexception?view=dotnet-plat-ext-7.0) with the following text: *Configuration system failed to initialize*. | ||
|
||
## See Also | ||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,96 @@ | ||||||
--- | ||||||
title: AI-powered insights in Report Preview | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
page_title: AI-powered insights in Report Preview | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
description: "Learn how to implement a prompt UI as part of the Web report viewer" | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
slug: telerikreporting/designing-reports/adding-interactivity-to-reports/ai-powered-insights | ||||||
tags: telerik, reporting, ai, | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
published: True | ||||||
position: 1 | ||||||
--- | ||||||
|
||||||
# AI-powered insights Overview | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
The AI-powered insights in Report Preview provide comprehensive capabilities, including response generation, prompt creation, AI output interaction, and execution of predefined commands. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't most of the listed capabilities the same thing, but said in different words? If they are, consider keeping the description as simple as possible by removing the repetitiveness. Milen's description of the functionality sounds handy and can be used here:
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
## OpenAI Implementations | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these options indeed specific to the OpenAI-based LLMs? What about
petar-i-todorov marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
* Ask AI: This functionality enables users to pose questions to the AI, facilitating interactive and dynamic responses based on the provided document context. | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
* Output: This feature generates outputs from the AI, including summaries, highlights, and other predefined commands, enhancing the overall productivity and efficiency of the report viewer. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
## Configure the AI | ||||||
|
||||||
| Setting | Description | | ||||||
| ------ | ------ | | ||||||
|friendlyName|This setting specifies the name corresponding to the type of AI client you wish to use. For example, setting friendlyName to "MicrosoftExtensionsAzureOpenAI" indicates that the Azure OpenAI client is being utilized| | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|model|This setting specifies the AI model to be used for generating responses. For example, setting the model to "gpt-4o-mini" indicates that the GPT-4 model variant is being utilized| | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|endpoint|This setting specifies the URL of the AI service endpoint| | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|credential|This setting specifies the authentication credentials required to access the AI service. It ensures that the AI client can securely connect to the specified endpoint| | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|requireConsent|A boolean configuration switch that determines whether users must explicitly consent to the use of AI models before the AI report insights features can be utilized within the application| | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|allowCustomPrompts|This setting is set to false by default. If you set it to `True`, you will not be allowed to ask anything except the predefined prompts. For example, if you write "Hi" it will throw an exception| | ||||||
petar-i-todorov marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|predefinedPrompts|This setting specifies a list of predefined prompts that the AI client can use. Each prompt is defined by a text attribute, which contains the prompt's content| | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
__AI clients__ | ||||||
|
||||||
We have four available options for the `friendlyName` setting | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
| | | | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| ------ | ------ | | ||||||
|Microsoft.Extensions.AI.AzureAIInference|"MicrosoftExtensionsAzureAIInference"| | ||||||
|Microsoft.Extensions.AI.OpenAI + Azure.AI.OpenAI|"MicrosoftExtensionsAzureOpenAI"| | ||||||
|Microsoft.Extensions.AI.Ollama|"MicrosoftExtensionsOllama"| | ||||||
|Microsoft.Extensions.AI.OpenAI|"MicrosoftExtensionsOpenAI"| | ||||||
|
||||||
````JSON | ||||||
{ | ||||||
"telerikReporting": { | ||||||
"AIClient": { | ||||||
"friendlyName": "MicrosoftExtensionsAzureOpenAI", | ||||||
"model": "gpt-4o-mini", | ||||||
"endpoint": "https://ai-explorations.openai.azure.com/", | ||||||
"credential": "...", | ||||||
"requireConsent": false, | ||||||
"allowCustomPrompts": false, | ||||||
"predefinedPrompts": [ | ||||||
{ "text": "Prompt 1" }, | ||||||
{ "text": "Prompt 2" } | ||||||
] | ||||||
} | ||||||
} | ||||||
} | ||||||
```` | ||||||
|
||||||
````XML | ||||||
<Telerik.Reporting> | ||||||
<AIClient | ||||||
friendlyName="MicrosoftExtensionsAzureOpenAI" | ||||||
model="gpt-4o-mini" | ||||||
endpoint="https://ai-explorations.openai.azure.com/" | ||||||
credential="..." | ||||||
requireConsent="false" | ||||||
allowCustomPrompts="false"> | ||||||
<predefinedPrompts> | ||||||
<add text="Prompt 1" /> | ||||||
<add text="Prompt 2" /> | ||||||
</predefinedPrompts> | ||||||
</AIClient> | ||||||
</Telerik.Reporting> | ||||||
```` | ||||||
## Extensibility | ||||||
|
||||||
* If necessary, the Reporting engine can use a custom Telerik.Reporting.AI.IClient implementation, which can be registered in the Reporting REST Service configuration: | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
````C# | ||||||
builder.Services.TryAddSingleton<IReportServiceConfiguration>(sp => new ReportServiceConfiguration | ||||||
{ | ||||||
HostAppId = "MyApp", | ||||||
AIClientFactory = GetCustomAIClient, | ||||||
... | ||||||
}); | ||||||
static Telerik.Reporting.AI.IClient GetCustomAIClient() | ||||||
{ | ||||||
return new MyCustomAIClient(...); | ||||||
} | ||||||
```` | ||||||
|
||||||
* The configured predefined prompts can be modified at runtime by overriding the "UpdateAIPrompts" method of the ReportsController class. | ||||||
DimitarNikolovv06 marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.