Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cefc408

Browse files
authored
Merge pull request #325 from telerik/update-microsoft-extensions-ai-demo
chore(common): udate spacing and readme
2 parents ea19d68 + 44f0cfe commit cefc408

File tree

2 files changed

+21
-15
lines changed
  • common/microsoft-extensions-ai-integration/AIPromptIntegration

2 files changed

+21
-15
lines changed

common/microsoft-extensions-ai-integration/AIPromptIntegration/AIPromptIntegration/Program.cs

+15-15
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33

44
// Optional model provider implementations:
55
// Azure models
6-
using Azure;
6+
using Azure;
77
using Azure.AI.OpenAI;
88
// OpenAI models
99
using OpenAI;
1010
// GitHub models
11-
using System.ClientModel;
11+
using System.ClientModel;
1212

1313
var builder = WebApplication.CreateBuilder(args);
1414

1515
// Add services to the container.
1616
builder.Services.AddRazorComponents()
17-
.AddInteractiveServerComponents();
17+
.AddInteractiveServerComponents();
1818

1919
builder.Services.AddTelerikBlazor();
2020

@@ -33,25 +33,25 @@
3333

3434
// Replace the innerClient below with your preferred model provider
3535
var innerClient = new OpenAIClient(
36-
new ApiKeyCredential(apikey),
37-
new OpenAIClientOptions()
38-
{
39-
Endpoint = new Uri(endpoint)
40-
}
41-
).AsChatClient(model);
36+
new ApiKeyCredential(apikey),
37+
new OpenAIClientOptions()
38+
{
39+
Endpoint = new Uri(endpoint)
40+
}
41+
).AsChatClient(model);
4242

4343
builder.Services.AddChatClient(innerClient) // 🤖 Add the configured chat client
44-
.UseFunctionInvocation() // 🛠️ Include tool calling
45-
.UseLogging(); //🐞 Include Logging
44+
.UseFunctionInvocation() // 🛠️ Include tool calling
45+
.UseLogging(); //🐞 Include Logging
4646

4747
var app = builder.Build();
4848

4949
// Configure the HTTP request pipeline.
5050
if (!app.Environment.IsDevelopment())
5151
{
52-
app.UseExceptionHandler("/Error", createScopeForErrors: true);
53-
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
54-
app.UseHsts();
52+
app.UseExceptionHandler("/Error", createScopeForErrors: true);
53+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
54+
app.UseHsts();
5555
}
5656

5757
app.UseHttpsRedirection();
@@ -60,6 +60,6 @@
6060
app.UseAntiforgery();
6161

6262
app.MapRazorComponents<App>()
63-
.AddInteractiveServerRenderMode();
63+
.AddInteractiveServerRenderMode();
6464

6565
app.Run();

common/microsoft-extensions-ai-integration/AIPromptIntegration/readme.md

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ To run the project successfully, you need to provide your endpoint and credentia
3030

3131
**Azure AI Inference Client registration**
3232

33+
>Program.cs
3334
```csharp
3435
var innerClient = new Azure.AI.Inference.ChatCompletionsClient(
3536
new Uri(endpoint),
@@ -39,6 +40,7 @@ var innerClient = new Azure.AI.Inference.ChatCompletionsClient(
3940

4041
**Azure OpenAI Client registration**
4142

43+
>Program.cs
4244
```csharp
4345
var innerClient = new AzureOpenAIClient(
4446
new Uri(endpoint),
@@ -48,13 +50,15 @@ var innerClient = new AzureOpenAIClient(
4850

4951
**OpenAI Client registration**
5052

53+
>Program.cs
5154
```csharp
5255
var innerClient = new OpenAIClient(apikey)
5356
.AsChatClient(model);
5457
```
5558

5659
**GitHub Models Client registration**
5760

61+
>Program.cs
5862
```csharp
5963
var innerClient = new OpenAIClient(
6064
new ApiKeyCredential(apikey),
@@ -66,6 +70,8 @@ var innerClient = new OpenAIClient(
6670
```
6771

6872
**Ollama Client registration**
73+
74+
>Program.cs
6975
```csharp
7076
var innerClient = new OllamaChatClient(new Uri(endpoint), model);
7177
```

0 commit comments

Comments
 (0)