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: Custom AI Service Integration with Syncfusion Smart Components
4
-
description: Learn how to use IChatInferenceService to integrate custom AI services with Syncfusion Smart Components
3
+
title: Custom AI Service Integration with Syncfusion Smart Paste
4
+
description: Learn how to integrate custom AI services with the Syncfusion Blazor Smart Paste Button using the IChatInferenceService interface for AI-driven form filling.
5
5
platform: Blazor
6
6
control: Smart Paste Button
7
7
documentation: ug
8
8
---
9
9
10
-
# Custom AI Service Integration
11
-
12
-
## Overview
13
-
14
-
Syncfusion<supstyle="font-size:70%">®</sup> Smart Components provide built-in support for OpenAI and Azure OpenAI services. However, you can also integrate other AI services using the `IChatInferenceService` interface, which acts as a bridge between Smart Components and your custom AI service.
10
+
# Custom AI Service Integration with Blazor Smart Paste Button
15
11
12
+
The Syncfusion Blazor Smart Paste Button leverages AI to parse clipboard content and populate form fields, enhancing user productivity. By default, it supports OpenAI and Azure OpenAI services, but you can integrate custom AI services using the `IChatInferenceService` interface. This interface facilitates communication between the Smart Paste Button and your custom AI provider, enabling precise mapping of clipboard data to form fields.
16
13
17
14
## IChatInferenceService Interface
18
15
19
-
The `IChatInferenceService` interface defines a simple contract for AI service integration:
16
+
The `IChatInferenceService` interface defines a contract for integrating AI services with the Smart Paste Button, enabling the component to process clipboard data for form field mapping.
20
17
21
18
```csharp
22
19
publicinterfaceIChatInferenceService
@@ -25,10 +22,57 @@ public interface IChatInferenceService
25
22
}
26
23
```
27
24
28
-
This interface enables:
29
-
- Consistent communication between components and AI services
30
-
- Easy switching between different AI providers
25
+
The `GenerateResponseAsync` method takes `ChatParameters` (containing clipboard data and form field metadata) and returns a string response from the AI service, which the Smart Paste Button uses to populate form fields.
26
+
27
+
## Simple Implementation of a Custom AI Service
28
+
29
+
Below is a sample implementation of a mock AI service named `MockAIService`. This service demonstrates how to implement the `IChatInferenceService` interface by returning sample, context-aware responses. You can replace the logic with your own AI integration.
1. Configure the Blazor Web App Server with the Smart Paste Button and custom AI service as described above.
70
+
2. Add the code to **~/Pages/Home.razor** and ensure **Program.cs** includes the service registrations.
71
+
3. Run the application using <kbd>Ctrl</kbd>+<kbd>F5</kbd> (Windows) or <kbd>⌘</kbd>+<kbd>F5</kbd> (macOS).
72
+
4. Copy the sample content provided in the Razor file.
73
+
5. Click the **Smart Paste** button to verify that the form fields are populated correctly using the custom AI service.
74
+
75
+

