-
Notifications
You must be signed in to change notification settings - Fork 319
Expand file tree
/
Copy pathLanguageModelPage.xaml
More file actions
205 lines (194 loc) · 12.2 KB
/
LanguageModelPage.xaml
File metadata and controls
205 lines (194 loc) · 12.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<!-- Copyright (c) Microsoft Corporation.
Licensed under the MIT License. -->
<!--xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations"-->
<!--NU1202: Package Microsoft.Toolkit.Uwp.UI.Animations 7.1.0-rc1 is not compatible with net5.0-windows10.0.19041 (.NETCoreApp,Version=v5.0) / win10-x86. Package Microsoft.Toolkit.Uwp.UI.Animations 7.1.0-rc1 supports: uap10.0.17763 (UAP,Version=v10.0.17763)-->
<Page x:Name="page"
x:Class="WindowsAISample.Pages.LanguageModelPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WindowsAISample"
xmlns:pages="using:WindowsAISample.Pages"
xmlns:controls="using:WindowsAISample.Controls"
xmlns:models="using:WindowsAISample.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
d:DataContext="{d:DesignInstance Type=models:LanguageModelViewModel}"
DataContext="{Binding LanguageModel}"
NavigationCacheMode="Enabled">
<Page.Resources>
<DataTemplate x:Key="SeverityLevelItemTemplate">
<TextBlock Text="{Binding Converter={StaticResource ContentFilterOptionsSeverityLevelConverter}}"/>
</DataTemplate>
</Page.Resources>
<ScrollViewer VerticalScrollBarVisibility="Auto"
HorizontalAlignment="Stretch">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Stretch"
Margin="20">
<TextBlock Text="Language Model"
Style="{StaticResource TitleTextBlockStyle}"
Margin="10"/>
<TextBlock Text="The Language Model APIs let you complete text and generate embedding vectors from a given string of text. Currently, only Text Intelligence skills are available in the stable version. Switch to release/experimental branch to test out the experimental features of Windows AI apis."
Style="{StaticResource BodyTextBlockStyle}"
Margin="10"/>
<controls:ModelInitializationControl SourceFile="Examples/LanguageModelInit.md"/>
<!--- Language Model apis currently are not available in stable version of winappsdk. Switch to release/experimental version to enable them. -->
<!-- Text Intelligence -->
<TextBlock Text="Text Intelligence"
Margin="10"
Style="{StaticResource SubtitleTextBlockStyle}"/>
<TextBlock Margin="10" TextWrapping="WrapWholeWords">
Select between a predefined set of Text Intelligence skills to perform common operations on input text.
We are using default values for Temp, TopP and TopK params in the sample.
</TextBlock>
<RichTextBlock Margin="10" TextWrapping="WrapWholeWords">
<Paragraph>
<Run FontWeight="Bold">Summarize</Run> : Summarize the prompt text.
</Paragraph>
<Paragraph>
<Run FontWeight="Bold">Rewrite</Run> : Rewrite, correct grammar, and enhance word choice of the prompt.
</Paragraph>
<Paragraph>
<Run FontWeight="Bold">Text To table</Run> : Convert given prompt to table format.
</Paragraph>
</RichTextBlock>
<Border BorderThickness="1"
CornerRadius="10"
BorderBrush="{ThemeResource CardBackgroundFillColorSecondaryBrush}"
Background="{ThemeResource CardBackgroundFillColorDefault}"
Margin="10">
<TabView IsAddTabButtonVisible="False">
<TabView.TabItems>
<!-- Summarize Section -->
<TabViewItem Header="Summarize"
IsClosable="False">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Stretch"
Margin="20">
<TextBox Margin="10"
Header="Prompt:"
PlaceholderText="Enter your prompt here"
Text="{Binding TextIntelligencePrompt, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding IsAvailable}"
AutomationProperties.Name="multi-line TextBox"
AcceptsReturn="True"
TextWrapping="Wrap"/>
<TextBox Margin="10"
Header="Language Model Result:"
Text="{Binding ResponseProgressTextIntelligence}"
IsReadOnly="True"
IsEnabled="{Binding IsAvailable}"
TextWrapping="Wrap"/>
<StackPanel Orientation="Horizontal"
Margin="10">
<Button Command="{Binding GenerateResponseWithTextIntelligenceSummarizeSkills}"
CommandParameter="{Binding TextIntelligencePrompt}"
Margin="0,0,10,0">Generate Summarize Response</Button>
<ProgressRing Visibility="{Binding GenerateResponseWithTextIntelligenceSummarizeSkills.IsExecuting, Converter={StaticResource BoolToVisibilityConverter}}"/>
</StackPanel>
<controls:CodeBlockControl SourceFile="Examples/TextIntelligenceSummarize.md"
Margin="10"/>
</StackPanel>
</TabViewItem>
<!-- Rewrite Section -->
<TabViewItem Header="Rewrite"
IsClosable="False">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Stretch"
Margin="20">
<TextBox Margin="10"
Header="Prompt:"
PlaceholderText="Enter your prompt here"
Text="{Binding TextIntelligencePrompt, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding IsAvailable}"
AutomationProperties.Name="multi-line TextBox"
AcceptsReturn="True"
TextWrapping="Wrap"/>
<TextBox Margin="10"
Header="Language Model Result:"
Text="{Binding ResponseProgressTextIntelligence}"
IsReadOnly="True"
IsEnabled="{Binding IsAvailable}"
TextWrapping="Wrap"/>
<StackPanel Orientation="Horizontal"
Margin="10">
<Button Command="{Binding GenerateResponseWithTextIntelligenceRewriteSkills}"
CommandParameter="{Binding TextIntelligencePrompt}"
Margin="0,0,10,0">Generate Rewrite Response</Button>
<ProgressRing Visibility="{Binding GenerateResponseWithTextIntelligenceRewriteSkills.IsExecuting, Converter={StaticResource BoolToVisibilityConverter}}"/>
</StackPanel>
<controls:CodeBlockControl SourceFile="Examples/TextIntelligenceRewrite.md"
Margin="10"/>
</StackPanel>
</TabViewItem>
<!-- Describe Your Change Section -->
<TabViewItem Header="Describe Your Change"
IsClosable="False">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Stretch"
Margin="20">
<TextBox Margin="10"
Header="Prompt:"
PlaceholderText="Enter your prompt here"
Text="{Binding TextIntelligencePrompt, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding IsAvailable}"
AutomationProperties.Name="multi-line TextBox"
AcceptsReturn="True"
TextWrapping="Wrap"/>
<TextBox Margin="10"
Header="Language Model Result:"
Text="{Binding ResponseProgressTextIntelligence}"
IsReadOnly="True"
IsEnabled="{Binding IsAvailable}"
TextWrapping="Wrap"/>
<StackPanel Orientation="Horizontal"
Margin="10">
<Button Command="{Binding GenerateResponseWithTextIntelligenceDescribeSkills}"
CommandParameter="{Binding TextIntelligencePrompt}"
Margin="0,0,10,0">Generate Describe Your Change Response</Button>
<ProgressRing Visibility="{Binding GenerateResponseWithTextIntelligenceDescribeSkills.IsExecuting, Converter={StaticResource BoolToVisibilityConverter}}"/>
</StackPanel>
<controls:CodeBlockControl SourceFile="Examples/TextIntelligenceDescribe.md"
Margin="10"/>
</StackPanel>
</TabViewItem>
<!-- TextToTable Section -->
<TabViewItem Header="Text To Table"
IsClosable="False">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Stretch"
Margin="20">
<TextBox Margin="10"
Header="Prompt:"
PlaceholderText="Enter your prompt here"
Text="{Binding TextIntelligencePrompt, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding IsAvailable}"
AutomationProperties.Name="multi-line TextBox"
AcceptsReturn="True"
TextWrapping="Wrap"/>
<TextBox Margin="10"
Header="Language Model Result:"
Text="{Binding GenerateResponseWithTextIntelligenceTextToTableSkills.Result}"
IsReadOnly="True"
IsEnabled="{Binding IsAvailable}"
TextWrapping="Wrap"/>
<StackPanel Orientation="Horizontal"
Margin="10">
<Button Command="{Binding GenerateResponseWithTextIntelligenceTextToTableSkills}"
CommandParameter="{Binding TextIntelligencePrompt}"
Margin="0,0,10,0">Generate Text To Table Response</Button>
<ProgressRing Visibility="{Binding GenerateResponseWithTextIntelligenceTextToTableSkills.IsExecuting, Converter={StaticResource BoolToVisibilityConverter}}"/>
</StackPanel>
<controls:CodeBlockControl SourceFile="Examples/TextIntelligenceTextToTable.md"
Margin="10"/>
</StackPanel>
</TabViewItem>
</TabView.TabItems>
</TabView>
</Border>
</StackPanel>
</ScrollViewer>
</Page>