File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
CS/DevExpress.AI.Samples.Blazor.Editors Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 11using Azure ;
22using Azure . AI . OpenAI ;
33using DevExpress . AI . Samples . Blazor . Editors . Components ;
4- using DevExpress . Blazor ;
54using Microsoft . Extensions . AI ;
65
76var builder = WebApplication . CreateBuilder ( args ) ;
1211
1312string azureOpenAIEndpoint = Environment . GetEnvironmentVariable ( "AZURE_OPENAI_ENDPOINT" ) ;
1413string azureOpenAIKey = Environment . GetEnvironmentVariable ( "AZURE_OPENAI_API_KEY" ) ;
14+ string deploymentName = string . Empty ;
1515
1616IChatClient chatClient = new AzureOpenAIClient (
1717 new Uri ( azureOpenAIEndpoint ) ,
18- new AzureKeyCredential ( azureOpenAIKey ) ) . AsChatClient ( "gpt4o" ) ;
18+ new AzureKeyCredential ( azureOpenAIKey ) ) . AsChatClient ( deploymentName ) ;
1919
2020builder . Services . AddDevExpressBlazor ( ) ;
2121builder . Services . AddChatClient ( config => config . Use ( chatClient ) ) ;
Original file line number Diff line number Diff line change @@ -31,18 +31,19 @@ Add the following code to the _Program.cs_ file to register AI services in the a
3131``` cs
3232using Azure ;
3333using Azure .AI .OpenAI ;
34- using DevExpress .Blazor ;
34+ using DevExpress .AI . Samples . Blazor . Editors . Components ;
3535using Microsoft .Extensions .AI ;
3636.. .
3737string azureOpenAIEndpoint = Environment .GetEnvironmentVariable (" AZURE_OPENAI_ENDPOINT" );
3838string 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+
4145builder .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 ));
4647builder .Services .AddDevExpressAI ();
4748```
4849
You can’t perform that action at this time.
0 commit comments