Skip to content

Commit 93ecd91

Browse files
Merge pull request #4557 from syncfusion-content/979403-AzureAPI
982586: added UG for the Azure Open AI integration with the AI assistview component in the Core and MVC platform
2 parents 4a02b1a + f5dc833 commit 93ecd91

File tree

16 files changed

+154
-139
lines changed

16 files changed

+154
-139
lines changed

ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/gemini-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The Syncfusion AI AssistView supports integration with [Gemini](https://ai.googl
1414

1515
## Getting Started With the AI AssistView control
1616

17-
Before integrating Gemini AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application:
17+
Before integrating Gemini AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your MVC application:
1818

1919
[ MVC Getting Started Guide](../getting-started)
2020

ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/ollama-llm-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The Syncfusion AI AssistView supports integration with [LLM via Ollama](https://
1414

1515
## Getting Started With the AI AssistView control
1616

17-
Before integrating LLM Model, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application:
17+
Before integrating LLM Model, ensure that the Syncfusion AI AssistView control is correctly rendered in your MVC application:
1818

1919
[ MVC Getting Started Guide](../getting-started)
2020

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
---
22
layout: post
3-
title: Open AI in ##Platform_Name## AI AssistView Control | Syncfusion
4-
description: Checkout and learn about Integration of Open AI in Syncfusion ##Platform_Name## AI AssistView control of Syncfusion Essential JS 2 and more.
3+
title: Azure Open AI in ##Platform_Name## AI AssistView Control | Syncfusion
4+
description: Checkout and learn about Integration of Azure Open AI in Syncfusion ##Platform_Name## AI AssistView control of Syncfusion Essential JS 2 and more.
55
platform: ej2-asp-core-mvc
6-
control: Open AI
6+
control: Azure Open AI
77
publishingplatform: ##Platform_Name##
88
documentation: ug
99
---
1010

11-
# Integration of Open AI With AI AssistView control
11+
# Integration of Azure Open AI With AI AssistView control
1212

13-
The Syncfusion AI AssistView supports integration with [OpenAI](https://platform.openai.com/docs/overview), enabling advanced conversational AI features in your MVC applications.
13+
The Syncfusion AI AssistView supports integration with [Azure Open AI](https://microsoft.github.io/PartnerResources/skilling/ai-ml-academy/resources/openai), enabling advanced conversational AI features in your Angular applications.
1414

1515
## Getting Started With the AI AssistView control
1616

17-
Before integrating Open AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application:
17+
Before integrating Azure Open AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your MVC application:
1818

1919
[ MVC Getting Started Guide](../getting-started)
2020

2121
## Prerequisites
2222

23-
* OpenAI account to generate an API key for accessing the `OpenAI` API
23+
* An Azure account with access to `Azure Open AI` services and a generated API key.
2424
* [System requirements for ASP.NET MVC controls](https://ej2.syncfusion.com/aspnetmvc/documentation/system-requirements) to create MVC application
2525

2626
## Install Packages
@@ -33,35 +33,39 @@ NuGet\Install-Package Syncfusion.EJ2.MVC5
3333

3434
```
3535

36-
Install the Open AI package in the application using Package Manager Console.
36+
Install the Open AI and Azure Open AI package in the application using Package Manager Console.
3737

3838
```bash
3939

4040
NuGet\Install-Package OpenAI
41-
41+
NuGet\Install-Package Azure.AI.OpenAI
42+
NuGet\Install-Package Azure.Core
43+
4244
```
4345

44-
## Generate API Key
46+
## Configure Azure Open AI
4547

46-
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+
1. Log in to the [Azure Portal](https://portal.azure.com/#home) and navigate to your Azure Open AI resource.
4749

48-
2. Once logged in, click on your profile icon in the top-right corner and select `API Keys` from the dropdown menu.
50+
2. Under Resource Management, select Keys and Endpoint to retrieve your API key and endpoint URL.
4951

50-
3. Click the `+ Create new secret key` button. You’ll be prompted to name the key (optional). Confirm to generate the key.
52+
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.
5153

52-
4. Your API key will be displayed once. Copy it and store it securely, as it won’t be shown again.
54+
4. Store these values securely, as they will be used in your application.
5355

54-
> `Security Note`: Never commit the API key to version control. Use environment variables or a secret manager for production.
56+
> `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.
5557
56-
## Integration Open AI with AI AssistView
58+
## Integration Azure Open AI with AI AssistView
5759

5860
You can add the below respective files in your application:
5961

60-
* Add your generated `API Key` at the line in .cs file
62+
* Update the following configuration values with your Azure Open AI details:
6163

6264
```bash
6365

64-
string apiKey = 'Place your API key here';
66+
string endpoint = "Your_Azure_OpenAI_Endpoint";
67+
string apiKey = "Your_Azure_OpenAI_API_Key";
68+
string deploymentName = "Your_Deployment_Name";
6569

6670
```
6771

@@ -74,12 +78,12 @@ string apiKey = 'Place your API key here';
7478
{% endhighlight %}
7579
{% endtabs %}
7680

77-
![Open AI](../../images/open-ai.png)
81+
![Azure Open AI](../../images/open-ai.png)
7882

7983
## Run and Test
8084

8185
Run the application in the browser using the following command.
8286

8387
Build and run the app (Ctrl + F5).
8488

85-
Open `https://localhost:44321` to interact with your Open AI for dynamic response.
89+
Open `https://localhost:44321` to interact with your Azure Open AI for dynamic response.

ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/gemini-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The Syncfusion AI AssistView supports integration with [Gemini](https://ai.googl
1414

1515
## Getting Started With the AI AssistView control
1616

17-
Before integrating Gemini AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application:
17+
Before integrating Gemini AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Core application:
1818

1919
[ ASP.NET CORE Getting Started Guide](../getting-started)
2020

ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/ollama-llm-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The Syncfusion AI AssistView supports integration with [LLM via Ollama](https://
1414

1515
## Getting Started With the AI AssistView control
1616

17-
Before integrating LLM Model, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application:
17+
Before integrating LLM Model, ensure that the Syncfusion AI AssistView control is correctly rendered in your Core application:
1818

1919
[ CORE Getting Started Guide](../getting-started)
2020

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
---
22
layout: post
3-
title: Open AI in ##Platform_Name## AI AssistView Control | Syncfusion
4-
description: Checkout and learn about Integration of Open AI in Syncfusion ##Platform_Name## AI AssistView control of Syncfusion Essential JS 2 and more.
3+
title: Azure Open AI in ##Platform_Name## AI AssistView Control | Syncfusion
4+
description: Checkout and learn about Integration of Azure Open AI in Syncfusion ##Platform_Name## AI AssistView control of Syncfusion Essential JS 2 and more.
55
platform: ej2-asp-core-mvc
6-
control: Open AI
6+
control: Azure Open AI
77
publishingplatform: ##Platform_Name##
88
documentation: ug
99
---
1010

11-
# Integration of Open AI With AI AssistView control
11+
# Integration of Azure Open AI With AI AssistView control
1212

13-
The Syncfusion AI AssistView supports integration with [OpenAI](https://platform.openai.com/docs/overview), enabling advanced conversational AI features in your Core applications.
13+
The Syncfusion AI AssistView supports integration with [Azure Open AI](https://microsoft.github.io/PartnerResources/skilling/ai-ml-academy/resources/openai), enabling advanced conversational AI features in your Angular applications.
1414

1515
## Getting Started With the AI AssistView control
1616

17-
Before integrating Open AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application:
17+
Before integrating Azure Open AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Core app:
1818

1919
[ CORE Getting Started Guide](../getting-started)
2020

2121
## Prerequisites
2222

23-
* OpenAI account to generate an API key for accessing the `OpenAI` API
23+
* An Azure account with access to `Azure Open AI` services and a generated API key.
2424
* [System requirements for ASP.NET MVC controls](https://ej2.syncfusion.com/aspnetmvc/documentation/system-requirements) to create Core application
2525

2626
## Install Packages
@@ -33,35 +33,39 @@ NuGet\Install-Package Syncfusion.EJ2.AspNet.Core
3333

3434
```
3535

36-
Install the Open AI package in the application using Package Manager Console.
36+
Install the Open AI and Azure Open AI package in the application using Package Manager Console.
3737

3838
```bash
3939

40-
NuGet\Install-Package
41-
40+
NuGet\Install-Package OpenAI
41+
NuGet\Install-Package Azure.AI.OpenAI
42+
NuGet\Install-Package Azure.Core
43+
4244
```
4345

44-
## Generate API Key
46+
## Configure Azure Open AI
4547

46-
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+
1. Log in to the [Azure Portal](https://portal.azure.com/#home) and navigate to your Azure Open AI resource.
4749

48-
2. Once logged in, click on your profile icon in the top-right corner and select `API Keys` from the dropdown menu.
50+
2. Under Resource Management, select Keys and Endpoint to retrieve your API key and endpoint URL.
4951

50-
3. Click the `+ Create new secret key` button. You’ll be prompted to name the key (optional). Confirm to generate the key.
52+
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.
5153

52-
4. Your API key will be displayed once. Copy it and store it securely, as it won’t be shown again.
54+
4. Store these values securely, as they will be used in your application.
5355

54-
> `Security Note`: Never commit the API key to version control. Use environment variables or a secret manager for production.
56+
> `Security Note`: Never expose your API key in client-side code for production applications. Use a server-side proxy or environment variables to manage sensitive information securely.
5557
56-
## Integration Open AI with AI AssistView
58+
## Integration Azure Open AI with AI AssistView
5759

5860
You can add the below respective files in your application:
5961

60-
* Add your generated `API Key` at the line in .cs file
62+
* Update the following configuration values with your Azure Open AI details:
6163

6264
```bash
6365

64-
string apiKey = 'Place your API key here';
66+
string endpoint = "Your_Azure_OpenAI_Endpoint";
67+
string apiKey = "Your_Azure_OpenAI_API_Key";
68+
string deploymentName = "Your_Deployment_Name";
6569

6670
```
6771

@@ -74,12 +78,12 @@ string apiKey = 'Place your API key here';
7478
{% endhighlight %}
7579
{% endtabs %}
7680

77-
![Open AI](../../images/open-ai.png)
81+
![Azure Open AI](../../images/open-ai.png)
7882

7983
## Run and Test
8084

8185
Run the application in the browser using the following command.
8286

8387
Build and run the app (Ctrl + F5).
8488

85-
Open `https://localhost:44321` to interact with your Open AI for dynamic response.
89+
Open `https://localhost:44321` to interact with your Azure Open AI for dynamic response.

ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminicore.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,3 @@ public class ToolbarItemModel
7777
public string iconCss { get; set; }
7878
}
7979
}
80-
}

ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminimvc.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ public async Task<IActionResult> GetAIResponse([FromBody] PromptRequest request)
4848

4949
if (string.IsNullOrEmpty(responseText?.Text))
5050
{
51-
_logger.LogError("OpenAI API returned no text.");
52-
return BadRequest("No response from OpenAI.");
51+
_logger.LogError("Gemini API returned no text.");
52+
return BadRequest("No response from Gemini.");
5353
}
5454

55-
_logger.LogInformation("OpenAI response received: {Response}", responseText?.Text);
55+
_logger.LogInformation("Gemini response received: {Response}", responseText?.Text);
5656
return Json(responseText?.Text);
5757
}
5858
catch (Exception ex)
5959
{
60-
_logger.LogError("Exception in OpenAI call: {Message}", ex.Message);
60+
_logger.LogError("Exception in Gemini call: {Message}", ex.Message);
6161
return BadRequest($"Error generating response: {ex.Message}");
6262
}
6363
}

ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/razor

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
streamResponse(text);
8484
})
8585
.catch(error => {
86-
console.error('Error fetching AI response:', error);
8786
assistObj.addPromptResponse('⚠️ Something went wrong while connecting to the AI service. Please try again later.');
8887
stopStreaming = true;
8988
});

ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/tagHelper

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
streamResponse(text);
8080
})
8181
.catch(error => {
82-
console.error('Error fetching AI response:', error);
8382
assistObj.addPromptResponse('⚠️ Something went wrong while connecting to the AI service. Please try again later.');
8483
stopStreaming = true;
8584
});

0 commit comments

Comments
 (0)