Skip to content

Commit 7e64664

Browse files
983466: Update custom-inference-backend.md
1 parent 5a3a463 commit 7e64664

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

blazor/smart-textarea/custom-inference-backend.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,23 @@ public interface IChatInferenceService
2828
- **Parameters**: The `ChatParameters` type includes properties like user input and context.
2929
- **Benefits**: Enables seamless switching between AI providers without modifying component code.
3030

31+
## Simple Implementation of a Custom AI Service
32+
33+
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.
34+
35+
```csharp
36+
using Syncfusion.Blazor.AI;
37+
using System.Threading.Tasks;
38+
39+
public class MockAIService : IChatInferenceService
40+
{
41+
public Task<string> GenerateResponseAsync(ChatParameters options)
42+
{
43+
44+
}
45+
}
46+
```
47+
3148
## Registering the Custom AI Service
3249

3350
Register the custom AI service in the **~/Program.cs** file of your Blazor Web App:

0 commit comments

Comments
 (0)