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
Document integration with Microsoft.Extensions.AI (#2753)
* chore(AIPrompt): add docs for integration with ai extensions
* docs(common): add more information
* chore(common): fix
* chore(common): add link in aipromptoverview
* chore(common): address feedback
The [AIPrompt component](slug:aiprompt-overview) incorporates the [Microsoft.Extensions.AI package](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.ai?view=net-9.0-pp) to simplify your AI model integration, provide flexibility and let you easily use and test various AI providers.
14
+
15
+
Other components will support similar integration in future versions of UI for Blazor.
16
+
17
+
## Integration
18
+
19
+
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`.
20
+
21
+
**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).
*[Introducing Microsoft.Extensions.AI Preview – Unified AI Building Blocks for .NET](https://devblogs.microsoft.com/dotnet/introducing-microsoft-extensions-ai-preview/)
Copy file name to clipboardExpand all lines: components/aiprompt/overview.md
+7-3
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,9 @@ The component allows you to interact with the output from the AI and execute a s
61
61
}
62
62
````
63
63
64
+
## Integration with Microsoft.Extensions.AI
65
+
66
+
The AIPrompt supports using the [Microsoft.Extensions.AI library](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.ai?view=net-9.0-pp) to provide seamless integration with various AI models and boost your workflow when connecting the AIPrompt with AI models. [Learn how to integrate Microsoft.Extensions.AI with your AIPrompt component...](slug://common-features-microsoft-extensions-ai-integration)
64
67
65
68
## ToolBar
66
69
@@ -92,14 +95,15 @@ The table below lists the AIPrompt parameters. For a full list of the AIPrompt A
92
95
| --- | --- | --- |
93
96
|`AIPromptViews`|`RenderFragment`| Allows control over the views of the content. Use it to set the visibility of a predefined view or to create custom views. If a render fragment is not provided, the AIPrompt will display its default views. |
94
97
|`AIPromptToolBar`|`RenderFragment`| Any additional buttons that will be rendered within the ToolBar. This parameter will append the new items, rather than override buttons related to existing views. |
98
+
|`Class`|`string`| The `class` attribute of the `<div class="k-prompt">` element. Use it to apply custom styles or [override the theme](slug://themes-override). |
99
+
|`Commands`|`List<AIPromptCommandDescriptor>`| The predefined commands displayed within the Commands view. |
100
+
|`Height`|`string`| The `height` style of the component in any [supported CSS unit](slug://common-features/dimensions). The default AIPrompt dimensions depend on the CSS theme. |
95
101
|`PromptText`|`string`| The value of the text within the prompt view. Use it when you need to add some form of transformation to the prompt. The parameter supports two-way binding. |
96
102
|`PromptTextChanged`|`EventCallback<string>`| The handler called whenever the `PromptText` changes. |
97
103
|`PromptSuggestions`|`List<string>`| The prompt suggestions displayed within the Prompt view. |
98
104
|`PromptSuggestionItemTemplate`|`RenderFragment<string>`| The Prompt Suggestion Item template of the AIPrompt. |
99
-
|`Commands`|`List<AIPromptCommandDescriptor>`| The predefined commands displayed within the Commands view. |
100
105
|`ShowOutputRating`|`bool` <br /> (`false`) | Controls the visibility of the rating buttons within the output card. |
101
-
|`Class`|`string`| The `class` attribute of the `<div class="k-prompt">` element. Use it to apply custom styles or [override the theme](slug://themes-override). |
102
-
|`Height`|`string`| The `height` style of the component in any [supported CSS unit](slug://common-features/dimensions). The default AIPrompt dimensions depend on the CSS theme. |
106
+
| `SystemPrompt` | `string` <br/> (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"`.
103
107
|`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. |
0 commit comments