Skip to content

Commit 86dca8e

Browse files
authored
update example
1 parent d5ae059 commit 86dca8e

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

README.md

+22-15
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,24 @@ The AI assistant's role depends on the associated DevExpress Reports component:
1515

1616
**Please note that AI Assistant initialization takes time. The assistant tab appears once Microsoft Azure scans the source document on the server side.**
1717

18-
> [!NOTE]
19-
> To run this project with an Early Access Preview build (EAP), install npm packages:
20-
>
21-
> ```
22-
> npm install --legacy-peer-deps
23-
> ```
24-
2518
## Implementation Details
2619

2720
### Common Settings
2821

2922
#### Add Personal Keys
3023

24+
> [!NOTE]
25+
> DevExpress AI-powered extensions follow the "bring your own key" principle. DevExpress does not offer a REST API and does not ship any built-in LLMs/SLMs. You need an active Azure/Open AI subscription to obtain the REST API endpoint, key, and model deployment name. These variables must be specified at application startup to register AI clients and enable DevExpress AI-powered Extensions in your application.
26+
3127
You need to create an Azure OpenAI resource in the Azure portal to use AI Assistants for DevExpress Reporting. Refer to the following help topic for details: [Microsoft - Create and deploy an Azure OpenAI Service resource](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal).
3228

3329
Once you obtain a private endpoint and an API key, register them as `OPENAI_ENDPOINT` and `OPENAI_APIKEY` environment variables. The [EnvSettings.cs](./CS/ReportingApp/EnvSettings.cs) reads these settings. `DeploymentName` in this file is a name of your Azure model, for example, `GPT4o`:
3430

3531
```cs
3632
public static class EnvSettings {
37-
public static string AzureOpenAIEndpoint { get { return Environment.GetEnvironmentVariable("OPENAI_ENDPOINT"); } }
38-
public static string AzureOpenAIKey { get { return Environment.GetEnvironmentVariable("OPENAI_APIKEY"); } }
39-
public static string DeploymentName { get { return "GPT4o"; } }
33+
public static string AzureOpenAIEndpoint { get { return Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT"); } }
34+
public static string AzureOpenAIKey { get { return Environment.GetEnvironmentVariable("AZURE_OPENAI_APIKEY"); } }
35+
public static string DeploymentName { get { return "GPT4o"; } }
4036
}
4137
```
4238

@@ -49,12 +45,19 @@ Register AI services in your application. Add the following code to the _Program
4945

5046
```cs
5147
using DevExpress.AIIntegration;
48+
using Azure;
49+
using Azure.AI.OpenAI;
50+
using Microsoft.Extensions.AI;
51+
using System;
5252
// ...
53-
builder.Services.AddDevExpressAI((config) => {
54-
var client = new AzureOpenAIClient(new Uri(EnvSettings.AzureOpenAIEndpoint), new AzureKeyCredential(EnvSettings.AzureOpenAIKey));
55-
var deployment = EnvSettings.DeploymentName;
56-
config.RegisterChatClientOpenAIService(client, deployment);
57-
config.RegisterOpenAIAssistants(client, deployment);
53+
var azureOpenAIClient = new AzureOpenAIClient(
54+
new Uri(EnvSettings.AzureOpenAIEndpoint),
55+
new AzureKeyCredential(EnvSettings.AzureOpenAIKey));
56+
57+
var chatClient = azureOpenAIClient.AsChatClient(EnvSettings.DeploymentName);
58+
builder.Services.AddDevExpressAI(config =>
59+
{
60+
config.RegisterOpenAIAssistants(azureOpenAIClient, EnvSettings.DeploymentName);
5861
});
5962
```
6063

@@ -267,6 +270,10 @@ onMessageSend: (e) => {
267270
- [AIController.cs](./CS/ReportingApp/Controllers/AIController.cs)
268271
- [aiIntegration.js](./CS/ReportingApp/wwwroot/js/aiIntegration.js)
269272

273+
## Documentation
274+
275+
- [AI-powered Extensions for DevExpress Reporting](https://docs.devexpress.com/XtraReports/405211/ai-powered-functionality/ai-for-devexpress-reporting?v=24.2)
276+
270277
## More Examples
271278

272279
- [Reporting for ASP.NET Core - Summarize and Translate DevExpress Reports Using Azure OpenAI](https://github.com/DevExpress-Examples/reporting-aspnet-core-ai-summarize-and-translate)

0 commit comments

Comments
 (0)