From 96d4acfec7b37373e01c6c11c7d3b7145e0974f7 Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Wed, 26 Feb 2025 16:38:30 +0200 Subject: [PATCH] docs(AIPrompt): Fix broken link, clarify AI dependency --- common-features/microsoft-extensions-ai-integration.md | 4 ++++ components/aiprompt/events.md | 1 + components/aiprompt/overview.md | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/common-features/microsoft-extensions-ai-integration.md b/common-features/microsoft-extensions-ai-integration.md index 0d8e0e4568..a480a44209 100644 --- a/common-features/microsoft-extensions-ai-integration.md +++ b/common-features/microsoft-extensions-ai-integration.md @@ -18,6 +18,10 @@ Other components will support similar integration in future versions of UI for B To integrate the **Microsoft.Extensions.AI** library with your AIPrompt component, register an [`IChatClient`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.ai.ichatclient?view=net-9.0-pp) service and configure it according to the model you are using. The AIPrompt is designed to automatically use the registered `IChatClient`. +> The Microsoft AI library is still in preview, so breaking changes may occur. Telerik UI for Blazor references `Microsoft.Extensions.AI.Abstractions` version `9.1.0-preview.1.25064.3`. Do not register a newer version of this package explicitly in your app, as this may cause integration issues or exceptions. +> +> When using the Telerik AIPrompt component with the Microsoft AI library, do not subscribe to the `OnPromptRequest` event. + **Microsoft.Extensions.AI provides** a simple integration with various models where the configuration slightly differs depending on the model. The example below shows usage of [Azure OpenAI](https://www.nuget.org/packages/Azure.AI.OpenAI) and you may [explore some other examples with different models in this post](https://devblogs.microsoft.com/dotnet/introducing-microsoft-extensions-ai-preview/#chat). >caption Startup.cs: diff --git a/components/aiprompt/events.md b/components/aiprompt/events.md index 9105e4c80e..9fb7d4d2e0 100644 --- a/components/aiprompt/events.md +++ b/components/aiprompt/events.md @@ -32,6 +32,7 @@ The event handler receives an argument of type [`AIPromptPromptRequestEventArgs` | `IsCancelled` | `bool` | Whether the event is cancelled and the built-in action is prevented. | | `OutputItem` | `AIPromptOutputItemDescriptor` | The output item. This property will be populated only when the user retries an existing output. See [`AIPromptOutputItemDescriptor`](slug:Telerik.Blazor.Components.AIPromptOutputItemDescriptor). | +> Do not use the `OnPromptRequest` event when [integrating the AIPrompt component with `Microsoft.Extensions.AI`](slug:common-features-microsoft-extensions-ai-integration). The `OnPromptRequest` event disables such integration. ## OnCommandExecute diff --git a/components/aiprompt/overview.md b/components/aiprompt/overview.md index 5cfbc9ccf0..6b57dab7b4 100644 --- a/components/aiprompt/overview.md +++ b/components/aiprompt/overview.md @@ -103,7 +103,7 @@ The table below lists the AIPrompt parameters. For a full list of the AIPrompt A | `PromptSuggestions` | `List` | The prompt suggestions displayed within the Prompt view. | | `PromptSuggestionItemTemplate` | `RenderFragment` | The Prompt Suggestion Item template of the AIPrompt. | | `ShowOutputRating` | `bool`
(`false`) | Controls the visibility of the rating buttons within the output card. | -| `SystemPrompt` | `string`
(See "Description" column) | Defines the system prompt that is passed to the [`IChatClient.CompleteAsync`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.ai.ichatclient.completeasync?view=net-9.0-pp), when such is used. The default value is: `"You are a helpful assistant designed to assist users. Your goal is to provide helpful, accurate, and contextually appropriate information in a clear and concise manner. Avoid discussing harmful, illegal, or inappropriate topics"`. +| `SystemPrompt` | `string`
(See "Description" column) | Defines the system prompt that is passed to `IChatClient.CompleteAsync()`. This method exists in `Microsoft.Extensions.AI.Abstractions` package version `9.1.0-preview.1.25064.3`, but not in newer versions. Referencing a newer version explicitly in your app will cause a runtime exception.

The default `SystemPrompt` value is: `"You are a helpful assistant designed to assist users. Your goal is to provide helpful, accurate, and contextually appropriate information in a clear and concise manner. Avoid discussing harmful, illegal, or inappropriate topics"`. | `Width` | `string` | The `width` style of the component in any [supported CSS unit](slug:common-features/dimensions). The default AIPrompt dimensions depend on the CSS theme. | ## AIPrompt Reference and Methods