Skip to content

Commit be48dbb

Browse files
dimodidimodi
authored andcommitted
docs(AI): Update Telerik.AI.SmartComponents.Extensions documentation
1 parent 64e98b7 commit be48dbb

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

common-features/integration-with-telerik-ai-smartcomponents-extensions.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,20 @@ position: 45
1010

1111
# Getting Started with Telerik.AI.SmartComponents.Extensions
1212

13-
The `Telerik.AI.SmartComponents.Extensions` library provides AI-powered functionality for Grid operations, enabling natural language processing for filtering, sorting, grouping, and highlighting data. This library integrates seamlessly with Microsoft.Extensions.AI and Azure OpenAI to provide intelligent Grid interactions.
13+
The `Telerik.AI.SmartComponents.Extensions` library provides AI-powered functionality for Grid operations, enabling natural language processing for filtering, sorting, grouping, and highlighting data. This library integrates seamlessly with `Microsoft.Extensions.AI` and Azure OpenAI to provide intelligent Grid interactions.
1414

1515
## Prerequisites
1616

1717
- .NET 8.0 or later
18-
- `Microsoft.Extensions.AI` package
1918
- Azure OpenAI or OpenAI API access
2019
- ASP.NET Core (for web API scenarios)
2120

2221
## Installation
2322

24-
1. Add the [`Telerik.AI.SmartComponents.Extensions` NuGet package](https://www.nuget.org/packages/Telerik.AI.SmartComponents.Extensions) to your project.
25-
1. Add the required dependency packages:
23+
1. Add the [`Telerik.AI.SmartComponents.Extensions` NuGet package](https://www.nuget.org/packages/Telerik.AI.SmartComponents.Extensions) to your project. It adds the following dependencies:
2624
* `Microsoft.Extensions.AI`
2725
* `Azure.AI.OpenAI`
26+
1. Add the [`Microsoft.Extensions.AI.OpenAI` NuGet package](https://www.nuget.org/packages/Microsoft.Extensions.AI.OpenAI). Note that it's a preview (pre-release) package.
2827

2928
## Configuration
3029

@@ -37,22 +36,22 @@ using Azure.AI.OpenAI;
3736
var builder = WebApplication.CreateBuilder(args);
3837

3938
// Configure Azure OpenAI Chat Client
40-
builder.Services.AddSingleton<IChatClient>(serviceProvider =>
39+
builder.Services.AddChatClient(serviceProvider =>
4140
{
42-
var configuration = serviceProvider.GetRequiredService<IConfiguration>();
43-
var endpoint = configuration["AI:AzureOpenAI:Endpoint"];
44-
var apiKey = configuration["AI:AzureOpenAI:Key"];
45-
var modelId = configuration["AI:AzureOpenAI:Chat:ModelId"];
46-
41+
IConfiguration configuration = serviceProvider.GetRequiredService<IConfiguration>();
42+
string endpoint = configuration["AI:AzureOpenAI:Endpoint"] ?? "";
43+
string apiKey = configuration["AI:AzureOpenAI:Key"] ?? "";
44+
string modelId = configuration["AI:AzureOpenAI:Chat:ModelId"] ?? "";
45+
4746
var client = new AzureOpenAIClient(new Uri(endpoint), new Azure.AzureKeyCredential(apiKey));
48-
return client.AsChatClient(modelId);
47+
return client.GetChatClient(modelId).AsIChatClient();
4948
});
5049

5150
builder.Services.AddControllers();
5251
var app = builder.Build();
5352
```
5453

55-
### 2. Configure appsettings.json
54+
### 2. Configure AI Properties in appsettings.json
5655

5756
```json
5857
{

0 commit comments

Comments
 (0)