You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Open AI Integration with Blazor Chat UI Component | Syncfusion
4
-
description: Checkout and learn about Open AI integration with Blazor Chat UI component in Blazor WebAssembly Application.
3
+
title: Azure Open AI with Blazor Chat UI Component | Syncfusion
4
+
description: Checkout and learn about Azure Open AI with Blazor Chat UI component in Blazor WebAssembly Application.
5
5
platform: Blazor
6
6
control: Chat UI
7
7
documentation: ug
8
8
---
9
9
10
-
# Integration of Open AI With Blazor Chat UI component
10
+
# Integration of Azure OpenAI With Blazor Chat UI component
11
11
12
-
The Syncfusion Chat UI supports integration with [OpenAI](https://platform.openai.com/docs/overview), enabling advanced conversational AI features in your applications.
12
+
The Syncfusion Chat UI supports integration with [Azure Open AI](https://microsoft.github.io/PartnerResources/skilling/ai-ml-academy/resources/openai), enabling advanced conversational AI features in your applications.
13
13
14
14
## Prerequisites
15
15
16
-
* OpenAI account to generate an API key for accessing the `OpenAI`API
17
-
* Syncfusion Chat UI for Blazor `Syncfusion.Blazor.InteractiveChat` installed in your project.
16
+
- An Azure account with access to `Azure Open AI` services and a generated API key.
17
+
- Syncfusion Chat UI for Blazor `Syncfusion.Blazor.InteractiveChat` installed in the project
18
18
19
19
## Getting Started with the Chat UI Component
20
20
21
-
Before integrating Open AI, ensure that the Syncfusion Chat UI is correctly rendered in your application:
21
+
Before integrating Azure OpenAI, ensure the Syncfusion Chat UI component renders correctly in the application:
22
22
23
-
[Blazor Getting Started Guide](../getting-started)
23
+
[Blazor Getting Started Guide](../getting-started)
24
24
25
25
## Install Dependencies
26
26
27
27
Install the Syncfusion Blazor package in the application.
Install the Open AI AI package in the application.
35
+
Install the `Open AI` and `Markdig` nuget packages in the application.
36
36
37
37
```bash
38
38
39
-
Install-Package OpenAI
39
+
NuGet\Install-Package OpenAI
40
+
NuGet\Install-Package Azure.AI.OpenAI
41
+
NuGet\Install-Package Azure.Core
42
+
Nuget\Install-Package Markdig
40
43
41
44
```
42
45
43
-
## Generate API Key
46
+
Note: The sample below uses HttpClient directly and does not require the Azure/OpenAI SDKs.
44
47
45
-
1. Go to [Open AI](https://platform.openai.com/docs/overview) and sign in with your Google account. If you don’t have one, create a new account.
48
+
## Configure Azure Open AI
46
49
47
-
2. Once logged in, click on your profile icon in the top-right corner and select `API Keys` from the dropdown menu.
50
+
1. Log in to the [Azure Portal](https://portal.azure.com/#home) and navigate to your Azure Open AI resource.
48
51
49
-
3. Click the `+ Create new secret key` button. You’ll be prompted to name the key (optional). Confirm to generate the key.
52
+
2. Under Resource Management, select Keys and Endpoint to retrieve your API key and endpoint URL.
50
53
51
-
4. Your API key will be displayed once. Copy it and store it securely, as it won’t be shown again.
54
+
3. Copy the API key, endpoint, and deployment name (e.g., gpt-4o-mini). Ensure the API version (e.g., 2024-07-01-preview) matches your resource configuration.
52
55
53
-
> `Security Note`: Never commit the API key to version control. Use environment variables or a secret manager for production.
56
+
4. Store these values securely, as they will be used in your application.
54
57
55
-
## Integration Open AI with Chat UI
58
+
> `Security Note`: expose your API key in client-side code for production applications. Use a server-side proxy or environment variables to manage sensitive information securely.
56
59
57
-
* Add your generated `API Key` at the line
60
+
## Integration Azure OpenAI with Chat UI
58
61
59
-
```bash
62
+
- Configure your Azure OpenAI endpoint, API key, and deployment name in your **Program.cs** (or using your preferred configuration mechanism).
60
63
61
-
const string openaiApiKey = 'Place your API key here';
64
+
- Register the service for dependency injection.
62
65
63
-
```
66
+
- Inject and use the service in your Razor component.
0 commit comments