Skip to content

Commit a77a393

Browse files
committed
readme fixed
1 parent 77a0f16 commit a77a393

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

CS/DevExpress.AI.Samples.Blazor.Editors/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Azure;
22
using Azure.AI.OpenAI;
33
using DevExpress.AI.Samples.Blazor.Editors.Components;
4-
using DevExpress.Blazor;
54
using Microsoft.Extensions.AI;
65

76
var builder = WebApplication.CreateBuilder(args);
@@ -12,10 +11,11 @@
1211

1312
string azureOpenAIEndpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT");
1413
string azureOpenAIKey = Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY");
14+
string deploymentName = string.Empty;
1515

1616
IChatClient chatClient = new AzureOpenAIClient(
1717
new Uri(azureOpenAIEndpoint),
18-
new AzureKeyCredential(azureOpenAIKey)).AsChatClient("gpt4o");
18+
new AzureKeyCredential(azureOpenAIKey)).AsChatClient(deploymentName);
1919

2020
builder.Services.AddDevExpressBlazor();
2121
builder.Services.AddChatClient(config => config.Use(chatClient));

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,19 @@ Add the following code to the _Program.cs_ file to register AI services in the a
3131
```cs
3232
using Azure;
3333
using Azure.AI.OpenAI;
34-
using DevExpress.Blazor;
34+
using DevExpress.AI.Samples.Blazor.Editors.Components;
3535
using Microsoft.Extensions.AI;
3636
...
3737
string azureOpenAIEndpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT");
3838
string azureOpenAIKey = Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY");
39-
string deploymentName = "gpt4o";
39+
string deploymentName = string.Empty;
4040

41+
IChatClient chatClient = new AzureOpenAIClient(
42+
new Uri(azureOpenAIEndpoint),
43+
new AzureKeyCredential(azureOpenAIKey)).AsChatClient(deploymentName);
44+
4145
builder.Services.AddDevExpressBlazor();
42-
IChatClient asChatClient = new Azure.AI.OpenAI.AzureOpenAIClient(new Uri(azureOpenAIEndpoint),
43-
new System.ClientModel.ApiKeyCredential(azureOpenAIKey))
44-
.AsChatClient(deploymentName);
45-
builder.Services.AddSingleton(asChatClient);
46+
builder.Services.AddChatClient(config => config.Use(chatClient));
4647
builder.Services.AddDevExpressAI();
4748
```
4849

0 commit comments

Comments
 (0)