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
# AIPrompt integration with Microsoft.Extensions.AI
2
+
3
+
## Overview
4
+
5
+
This project demonstrates the [integration of the `Microsoft.Extensions.AI` package with the `AIPrompt` component](https://www.telerik.com/blazor-ui/documentation/common-features/microsoft-extensions-ai-integration). The integration enables AI-powered interactions using **Azure OpenAI**, leveraging the built-in [`IChatClient` service](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.ai.ichatclient?view=net-9.0-pp).
6
+
7
+
## About `Microsoft.Extensions.AI`
8
+
9
+
The [`Microsoft.Extensions.AI` package](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.ai?view=net-9.0-pp) provides an abstraction for AI-powered services, making it easy to integrate large language models (LLMs) into .NET applications. It simplifies AI interaction by offering dependency injection support and a structured way to handle AI-based workflows.
10
+
11
+
## Integration with `AIPrompt` Component
12
+
13
+
- The [`AIPrompt` component](https://www.telerik.com/blazor-ui/documentation/components/aiprompt/overview) is configured to use `Microsoft.Extensions.AI` for AI-driven prompts.
14
+
- The project registers an [`IChatClient` service](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.ai.ichatclient?view=net-9.0-pp) in the `Program.cs` file.
15
+
- The [`OnPromptRequest` event](https://www.telerik.com/blazor-ui/documentation/components/aiprompt/events#onpromptrequest) of the `AIPrompt` is not handled, so the component will automatically use the registered `IChatClient` service for to generate a response.
16
+
-**Azure OpenAI** is used as the AI provider for generating responses.
17
+
18
+
## Setup & Configuration
19
+
20
+
To run the project successfully, you need to provide your **Azure OpenAI URI** and **API key**.
21
+
22
+
### Steps:
23
+
24
+
1. Open the `Program.cs` file.
25
+
2. Locate the `IChatClient` service registration.
26
+
3. Uncomment the service registration.
27
+
3. Replace the placeholder values with your actual Azure OpenAI endpoint and API key:
0 commit comments