From 26cf19a88072ee244e318aec4772b63f2d12dc9e Mon Sep 17 00:00:00 2001 From: KaviBharathi-SF5060 Date: Tue, 23 Sep 2025 17:31:01 +0530 Subject: [PATCH 1/2] 979100: Added gemini and openai samples --- .../ai-integrations/gemini-integration.md | 85 +++++++++++++ .../ai-integrations/openai-integration.md | 85 +++++++++++++ .../ai-integrations/gemini-integration.md | 85 +++++++++++++ .../ai-integrations/openai-integration.md | 85 +++++++++++++ .../ai-assistview/images/gemini-ai.png | Bin 0 -> 15448 bytes .../ai-assistview/images/open-ai.png | Bin 0 -> 15696 bytes .../ai-integrations/gemini-ai/geminicore.cs | 80 +++++++++++++ .../ai-integrations/gemini-ai/geminimvc.cs | 65 ++++++++++ .../ai-integrations/gemini-ai/razor | 112 ++++++++++++++++++ .../ai-integrations/gemini-ai/tagHelper | 108 +++++++++++++++++ .../ai-integrations/open-ai/openaicore.cs | 82 +++++++++++++ .../ai-integrations/open-ai/openaimvc.cs | 63 ++++++++++ .../ai-integrations/open-ai/razor | 108 +++++++++++++++++ .../ai-integrations/open-ai/tagHelper | 110 +++++++++++++++++ ej2-asp-core-toc.html | 10 ++ ej2-asp-mvc-toc.html | 10 ++ 16 files changed, 1088 insertions(+) create mode 100644 ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/gemini-integration.md create mode 100644 ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/openai-integration.md create mode 100644 ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/gemini-integration.md create mode 100644 ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/openai-integration.md create mode 100644 ej2-asp-core-mvc/ai-assistview/images/gemini-ai.png create mode 100644 ej2-asp-core-mvc/ai-assistview/images/open-ai.png create mode 100644 ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminicore.cs create mode 100644 ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminimvc.cs create mode 100644 ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/razor create mode 100644 ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/tagHelper create mode 100644 ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaicore.cs create mode 100644 ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaimvc.cs create mode 100644 ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/razor create mode 100644 ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/tagHelper diff --git a/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/gemini-integration.md b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/gemini-integration.md new file mode 100644 index 0000000000..2609a71f64 --- /dev/null +++ b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/gemini-integration.md @@ -0,0 +1,85 @@ +--- +layout: post +title: Gemini AI in ##Platform_Name## AI AssistView Control | Syncfusion +description: Checkout and learn about Integration of Gemini AI in Syncfusion ##Platform_Name## AI AssistView control of Syncfusion Essential JS 2 and more. +platform: ej2-asp-core-mvc +control: Gemini AI +publishingplatform: ##Platform_Name## +documentation: ug +--- + +# Integration of Gemini AI With AI AssistView control + +The Syncfusion AI AssistView supports integration with [Gemini](https://ai.google.dev/gemini-api/docs), enabling advanced conversational AI features in your MVC applications. + +## Getting Started With the AI AssistView control + +Before integrating Gemini AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application: + +[ MVC Getting Started Guide](../getting-started) + +## Prerequisites + +* Google account to generate API key on accessing `Gemini AI`. +* [System requirements for ASP.NET MVC controls](https://ej2.syncfusion.com/aspnetmvc/documentation/system-requirements) to create MVC application + +## Install Packages + +Install the Syncfusion ASP.NET MVC package in the application using Package Manager Console. + +```bash + +NuGet\Install-Package Syncfusion.EJ2.MVC5 + +``` + +Install the Gemini AI package in the application using Package Manager Console. + +```bash + +NuGet\Install-Package Mscc.GenerativeAI + +``` + +## Generate API Key + +1. Go to [Google AI Studio](https://aistudio.google.com/app/apikey) and sign in with your Google account. If you don’t have one, create a new account. + +2. Once logged in, click on `Get API Key` from the left-hand menu or the top-right corner of the dashboard. + +3. Click the `Create API Key` button. You’ll be prompted to either select an existing Google Cloud project or create a new one. Choose the appropriate option and proceed. + +4. After selecting or creating a project, your API key will be generated and displayed. Copy the key and store it securely, as it will only be shown once. + +> `Security Note`: Never commit the API key to version control. Use environment variables or a secret manager for production. + +## Integration Gemini AI with AI AssistView + +You can add the below respective files in your application: + +* Add your generated `API Key` at the line + +```bash + +string apiKey = 'Place your API key here'; + +``` + +{% tabs %} +{% highlight razor tabtitle="CSHTML" %} +{% include code-snippet/ai-assistview/ai-integrations/gemini-ai/razor %} +{% endhighlight %} +{% highlight c# tabtitle="Gemini.cs" %} +{% include code-snippet/ai-assistview/ai-integrations/gemini-ai/geminimvc.cs %} +{% endhighlight %} +{% endtabs %} + +![Gemini AI](../../images/gemini-ai.png) + +## Run and Test + +Run the application in the browser using the following command. + +Build and run the app (Ctrl + F5). + +Open `https://localhost:44321` to interact with your Gemini AI for dynamic response. \ No newline at end of file diff --git a/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/openai-integration.md b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/openai-integration.md new file mode 100644 index 0000000000..0eb8794334 --- /dev/null +++ b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/openai-integration.md @@ -0,0 +1,85 @@ +--- +layout: post +title: Open AI in ##Platform_Name## AI AssistView Control | Syncfusion +description: Checkout and learn about Integration of Open AI in Syncfusion ##Platform_Name## AI AssistView control of Syncfusion Essential JS 2 and more. +platform: ej2-asp-core-mvc +control: Open AI +publishingplatform: ##Platform_Name## +documentation: ug +--- + +# Integration of Open AI With AI AssistView control + +The Syncfusion AI AssistView supports integration with [OpenAI](https://platform.openai.com/docs/overview), enabling advanced conversational AI features in your MVC applications. + +## Getting Started With the AI AssistView control + +Before integrating Open AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application: + +[ MVC Getting Started Guide](../getting-started) + +## Prerequisites + +* OpenAI account to generate an API key for accessing the `OpenAI` API +* [System requirements for ASP.NET MVC controls](https://ej2.syncfusion.com/aspnetmvc/documentation/system-requirements) to create MVC application + +## Install Packages + +Install the Syncfusion ASP.NET MVC package in the application using Package Manager Console. + +```bash + +NuGet\Install-Package Syncfusion.EJ2.MVC5 + +``` + +Install the Open AI package in the application using Package Manager Console. + +```bash + +NuGet\Install-Package OpenAI + +``` + +## Generate API Key + +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. + +2. Once logged in, click on your profile icon in the top-right corner and select `API Keys` from the dropdown menu. + +3. Click the `+ Create new secret key` button. You’ll be prompted to name the key (optional). Confirm to generate the key. + +4. Your API key will be displayed once. Copy it and store it securely, as it won’t be shown again. + +> `Security Note`: Never commit the API key to version control. Use environment variables or a secret manager for production. + +## Integration Open AI with AI AssistView + +You can add the below respective files in your application: + +* Add your generated `API Key` at the line in .cs file + +```bash + +string apiKey = 'Place your API key here'; + +``` + +{% tabs %} +{% highlight razor tabtitle="CSHTML" %} +{% include code-snippet/ai-assistview/ai-integrations/open-ai/razor %} +{% endhighlight %} +{% highlight c# tabtitle="Gemini.cs" %} +{% include code-snippet/ai-assistview/ai-integrations/open-ai/openaimvc.cs %} +{% endhighlight %} +{% endtabs %} + +![Open AI](../../images/open-ai.png) + +## Run and Test + +Run the application in the browser using the following command. + +Build and run the app (Ctrl + F5). + +Open `https://localhost:44321` to interact with your Open AI for dynamic response. \ No newline at end of file diff --git a/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/gemini-integration.md b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/gemini-integration.md new file mode 100644 index 0000000000..2147662596 --- /dev/null +++ b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/gemini-integration.md @@ -0,0 +1,85 @@ +--- +layout: post +title: Gemini AI in ##Platform_Name## AI AssistView Control | Syncfusion +description: Checkout and learn about Integration of Gemini AI in Syncfusion ##Platform_Name## AI AssistView control of Syncfusion Essential JS 2 and more. +platform: ej2-asp-core-mvc +control: Gemini AI +publishingplatform: ##Platform_Name## +documentation: ug +--- + +# Integration of Gemini AI With AI AssistView control + +The Syncfusion AI AssistView supports integration with [Gemini](https://ai.google.dev/gemini-api/docs), enabling advanced conversational AI features in your Core applications. + +## Getting Started With the AI AssistView control + +Before integrating Gemini AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application: + +[ ASP.NET CORE Getting Started Guide](../getting-started) + +## Prerequisites + +* Google account to generate API key on accessing `Gemini AI`. +* [System requirements for ASP.NET Core controls](https://ej2.syncfusion.com/aspnetmvc/documentation/system-requirements) to create Core application + +## Install Packages + +Install the Syncfusion ASP.NET Core package in the application using Package Manager Console. + +```bash + +NuGet\Install-Package Syncfusion.EJ2.AspNet.Core + +``` + +Install the Gemini AI package in the application using Package Manager Console. + +```bash + +NuGet\Install-Package Mscc.GenerativeAI + +``` + +## Generate API Key + +1. Go to [Google AI Studio](https://aistudio.google.com/app/apikey) and sign in with your Google account. If you don’t have one, create a new account. + +2. Once logged in, click on `Get API Key` from the left-hand menu or the top-right corner of the dashboard. + +3. Click the `Create API Key` button. You’ll be prompted to either select an existing Google Cloud project or create a new one. Choose the appropriate option and proceed. + +4. After selecting or creating a project, your API key will be generated and displayed. Copy the key and store it securely, as it will only be shown once. + +> `Security Note`: Never commit the API key to version control. Use environment variables or a secret manager for production. + +## Integration Gemini AI with AI AssistView + +You can add the below respective files in your application: + +* Add your generated `API Key` at the line + +```bash + +string apiKey = 'Place your API key here'; + +``` + +{% tabs %} +{% highlight razor tabtitle="CSHTML" %} +{% include code-snippet/ai-assistview/ai-integrations/gemini-ai/tagHelper %} +{% endhighlight %} +{% highlight c# tabtitle="Gemini.cs" %} +{% include code-snippet/ai-assistview/ai-integrations/gemini-ai/geminicore.cs %} +{% endhighlight %} +{% endtabs %} + +![Gemini AI](../../images/gemini-ai.png) + +## Run and Test + +Run the application in the browser using the following command. + +Build and run the app (Ctrl + F5). + +Open `https://localhost:44321` to interact with your Gemini AI for dynamic response. \ No newline at end of file diff --git a/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/openai-integration.md b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/openai-integration.md new file mode 100644 index 0000000000..85ea6748e8 --- /dev/null +++ b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/openai-integration.md @@ -0,0 +1,85 @@ +--- +layout: post +title: Open AI in ##Platform_Name## AI AssistView Control | Syncfusion +description: Checkout and learn about Integration of Open AI in Syncfusion ##Platform_Name## AI AssistView control of Syncfusion Essential JS 2 and more. +platform: ej2-asp-core-mvc +control: Open AI +publishingplatform: ##Platform_Name## +documentation: ug +--- + +# Integration of Open AI With AI AssistView control + +The Syncfusion AI AssistView supports integration with [OpenAI](https://platform.openai.com/docs/overview), enabling advanced conversational AI features in your Core applications. + +## Getting Started With the AI AssistView control + +Before integrating Open AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application: + +[ CORE Getting Started Guide](../getting-started) + +## Prerequisites + +* OpenAI account to generate an API key for accessing the `OpenAI` API +* [System requirements for ASP.NET MVC controls](https://ej2.syncfusion.com/aspnetmvc/documentation/system-requirements) to create Core application + +## Install Packages + +Install the Syncfusion ASP.NET Core package in the application using Package Manager Console. + +```bash + +NuGet\Install-Package Syncfusion.EJ2.AspNet.Core + +``` + +Install the Open AI package in the application using Package Manager Console. + +```bash + +NuGet\Install-Package + +``` + +## Generate API Key + +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. + +2. Once logged in, click on your profile icon in the top-right corner and select `API Keys` from the dropdown menu. + +3. Click the `+ Create new secret key` button. You’ll be prompted to name the key (optional). Confirm to generate the key. + +4. Your API key will be displayed once. Copy it and store it securely, as it won’t be shown again. + +> `Security Note`: Never commit the API key to version control. Use environment variables or a secret manager for production. + +## Integration Open AI with AI AssistView + +You can add the below respective files in your application: + +* Add your generated `API Key` at the line in .cs file + +```bash + +string apiKey = 'Place your API key here'; + +``` + +{% tabs %} +{% highlight razor tabtitle="CSHTML" %} +{% include code-snippet/ai-assistview/ai-integrations/open-ai/tagHelper %} +{% endhighlight %} +{% highlight c# tabtitle="Gemini.cs" %} +{% include code-snippet/ai-assistview/ai-integrations/open-ai/openaicore.cs %} +{% endhighlight %} +{% endtabs %} + +![Open AI](../../images/open-ai.png) + +## Run and Test + +Run the application in the browser using the following command. + +Build and run the app (Ctrl + F5). + +Open `https://localhost:44321` to interact with your Open AI for dynamic response. \ No newline at end of file diff --git a/ej2-asp-core-mvc/ai-assistview/images/gemini-ai.png b/ej2-asp-core-mvc/ai-assistview/images/gemini-ai.png new file mode 100644 index 0000000000000000000000000000000000000000..bbc60975ac91ef25be8fee60022647949f35ddbf GIT binary patch literal 15448 zcmeHucT`i|yJi3Z6$BM2B1HwH7YisQfFjbQ_s~Up4?PG05l|8Mq)P9dfC8a+q)Ue& zy%Ty5p#(A~e)rDYxohU$xxZQWk2`BzxRP_uK6}5rz59Ki=gB8E6}f9y8Lxssplb^9 zFEv0Q5(yB9sP{4%aAz{t&j(tBT(t?5fUlmNENiL3wwipL?0*TI-w8&>_c8B4|PW zjb@^omuYIvVm{u!+xj*|YDLa+`xpD;dr~EJCg@*-hGXutuKi#cD17DAWpZM2(w7*p z5k$hFPeJ%>x^;<#@Y#NUm+&DJ+lxMEOKKgKr6pV*iYNA3@~>;;Hql(L1&{-GnoMu9 zcr9F!x)H#6+<2`cyc2y81im+pc6@!6x{3$^R%EYqtJ$-zyF=(^ zle9d0ncG!~H@9sGPXqPtdvmP+B|`Yl@N1!0K;6fS@V)8M|2znEf4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ip*qc}@W$1<0&wHcNYid9k)e!mhFHVRx($WMslX8N=NfJ`UP(NQ*`t03(S4 zdd1SoEz}!Rc~dIt`-d1NKw#+~+6ElogaD18`~Bbj^zYx%@;(2s*`vXsK!~a-MpF$4 zbO+f8@Qn~mYy5Vn7@++-q^GHN<^JW0y%TndriQq!<-JXo+&~i0Ny=|?m@euP=3L#K zU*$UH-{jc|43di9L1p~uJaX}}IAGeqmEh!A9KRX)9v}dHI0~OvKc{y9(0(A`kMh+o zC>1O-2z~eq=*r*0cW^W?pfVGL#OS~Og7M$!#{b0#{O7* rGyW0MH(jE%0S56OoxOk9b_||`7Igo__)|+F!72q=m6ydYOyB=EUPI`c literal 0 HcmV?d00001 diff --git a/ej2-asp-core-mvc/ai-assistview/images/open-ai.png b/ej2-asp-core-mvc/ai-assistview/images/open-ai.png new file mode 100644 index 0000000000000000000000000000000000000000..c30c78379fb5fcdaa809c7d90a5cd5e93057f98e GIT binary patch literal 15696 zcmeIZcTiN%*C#xPib^seC`m*l=j4zTkt9)uoRORvg2W+%ARsw2z*uTg}TMmK=x+YT~XP!Ncu z4fh|f)4uQn2qdy1`{tF}NB!+Nn6uik9~L|LJQ;-dllDz2-51ckK$+?gTE_kY48nP3 zsYlQ@a-wwnnNKDa;zrh;TXym~IsW1j8!-wi_^NZ-;tg6=)oiujm|W=yx{BVKTqlru z`fe*2LT~0v#EZV@yzJ`hf5#KMQ131_keuU=TtE+`3rji~9AX@8#o&W?0RlmqZ({0k zzd<*7QjI96PnLfUU&lRqMD&~Sk_Y`H0x!06r{La5z;BU)QLPX7m#>F!MAF6^QDnh$ z_;9QA)qg<5Cy=TD{AevPzKvtm?z&CN*O?|A$GeW$v%+;=BTthSn+Qykz4u-E>mwR2 zB1tj05;@1meh990h*S65@A$!0Yu-O>W?lOP)UQc^x4xL})x)>%%5R6=0;A3Z#o(Mx zPjFwKN9^gR?Xiv8DMf$b7r%c-Lc#Z7f zG|f-9aE<4&7E=sXUAS((eqmqmf#0pFw}4#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wEra9P5AcLam|WXsU$G(i_GK zn2veTEclfq#=ltuKnK8WtNs~$30e!FZq&6=53t2CusnTl%#=CetWcYA!;0Vdr;I{! zN^!~7mNI2#9Z*U{a1AeSo~$bIseQMQX?)P2-WQbEV|S%{(u+d2fGi*s77wY^5q9bq z=T8R-hYlpM!g zAhG#T2=TaH7rDd;n$p?gf^KfJ&p1aX^;&aSs^2pN#{y9`eio%|ZM~!UrUKW4omZjn z*UU208+>=!MPWd=LuPEM%8pvx^_^r0N$kvA36M3=^Jyn**s2@`JS!ARG!hs_T|bMF z!293vJuhskpjG?ms|^QGb*TtA7+bE5K;@!a5`bJiJQQ(d zzZ%?(1OS8v+#BHEzjhDve^j7_vRuTd$&R$Q#njaQ;e`UVSQ7AQ-Th<$NwWp%)q!3K zv~dwZjg(7-LyaB2U5tC+fOo@3%}M|}^8>+1&{6X5<8IP2>b%6=K0XbTF92R&>wfhP zd8ME4_6iQORdClRk}bFyUpS6EsKN$EdIz+ Vn9jIo+9<9;R!Z?r*=s}p{|4> + { + new ToolbarItemModel + { + iconCss = "e-icons e-refresh", + align = "Right", + } + }; + + // Initialize prompt suggestions + ViewModel.PromptSuggestionData = new string[] + { + "What are the best tools for organizing my tasks?", + "How can I maintain work-life balance effectively?" + }; + } + public async Task OnPostGetAIResponse([FromBody] PromptRequest request) + { + try + { + _logger.LogInformation("Received request with prompt: {Prompt}", request?.Prompt); + + if (string.IsNullOrEmpty(request?.Prompt)) + { + _logger.LogWarning("Prompt is null or empty."); + return BadRequest("Prompt cannot be empty."); + } + + string apiKey = ""; // Replace with your key + var googleAI = new GoogleAI(apiKey: apiKey); + var model = googleAI.GenerativeModel(model: Model.Gemini15Flash); + + var response = await model.GenerateContent(request.Prompt); + + if (string.IsNullOrEmpty(response?.Text)) + { + _logger.LogError("Gemini API returned no text."); + return BadRequest("No response from Gemini."); + } + + _logger.LogInformation("Gemini response received: {Response}", response.Text); + return new JsonResult(response.Text); + } + catch (Exception ex) + { + _logger.LogError("Exception in Gemini call: {Message}", ex.Message); + return BadRequest($"Error generating response: {ex.Message}"); + } + } + } + + public class IndexViewModel + { + public List Items { get; set; } = new List(); + public string[] PromptSuggestionData { get; set; } + } + + public class PromptRequest + { + public string Prompt { get; set; } + } + + public class ToolbarItemModel + { + public string align { get; set; } + public string iconCss { get; set; } + } + } +} \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminimvc.cs b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminimvc.cs new file mode 100644 index 0000000000..97ddd2c5f4 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminimvc.cs @@ -0,0 +1,65 @@ +using Mscc.GenerativeAI; + +namespace AssistViewDemo.Controllers +{ + public class HomeController : Controller + { + + public List Items { get; set; } = new List(); + + public IActionResult Index() + { + Items.Add(new ToolbarItemModel { iconCss = "e-icons e-refresh", align = "Right" }); + ViewBag.Items = Items; + var PromptSuggestionData = new string[] + { + "What are the best tools for organizing my tasks?", + "How can I maintain work-life balance effectively?" + }; + ViewBag.PromptSuggestionData = PromptSuggestionData; + return View(); + } + + public class ToolbarItemModel + { + public string iconCss { get; set; } + public string align { get; set; } + } + + + [HttpPost] + public async Task GetAIResponse([FromBody] PromptRequest request) + { + try + { + _logger.LogInformation("Received request with prompt: {Prompt}", request?.Prompt); + + if (string.IsNullOrEmpty(request?.Prompt)) + { + _logger.LogWarning("Prompt is null or empty."); + return BadRequest("Prompt cannot be empty."); + } + + string apiKey = ""; // Replace with your key + var googleAI = new GoogleAI(apiKey: apiKey); + var model = googleAI.GenerativeModel(model: Model.Gemini15Flash); + + var responseText = await model.GenerateContent(request.Prompt); + + if (string.IsNullOrEmpty(responseText?.Text)) + { + _logger.LogError("OpenAI API returned no text."); + return BadRequest("No response from OpenAI."); + } + + _logger.LogInformation("OpenAI response received: {Response}", responseText?.Text); + return Json(responseText?.Text); + } + catch (Exception ex) + { + _logger.LogError("Exception in OpenAI call: {Message}", ex.Message); + return BadRequest($"Error generating response: {ex.Message}"); + } + } + } +} \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/razor b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/razor new file mode 100644 index 0000000000..ebec3a9e57 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/razor @@ -0,0 +1,112 @@ +@using Syncfusion.EJ2.InteractiveChat +@using Syncfusion.EJ2 + +@{ + ViewData["Title"] = "AI Assistance with OpenAI"; +} + +
+ @Html.EJS().AIAssistView("aiAssistView").BannerTemplate("#bannerContent").PromptSuggestions(ViewBag.PromptSuggestionData).PromptRequest("onPromptRequest").Created("onCreated").ToolbarSettings(new AIAssistViewToolbarSettings() +{ + Items = ViewBag.Items, + ItemClicked = "toolbarItemClicked" +}).StopRespondingClick("stopRespondingClick").Render() +
+ + + + + + + + \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/tagHelper b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/tagHelper new file mode 100644 index 0000000000..0e59d545ac --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/tagHelper @@ -0,0 +1,108 @@ +@using Syncfusion.EJ2.InteractiveChat +@{ + ViewData["Title"] = "AI Assistance with Gemini"; +} + +
+ + + +
+ + + + + + \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaicore.cs b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaicore.cs new file mode 100644 index 0000000000..b816468cf6 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaicore.cs @@ -0,0 +1,82 @@ +using OpenAI; + +namespace WebApplication4.Pages +{ + public class IndexModel : PageModel + { + + public IndexViewModel ViewModel { get; set; } = new IndexViewModel(); + public void OnGet() + { + // Initialize toolbar items + ViewModel.Items = new List + { + new ToolbarItemModel + { + iconCss = "e-icons e-refresh", + align = "Right", + } + }; + + // Initialize prompt suggestions + ViewModel.PromptSuggestionData = new string[] + { + "What are the best tools for organizing my tasks?", + "How can I maintain work-life balance effectively?" + }; + } + + public async Task OnPostGetAIResponse([FromBody] PromptRequest request) + { + try + { + _logger.LogInformation("Received request with prompt: {Prompt}", request?.Prompt); + + if (string.IsNullOrEmpty(request?.Prompt)) + { + _logger.LogWarning("Prompt is null or empty."); + return BadRequest("Prompt cannot be empty."); + } + + string apiKey = ""; // Replace with your OpenAI API key + var openAiClient = new OpenAIClient(apiKey); + var chatClient = openAiClient.GetChatClient("gpt-4o-mini"); // Use your preferred model, e.g., "gpt-4o-mini" or "gpt-4o" + + ChatCompletion completion = await chatClient.CompleteChatAsync(request.Prompt); + string responseText = completion.Content[0].Text; + + if (string.IsNullOrEmpty(responseText)) + { + _logger.LogError("OpenAI API returned no text."); + return BadRequest("No response from OpenAI."); + } + + _logger.LogInformation("OpenAI response received: {Response}", responseText); + return new JsonResult(responseText); + } + catch (Exception ex) + { + _logger.LogError("Exception in Gemini call: {Message}", ex.Message); + return BadRequest($"Error generating response: {ex.Message}"); + } + } + } + + public class IndexViewModel + { + public List Items { get; set; } = new List(); + public string[] PromptSuggestionData { get; set; } + } + + public class PromptRequest + { + public string Prompt { get; set; } + } + + public class ToolbarItemModel + { + public string align { get; set; } + public string iconCss { get; set; } + } + } +} \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaimvc.cs b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaimvc.cs new file mode 100644 index 0000000000..420cb12b8b --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaimvc.cs @@ -0,0 +1,63 @@ +using OpenAI; + +namespace AssistViewDemo.Controllers +{ + public class HomeController : Controller + { + + public List Items { get; set; } = new List(); + + public IActionResult Index() + { + Items.Add(new ToolbarItemModel { iconCss = "e-icons e-refresh", align = "Right" }); + ViewBag.Items = Items; + var PromptSuggestionData = new string[] + { + "What are the best tools for organizing my tasks?", + "How can I maintain work-life balance effectively?" + }; + ViewBag.PromptSuggestionData = PromptSuggestionData; + return View(); + } + public class ToolbarItemModel + { + public string iconCss { get; set; } + public string align { get; set; } + } + [HttpPost] + public async Task GetAIResponse([FromBody] PromptRequest request) + { + try + { + _logger.LogInformation("Received request with prompt: {Prompt}", request?.Prompt); + + if (string.IsNullOrEmpty(request?.Prompt)) + { + _logger.LogWarning("Prompt is null or empty."); + return BadRequest("Prompt cannot be empty."); + } + + string apiKey = ""; // Replace with your OpenAI API key + var openAiClient = new OpenAIClient(apiKey); + var chatClient = openAiClient.GetChatClient("gpt-4o-mini"); // Use your preferred model, e.g., "gpt-4o-mini" or "gpt-4o" + + OpenAI.Chat.ChatCompletion completion = await chatClient.CompleteChatAsync(request.Prompt); + string responseText = completion.Content[0].Text; + + if (string.IsNullOrEmpty(responseText)) + { + _logger.LogError("OpenAI API returned no text."); + return BadRequest("No response from OpenAI."); + } + + _logger.LogInformation("OpenAI response received: {Response}", responseText); + return Json(responseText); + } + catch (Exception ex) + { + _logger.LogError("Exception in OpenAI call: {Message}", ex.Message); + return BadRequest($"Error generating response: {ex.Message}"); + } + } + } +} \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/razor b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/razor new file mode 100644 index 0000000000..ec06bf95ac --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/razor @@ -0,0 +1,108 @@ +@using Syncfusion.EJ2.InteractiveChat + +@{ + ViewData["Title"] = "AI Assistance with OpenAI"; +} + +
+ @Html.EJS().AIAssistView("aiAssistView").BannerTemplate("#bannerContent").PromptSuggestions(ViewBag.PromptSuggestionData).PromptRequest("onPromptRequest").Created("onCreated").ToolbarSettings(new AIAssistViewToolbarSettings() +{ + Items = ViewBag.Items, + ItemClicked = "toolbarItemClicked" +}).StopRespondingClick("stopRespondingClick").Render() +
+ + + + + + \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/tagHelper b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/tagHelper new file mode 100644 index 0000000000..f7edb648cc --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/tagHelper @@ -0,0 +1,110 @@ +@using Syncfusion.EJ2.InteractiveChat + +@{ + ViewData["Title"] = "AI Assistance with Gemini"; +} + +
+ + + +
+ + + + + + \ No newline at end of file diff --git a/ej2-asp-core-toc.html b/ej2-asp-core-toc.html index 49e7c72bff..fd587ea82f 100644 --- a/ej2-asp-core-toc.html +++ b/ej2-asp-core-toc.html @@ -200,6 +200,16 @@
  • Getting Started
  • Assist view
  • +
  • AI Integrations + +
  • Toolbar items
  • Custom views
  • File attachments
  • diff --git a/ej2-asp-mvc-toc.html b/ej2-asp-mvc-toc.html index 0241d82d8e..83b363a019 100644 --- a/ej2-asp-mvc-toc.html +++ b/ej2-asp-mvc-toc.html @@ -154,6 +154,16 @@
    • Getting Started
    • Assist view
    • +
    • AI Integrations + +
    • Toolbar items
    • Custom views
    • File attachments
    • From 3baee0e44f76ba7980408ceb361196368befb549 Mon Sep 17 00:00:00 2001 From: TamilRamGanesan-SF5080 Date: Thu, 25 Sep 2025 17:50:11 +0530 Subject: [PATCH 2/2] 979100: conversation of open ai to azure open ai --- .../ai-integrations/gemini-integration.md | 2 +- .../ai-integrations/openai-integration.md | 44 +++---- .../ai-integrations/gemini-integration.md | 2 +- .../ai-integrations/openai-integration.md | 46 ++++---- .../ai-integrations/gemini-ai/geminicore.cs | 3 +- .../ai-integrations/gemini-ai/geminimvc.cs | 8 +- .../ai-integrations/open-ai/openaicore.cs | 31 +++-- .../ai-integrations/open-ai/openaimvc.cs | 30 +++-- .../ai-integrations/open-ai/razor | 9 +- .../ai-integrations/open-ai/tagHelper | 110 +++++++++--------- ej2-asp-core-toc.html | 2 +- ej2-asp-mvc-toc.html | 2 +- 12 files changed, 154 insertions(+), 135 deletions(-) diff --git a/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/gemini-integration.md b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/gemini-integration.md index 2609a71f64..4850316d1d 100644 --- a/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/gemini-integration.md +++ b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/gemini-integration.md @@ -14,7 +14,7 @@ The Syncfusion AI AssistView supports integration with [Gemini](https://ai.googl ## Getting Started With the AI AssistView control -Before integrating Gemini AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application: +Before integrating Gemini AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your MVC application: [ MVC Getting Started Guide](../getting-started) diff --git a/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/openai-integration.md b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/openai-integration.md index 0eb8794334..2d3b85a82c 100644 --- a/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/openai-integration.md +++ b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/ai-integrations/openai-integration.md @@ -1,26 +1,26 @@ --- layout: post -title: Open AI in ##Platform_Name## AI AssistView Control | Syncfusion -description: Checkout and learn about Integration of Open AI in Syncfusion ##Platform_Name## AI AssistView control of Syncfusion Essential JS 2 and more. +title: Azure Open AI in ##Platform_Name## AI AssistView Control | Syncfusion +description: Checkout and learn about Integration of Azure Open AI in Syncfusion ##Platform_Name## AI AssistView control of Syncfusion Essential JS 2 and more. platform: ej2-asp-core-mvc -control: Open AI +control: Azure Open AI publishingplatform: ##Platform_Name## documentation: ug --- -# Integration of Open AI With AI AssistView control +# Integration of Azure Open AI With AI AssistView control -The Syncfusion AI AssistView supports integration with [OpenAI](https://platform.openai.com/docs/overview), enabling advanced conversational AI features in your MVC applications. +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. ## Getting Started With the AI AssistView control -Before integrating Open AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application: +Before integrating Azure Open AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your MVC application: [ MVC Getting Started Guide](../getting-started) ## Prerequisites -* OpenAI account to generate an API key for accessing the `OpenAI` API +* An Azure account with access to `Azure Open AI` services and a generated API key. * [System requirements for ASP.NET MVC controls](https://ej2.syncfusion.com/aspnetmvc/documentation/system-requirements) to create MVC application ## Install Packages @@ -33,35 +33,39 @@ NuGet\Install-Package Syncfusion.EJ2.MVC5 ``` -Install the Open AI package in the application using Package Manager Console. +Install the Open AI and Azure Open AI package in the application using Package Manager Console. ```bash NuGet\Install-Package OpenAI - +NuGet\Install-Package Azure.AI.OpenAI +NuGet\Install-Package Azure.Core + ``` -## Generate API Key +## Configure Azure Open AI -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. +1. Log in to the [Azure Portal](https://portal.azure.com/#home) and navigate to your Azure Open AI resource. -2. Once logged in, click on your profile icon in the top-right corner and select `API Keys` from the dropdown menu. +2. Under Resource Management, select Keys and Endpoint to retrieve your API key and endpoint URL. -3. Click the `+ Create new secret key` button. You’ll be prompted to name the key (optional). Confirm to generate the key. +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. -4. Your API key will be displayed once. Copy it and store it securely, as it won’t be shown again. +4. Store these values securely, as they will be used in your application. -> `Security Note`: Never commit the API key to version control. Use environment variables or a secret manager for production. +> `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. -## Integration Open AI with AI AssistView +## Integration Azure Open AI with AI AssistView You can add the below respective files in your application: -* Add your generated `API Key` at the line in .cs file +* Update the following configuration values with your Azure Open AI details: ```bash -string apiKey = 'Place your API key here'; +string endpoint = "Your_Azure_OpenAI_Endpoint"; +string apiKey = "Your_Azure_OpenAI_API_Key"; +string deploymentName = "Your_Deployment_Name"; ``` @@ -74,7 +78,7 @@ string apiKey = 'Place your API key here'; {% endhighlight %} {% endtabs %} -![Open AI](../../images/open-ai.png) +![Azure Open AI](../../images/open-ai.png) ## Run and Test @@ -82,4 +86,4 @@ Run the application in the browser using the following command. Build and run the app (Ctrl + F5). -Open `https://localhost:44321` to interact with your Open AI for dynamic response. \ No newline at end of file +Open `https://localhost:44321` to interact with your Azure Open AI for dynamic response. \ No newline at end of file diff --git a/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/gemini-integration.md b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/gemini-integration.md index 2147662596..8fbbe75041 100644 --- a/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/gemini-integration.md +++ b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/gemini-integration.md @@ -14,7 +14,7 @@ The Syncfusion AI AssistView supports integration with [Gemini](https://ai.googl ## Getting Started With the AI AssistView control -Before integrating Gemini AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application: +Before integrating Gemini AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Core application: [ ASP.NET CORE Getting Started Guide](../getting-started) diff --git a/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/openai-integration.md b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/openai-integration.md index 85ea6748e8..bd7dab59db 100644 --- a/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/openai-integration.md +++ b/ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/ai-integrations/openai-integration.md @@ -1,26 +1,26 @@ --- layout: post -title: Open AI in ##Platform_Name## AI AssistView Control | Syncfusion -description: Checkout and learn about Integration of Open AI in Syncfusion ##Platform_Name## AI AssistView control of Syncfusion Essential JS 2 and more. +title: Azure Open AI in ##Platform_Name## AI AssistView Control | Syncfusion +description: Checkout and learn about Integration of Azure Open AI in Syncfusion ##Platform_Name## AI AssistView control of Syncfusion Essential JS 2 and more. platform: ej2-asp-core-mvc -control: Open AI +control: Azure Open AI publishingplatform: ##Platform_Name## documentation: ug --- -# Integration of Open AI With AI AssistView control +# Integration of Azure Open AI With AI AssistView control -The Syncfusion AI AssistView supports integration with [OpenAI](https://platform.openai.com/docs/overview), enabling advanced conversational AI features in your Core applications. +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. ## Getting Started With the AI AssistView control -Before integrating Open AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Vue application: +Before integrating Azure Open AI, ensure that the Syncfusion AI AssistView control is correctly rendered in your Core app: [ CORE Getting Started Guide](../getting-started) ## Prerequisites -* OpenAI account to generate an API key for accessing the `OpenAI` API +* An Azure account with access to `Azure Open AI` services and a generated API key. * [System requirements for ASP.NET MVC controls](https://ej2.syncfusion.com/aspnetmvc/documentation/system-requirements) to create Core application ## Install Packages @@ -33,35 +33,39 @@ NuGet\Install-Package Syncfusion.EJ2.AspNet.Core ``` -Install the Open AI package in the application using Package Manager Console. +Install the Open AI and Azure Open AI package in the application using Package Manager Console. ```bash -NuGet\Install-Package - +NuGet\Install-Package OpenAI +NuGet\Install-Package Azure.AI.OpenAI +NuGet\Install-Package Azure.Core + ``` -## Generate API Key +## Configure Azure Open AI -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. +1. Log in to the [Azure Portal](https://portal.azure.com/#home) and navigate to your Azure Open AI resource. -2. Once logged in, click on your profile icon in the top-right corner and select `API Keys` from the dropdown menu. +2. Under Resource Management, select Keys and Endpoint to retrieve your API key and endpoint URL. -3. Click the `+ Create new secret key` button. You’ll be prompted to name the key (optional). Confirm to generate the key. +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. -4. Your API key will be displayed once. Copy it and store it securely, as it won’t be shown again. +4. Store these values securely, as they will be used in your application. -> `Security Note`: Never commit the API key to version control. Use environment variables or a secret manager for production. +> `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. -## Integration Open AI with AI AssistView +## Integration Azure Open AI with AI AssistView You can add the below respective files in your application: -* Add your generated `API Key` at the line in .cs file +* Update the following configuration values with your Azure Open AI details: ```bash -string apiKey = 'Place your API key here'; +string endpoint = "Your_Azure_OpenAI_Endpoint"; +string apiKey = "Your_Azure_OpenAI_API_Key"; +string deploymentName = "Your_Deployment_Name"; ``` @@ -74,7 +78,7 @@ string apiKey = 'Place your API key here'; {% endhighlight %} {% endtabs %} -![Open AI](../../images/open-ai.png) +![Azure Open AI](../../images/open-ai.png) ## Run and Test @@ -82,4 +86,4 @@ Run the application in the browser using the following command. Build and run the app (Ctrl + F5). -Open `https://localhost:44321` to interact with your Open AI for dynamic response. \ No newline at end of file +Open `https://localhost:44321` to interact with your Azure Open AI for dynamic response. \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminicore.cs b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminicore.cs index 3f1954d8e0..f2e0ab297c 100644 --- a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminicore.cs +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminicore.cs @@ -76,5 +76,4 @@ public class ToolbarItemModel public string align { get; set; } public string iconCss { get; set; } } - } -} \ No newline at end of file + } \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminimvc.cs b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminimvc.cs index 97ddd2c5f4..c94229f8d3 100644 --- a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminimvc.cs +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/gemini-ai/geminimvc.cs @@ -48,16 +48,16 @@ public async Task GetAIResponse([FromBody] PromptRequest request) if (string.IsNullOrEmpty(responseText?.Text)) { - _logger.LogError("OpenAI API returned no text."); - return BadRequest("No response from OpenAI."); + _logger.LogError("Gemini API returned no text."); + return BadRequest("No response from Gemini."); } - _logger.LogInformation("OpenAI response received: {Response}", responseText?.Text); + _logger.LogInformation("Gemini response received: {Response}", responseText?.Text); return Json(responseText?.Text); } catch (Exception ex) { - _logger.LogError("Exception in OpenAI call: {Message}", ex.Message); + _logger.LogError("Exception in Gemini call: {Message}", ex.Message); return BadRequest($"Error generating response: {ex.Message}"); } } diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaicore.cs b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaicore.cs index b816468cf6..0ff4e66bf0 100644 --- a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaicore.cs +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaicore.cs @@ -1,5 +1,6 @@ using OpenAI; - +using Azure; +using Azure.AI.OpenAI; namespace WebApplication4.Pages { public class IndexModel : PageModel @@ -38,25 +39,32 @@ public async Task OnPostGetAIResponse([FromBody] PromptRequest re return BadRequest("Prompt cannot be empty."); } - string apiKey = ""; // Replace with your OpenAI API key - var openAiClient = new OpenAIClient(apiKey); - var chatClient = openAiClient.GetChatClient("gpt-4o-mini"); // Use your preferred model, e.g., "gpt-4o-mini" or "gpt-4o" + string endpoint = ""; // Replace with your Azure OpenAI endpoint + string apiKey = ""; // Replace with your Azure OpenAI API key + string deploymentName = ""; // Replace with your Azure OpenAI deployment name (e.g., gpt-4o-mini) - ChatCompletion completion = await chatClient.CompleteChatAsync(request.Prompt); - string responseText = completion.Content[0].Text; + var credential = new AzureKeyCredential(apiKey); + var client = new AzureOpenAIClient(new Uri(endpoint), credential); + var chatClient = client.GetChatClient(deploymentName); + var chatCompletionOptions = new ChatCompletionOptions(); + var completion = await chatClient.CompleteChatAsync( + new[] { new UserChatMessage(request.Prompt) }, + chatCompletionOptions + ); + string responseText = completion.Value.Content[0].Text; if (string.IsNullOrEmpty(responseText)) { - _logger.LogError("OpenAI API returned no text."); - return BadRequest("No response from OpenAI."); + _logger.LogError("Azure OpenAI API returned no text."); + return BadRequest("No response from Azure OpenAI."); } - _logger.LogInformation("OpenAI response received: {Response}", responseText); + _logger.LogInformation("Azure OpenAI response received: {Response}", responseText); return new JsonResult(responseText); } catch (Exception ex) { - _logger.LogError("Exception in Gemini call: {Message}", ex.Message); + _logger.LogError("Exception in Azure OpenAI call: {Message}", ex.Message); return BadRequest($"Error generating response: {ex.Message}"); } } @@ -78,5 +86,4 @@ public class ToolbarItemModel public string align { get; set; } public string iconCss { get; set; } } - } -} \ No newline at end of file + } \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaimvc.cs b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaimvc.cs index 420cb12b8b..912076e1f3 100644 --- a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaimvc.cs +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/openaimvc.cs @@ -1,4 +1,7 @@ using OpenAI; +using OpenAI.Chat; +using Azure; +using Azure.AI.OpenAI; namespace AssistViewDemo.Controllers { @@ -37,25 +40,34 @@ public async Task GetAIResponse([FromBody] PromptRequest request) return BadRequest("Prompt cannot be empty."); } - string apiKey = ""; // Replace with your OpenAI API key - var openAiClient = new OpenAIClient(apiKey); - var chatClient = openAiClient.GetChatClient("gpt-4o-mini"); // Use your preferred model, e.g., "gpt-4o-mini" or "gpt-4o" + // Azure OpenAI configuration + string endpoint = ""; // Replace with your Azure OpenAI endpoint + string apiKey = ""; // Replace with your Azure OpenAI API key + string deploymentName = ""; // Replace with your Azure OpenAI deployment name (e.g., gpt-4o-mini) - OpenAI.Chat.ChatCompletion completion = await chatClient.CompleteChatAsync(request.Prompt); - string responseText = completion.Content[0].Text; + var credential = new AzureKeyCredential(apiKey); + var client = new AzureOpenAIClient(new Uri(endpoint), credential); + var chatClient = client.GetChatClient(deploymentName); + var chatCompletionOptions = new ChatCompletionOptions(); + var completion = await chatClient.CompleteChatAsync( + new[] { new UserChatMessage(request.Prompt) }, + chatCompletionOptions + ); + + string responseText = completion.Value.Content[0].Text; if (string.IsNullOrEmpty(responseText)) { - _logger.LogError("OpenAI API returned no text."); - return BadRequest("No response from OpenAI."); + _logger.LogError("Azure OpenAI API returned no text."); + return BadRequest("No response from Azure OpenAI."); } - _logger.LogInformation("OpenAI response received: {Response}", responseText); + _logger.LogInformation("Azure OpenAI response received: {Response}", responseText); return Json(responseText); } catch (Exception ex) { - _logger.LogError("Exception in OpenAI call: {Message}", ex.Message); + _logger.LogError("Exception in Azure OpenAI call: {Message}", ex.Message); return BadRequest($"Error generating response: {ex.Message}"); } } diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/razor b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/razor index ec06bf95ac..4f93076204 100644 --- a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/razor +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/razor @@ -54,18 +54,13 @@ } function onPromptRequest(args) { - if (!token) { - assistObj.addPromptResponse('⚠️ Antiforgery token not found.'); - return; - } fetch('/?handler=GetAIResponse', { method: 'POST', headers: { - 'Content-Type': 'application/json', - 'RequestVerificationToken': token + 'Content-Type': 'application/json' }, - body: JSON.stringify({ prompt: args.prompt || 'Hi' }) + body: JSON.stringify({ prompt: args.prompt }) }) .then(response => { if (!response.ok) { diff --git a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/tagHelper b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/tagHelper index f7edb648cc..560e6b7e1c 100644 --- a/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/tagHelper +++ b/ej2-asp-core-mvc/code-snippet/ai-assistview/ai-integrations/open-ai/tagHelper @@ -1,5 +1,4 @@ @using Syncfusion.EJ2.InteractiveChat - @{ ViewData["Title"] = "AI Assistance with Gemini"; } @@ -13,6 +12,7 @@ + - \ No newline at end of file + + \ No newline at end of file diff --git a/ej2-asp-core-toc.html b/ej2-asp-core-toc.html index 28a44c4541..1d618988f2 100644 --- a/ej2-asp-core-toc.html +++ b/ej2-asp-core-toc.html @@ -206,7 +206,7 @@ Integration with Google Gemini
    • - Integration with Open AI + Integration with Azure Open AI
    diff --git a/ej2-asp-mvc-toc.html b/ej2-asp-mvc-toc.html index c06035e66e..5670a9008a 100644 --- a/ej2-asp-mvc-toc.html +++ b/ej2-asp-mvc-toc.html @@ -160,7 +160,7 @@ Integration with Google Gemini
  • - Integration with Open AI + Integration with Azure Open AI