32
76
33
77
## Implemented AI Services
34
78
@@ -41,13 +85,14 @@ Here are examples of AI services integrated using the `IChatInferenceService` in
41
85
| Groq |[Groq Integration](groq-service)|
42
86
| Gemini |[Gemini Integration](gemini-service)|
43
87
88
+
## Troubleshooting
44
89
45
-
## Service Registration
46
-
47
-
Register your custom implementation in `Program.cs`:
90
+
If the custom AI integration does not work as expected, try the following:
91
+
-**Fields Not Populating**: Verify that the custom AI service’s endpoint, model, and API key are correct in `appsettings.json`. Ensure the `GenerateResponseAsync` method returns valid data.
92
+
-**Service Registration Errors**: Confirm that `CustomAIService` and `CustomInferenceService` are registered in **Program.cs** after `AddSyncfusionBlazor`.
93
+
-**AI Parsing Errors**: Check the AI service’s response format and ensure it matches the expected `CustomAIResponse` structure. Test the API independently to verify connectivity.
-[Getting Started with Syncfusion Blazor Smart Paste Button in Blazor Web App](https://blazor.syncfusion.com/documentation/smart-paste/getting-started-webapp)
Copy file name to clipboardExpand all lines: blazor/smart-paste/getting-started-webapp.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
---
2
2
layout: post
3
3
title: Get Started with Blazor Smart Paste Button | Syncfusion
4
-
description: Learn how to integrate the Syncfusion Blazor Smart Paste Button in a Blazor Web App with step-by-step instructions.
4
+
description: Learn how to integrate the Syncfusion Blazor Smart Paste Button in a Blazor Web App Server with step-by-step instructions.
5
5
platform: Blazor
6
6
control: Smart Paste Button
7
7
documentation: ug
8
8
---
9
9
10
10
# Getting Started with Smart Paste Button
11
11
12
-
This section explains how to integrate the [Blazor Smart Paste Button](https://www.syncfusion.com/blazor-components/blazor-smartpaste-button) component in a Blazor Web App using [Visual Studio](https://visualstudio.microsoft.com/vs/) or Visual Studio Code. The Smart Paste Button leverages AI to intelligently populate form fields from copied text, streamlining user input workflows.
12
+
This section explains how to integrate the [Blazor Smart Paste Button](https://www.syncfusion.com/blazor-components/blazor-smartpaste-button) component in a Blazor Web App Server using [Visual Studio](https://visualstudio.microsoft.com/vs/) or Visual Studio Code. The Smart Paste Button leverages AI to intelligently populate form fields from copied text, streamlining user input workflows.
13
13
14
14
To get started quickly with the Blazor Smart Paste Button component, watch this video:
15
15
@@ -29,7 +29,7 @@ To get started quickly with the Blazor Smart Paste Button component, watch this
29
29
30
30
N> Syncfusion Blazor Smart Components support both OpenAI and Azure OpenAI and are compatible with Blazor Server Interactivity mode.
31
31
32
-
## Create a New Blazor Web App in Visual Studio
32
+
## Create a New Blazor Web App Server in Visual Studio
33
33
34
34
Create a **Blazor Web App** using Visual Studio 2022 with [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0) or the [Syncfusion Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-integration/template-studio). Configure the app with the Server interactive render mode.
35
35
@@ -65,12 +65,12 @@ N> Syncfusion Blazor components are available on [nuget.org](https://www.nuget.o
65
65
66
66
N> Syncfusion Blazor Smart Components support both OpenAI and Azure OpenAI and are compatible with Blazor Server Interactivity mode.
67
67
68
-
## Create a New Blazor Web App in Visual Studio Code
68
+
## Create a New Blazor Web App Server in Visual Studio Code
69
69
70
70
Create a **Blazor Web App** using Visual Studio Code with [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0&pivots=vsc) or the [Syncfusion Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-code-integration/create-project). Configure the app with the Server interactive render mode using the following commands:
71
71
72
72
{% tabs %}
73
-
{% highlight c# tabtitle="Blazor Web App" %}
73
+
{% highlight c# tabtitle="Blazor Web App Server" %}
74
74
75
75
dotnet new blazor -o BlazorWebApp -int Server
76
76
cd BlazorWebApp
@@ -119,7 +119,7 @@ For Server interactive render mode, open the **~/Components/_Imports.razor** fil
119
119
Register the Syncfusion Blazor service in the **~/Program.cs** file:
120
120
121
121
{% tabs %}
122
-
{% highlight C# tabtitle="Blazor Web App" hl_lines="3 10" %}
122
+
{% highlight C# tabtitle="Blazor Web App Server" hl_lines="3 10" %}
123
123
124
124
using Microsoft.AspNetCore.Components;
125
125
using Microsoft.AspNetCore.Components.Web;
@@ -166,7 +166,7 @@ For OpenAI, obtain an API key from [OpenAI](https://help.openai.com/en/articles/
description: Learn how to get started with the Syncfusion Blazor Smart TextArea component in a Blazor Web App, including setup and AI configuration.
4
+
description: Learn how to get started with the Syncfusion Blazor Smart TextArea component in a Blazor Web App Server, including setup and AI configuration.
5
5
platform: Blazor
6
6
control: Smart TextArea
7
7
documentation: ug
8
8
---
9
9
10
10
# Getting Started with Blazor Smart TextArea
11
11
12
-
The Syncfusion Blazor Smart TextArea component provides AI-powered autocompletion for context-aware text input, suitable for applications like issue trackers or customer support systems. This section explains how to integrate the component into a Blazor Web App using Visual Studio or Visual Studio Code.
12
+
The Syncfusion Blazor Smart TextArea component provides AI-powered autocompletion for context-aware text input, suitable for applications like issue trackers or customer support systems. This section explains how to integrate the component into a Blazor Web App Server using Visual Studio or Visual Studio Code.
13
13
14
14
To get started quickly, watch this video tutorial:
15
15
@@ -29,9 +29,9 @@ To get started quickly, watch this video tutorial:
29
29
30
30
N> Syncfusion Blazor Smart Components support both OpenAI and Azure OpenAI and are compatible with Blazor Server Interactivity mode.
31
31
32
-
## Create a New Blazor Web App in Visual Studio
32
+
## Create a New Blazor Web App Server in Visual Studio
33
33
34
-
Create a **Blazor Web App** using Visual Studio 2022 with [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0) or the [Syncfusion Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-integration/template-studio). Configure the app with the Server interactive render mode.
34
+
Create a **Blazor Web App Server** using Visual Studio 2022 with [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0) or the [Syncfusion Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-integration/template-studio). Configure the app with the Server interactive render mode.
35
35
36
36
## Install Syncfusion Blazor SmartComponents and Themes NuGet Packages
37
37
@@ -65,9 +65,9 @@ N> Syncfusion Blazor components are available on [nuget.org](https://www.nuget.o
65
65
66
66
N> Syncfusion Blazor Smart Components support both OpenAI and Azure OpenAI and are compatible with Blazor Server Interactivity mode.
67
67
68
-
## Create a New Blazor Web App in Visual Studio Code
68
+
## Create a New Blazor Web App Server in Visual Studio Code
69
69
70
-
Create a **Blazor Web App** using Visual Studio Code with [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0&pivots=vsc) or the [Syncfusion Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-code-integration/create-project). Configure the app with the Server interactive render mode using the following commands:
70
+
Create a **Blazor Web App Server** using Visual Studio Code with [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0&pivots=vsc) or the [Syncfusion Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-code-integration/create-project). Configure the app with the Server interactive render mode using the following commands:
71
71
72
72
{% tabs %}
73
73
{% highlight c# tabtitle="Blazor Web App Server" %}
0 commit comments