Skip to content

Commit 1493ce2

Browse files
944844
1 parent 2431fab commit 1493ce2

File tree

9 files changed

+35
-35
lines changed

9 files changed

+35
-35
lines changed

Smart_Fill/MainWindow.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace WPFPdfViewer_SmartFill
1515
public partial class MainWindow : Window
1616
{
1717
#region Fields
18-
private SemanticKernelAI semanticKernelOpenAI;
18+
private MicrosoftAIExtension microsoftAIExtension;
1919
Button aIAssistButton;
2020
DispatcherTimer toolTipTimer;
2121
#endregion
@@ -25,7 +25,7 @@ public MainWindow()
2525
{
2626
InitializeComponent();
2727
//Initialize the Semantic Kernel AI
28-
semanticKernelOpenAI = new SemanticKernelAI("YOUR-AI-KEY");
28+
microsoftAIExtension = new MicrosoftAIExtension("YOUR-AI-KEY");
2929
//Load the PDF document in the PDF Viewer
3030
pdfViewer.Load("../../../Data/form_document_new.pdf");
3131
//Zoom the PDF Viewer to 50% to view the entire page
@@ -450,7 +450,7 @@ private async Task<string> GetDataFromAI()
450450
$"3. First, determine the best match for the field name. If there isn’t an exact match, use the input data to find a close match. " +
451451
$"remove ```xml and remove ``` if it is there in the code.";
452452
// Get the answer from GPT using the semantic kernel AI
453-
result = await semanticKernelOpenAI.GetAnswerFromGPT(mergePrompt);
453+
result = await microsoftAIExtension.GetAnswerFromGPT(mergePrompt);
454454
}
455455

456456
return result;

Smart_Fill/SemanticKernelAI.cs renamed to Smart_Fill/MicrosoftAIExtension.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44

55
namespace WPFPdfViewer_SmartFill
66
{
7-
internal class SemanticKernelAI
7+
internal class MicrosoftAIExtension
88
{
99

1010
const string endpoint = "YOUR-AI-ENDPOINT";
1111
const string deploymentName = "YOUR-DEPLOYMENT-NAME";
1212
internal string key = string.Empty;
1313

14-
private static IChatClient clientAI;
14+
private IChatClient clientAI;
1515

1616
/// <summary>
17-
/// Initializes a new instance of the <see cref="SemanticKernelAI"/> class.
17+
/// Initializes a new instance of the <see cref="MicrosoftAIExtension"/> class.
1818
/// </summary>
1919
/// <param name="key">Key for the semantic kernal API</param>
20-
public SemanticKernelAI(string key)
20+
public MicrosoftAIExtension(string key)
2121
{
2222
clientAI = new AzureOpenAIClient(new System.Uri(endpoint), new System.ClientModel.ApiKeyCredential(key)).AsChatClient(deploymentName);
2323
}

Smart_Fill/Smart_Fill.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="*" />
13-
<PackageReference Include="Syncfusion.SfBusyIndicator.WPF" Version="*" />
14-
<PackageReference Include="Syncfusion.SfSkinManager.WPF" Version="*" />
15-
<PackageReference Include="Syncfusion.Themes.Windows11Light.WPF" Version="*" />
12+
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="28.2.9" />
13+
<PackageReference Include="Syncfusion.SfBusyIndicator.WPF" Version="28.2.9" />
14+
<PackageReference Include="Syncfusion.SfSkinManager.WPF" Version="28.2.9" />
15+
<PackageReference Include="Syncfusion.Themes.Windows11Light.WPF" Version="28.2.9" />
1616
<PackageReference Include="Azure.AI.OpenAI" Version="2.1.0" />
1717
<PackageReference Include="Microsoft.Extensions.AI" Version="9.3.0-preview.1.25114.11" />
1818
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.3.0-preview.1.25114.11" />

Smart_Redaction/MainWindow.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public partial class MainWindow : Window
1717
#region Fields
1818
private bool isAllInformationsSelected = false;
1919
private Dictionary<int, List<RectangleF>> redactRegions = new Dictionary<int, List<RectangleF>>();
20-
private SemanticKernelAI semanticKernelOpenAI;
20+
private MicrosoftAIExtension microsoftAIExtension;
2121
ToggleButton aIAssistButton;
2222
#endregion
2323

@@ -29,7 +29,7 @@ public MainWindow()
2929
pdfViewer.Load("../../../Data/Confidential_Medical_Record.pdf");
3030

3131
//Create an instance of the SemanticKernelAI class which initializes the OpenAI client
32-
semanticKernelOpenAI = new SemanticKernelAI("YOUR-AI-KEY");
32+
microsoftAIExtension = new MicrosoftAIExtension("YOUR-AI-KEY");
3333
}
3434
#endregion
3535

@@ -905,7 +905,7 @@ private async Task<List<string>> ExtractSelectedInfo(string text, List<string> s
905905
string prompt = stringBuilder.ToString();
906906

907907
// Call the OpenAI client to extract the selected sensitive information
908-
var completion = await semanticKernelOpenAI.GetAnswerFromGPT(prompt, text);
908+
var completion = await microsoftAIExtension.GetAnswerFromGPT(prompt, text);
909909
string result = completion.ToString();
910910

911911
// Process the output to ensure it only contains names

Smart_Redaction/SemanticKernelAI.cs renamed to Smart_Redaction/MicrosoftAIExtension.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44

55
namespace WPFPdfViewerAI_SmartRedaction
66
{
7-
internal class SemanticKernelAI
7+
internal class MicrosoftAIExtension
88
{
99

1010
const string endpoint = "YOUR-AI-ENDPOINT";
1111
const string deploymentName = "YOUR-DEPLOYMENT-NAME";
1212
internal string key = string.Empty;
1313

14-
private static IChatClient clientAI;
14+
private IChatClient clientAI;
1515

1616
/// <summary>
17-
/// Initializes a new instance of the <see cref="SemanticKernelAI"/> class.
17+
/// Initializes a new instance of the <see cref="MicrosoftAIExtension"/> class.
1818
/// </summary>
1919
/// <param name="key">Key for the semantic kernal API</param>
20-
public SemanticKernelAI(string key)
20+
public MicrosoftAIExtension(string key)
2121
{
2222
clientAI = new AzureOpenAIClient(new System.Uri(endpoint), new System.ClientModel.ApiKeyCredential(key)).AsChatClient(deploymentName);
2323
}

Smart_Redaction/Smart_Redaction.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="*" />
13-
<PackageReference Include="Syncfusion.SfBusyIndicator.WPF" Version="*" />
14-
<PackageReference Include="System.Drawing.Common" Version="*" />
15-
<PackageReference Include="Syncfusion.SfSkinManager.WPF" Version="*" />
16-
<PackageReference Include="Syncfusion.Themes.Windows11Light.WPF" Version="*" />
12+
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="28.2.9" />
13+
<PackageReference Include="Syncfusion.SfBusyIndicator.WPF" Version="28.2.9" />
14+
<PackageReference Include="Syncfusion.SfSkinManager.WPF" Version="28.2.9" />
15+
<PackageReference Include="Syncfusion.Themes.Windows11Light.WPF" Version="28.2.9" />
16+
<PackageReference Include="System.Drawing.Common" Version="10.0.0-preview.1.25080.3" />
1717
<PackageReference Include="Azure.AI.OpenAI" Version="2.1.0" />
1818
<PackageReference Include="Microsoft.Extensions.AI" Version="9.3.0-preview.1.25114.11" />
1919
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.3.0-preview.1.25114.11" />

Smart_Summarize/MainWindow.xaml.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Smart_Summarize
1414
public partial class MainWindow : Window
1515
{
1616
#region Fields
17-
private SemanticKernelAI semanticKernelOpenAI;
17+
private MicrosoftAIExtension microsoftAIExtension;
1818
private ToggleButton aIAssistButton;
1919
private UserChatBox userInputChat;
2020
private AIResultChatBox aIResultChat;
@@ -28,7 +28,7 @@ public MainWindow()
2828
//Load the PDF document in the PdfViewer
2929
pdfViewer.Load("../../../Data/GIS Succinctly.pdf");
3030
//Initialize the Semantic Kernel AI for summarizing the PDF document
31-
semanticKernelOpenAI = new SemanticKernelAI("YOUR-AI-KEY");
31+
microsoftAIExtension = new MicrosoftAIExtension("YOUR-AI-KEY");
3232
}
3333
#endregion
3434

@@ -163,7 +163,7 @@ private async void sendButton_Click(object sender, RoutedEventArgs e)
163163
loadingIndicator.Visibility = Visibility.Visible;
164164

165165
//Get the answer from GPT using the semantic kernel for the user input
166-
string answer = await semanticKernelOpenAI.AnswerQuestion(chatText.Text);
166+
string answer = await microsoftAIExtension.AnswerQuestion(chatText.Text);
167167
//Display the answer in the AI Result TextBlock
168168
AddAIChat(answer);
169169
//Hide the loading indicator once the answer is displayed
@@ -333,7 +333,7 @@ private async Task ExtractDetailsFromPDF()
333333
extractedText.Add(text);
334334
}
335335

336-
await semanticKernelOpenAI.CreateEmbeddedPage(extractedText.ToArray());
336+
await microsoftAIExtension.CreateEmbeddedPage(extractedText.ToArray());
337337
}
338338

339339
/// <summary>
@@ -343,7 +343,7 @@ private async Task ExtractDetailsFromPDF()
343343
private async Task<string> SummarizePDF()
344344
{
345345
//Summarize the text using the Semantic Kernel AI
346-
string summary = await semanticKernelOpenAI.GetAnswerFromGPT("You are a helpful assistant. Your task is to analyze the provided text and generate short summary as a plain text.");
346+
string summary = await microsoftAIExtension.GetAnswerFromGPT("You are a helpful assistant. Your task is to analyze the provided text and generate short summary as a plain text.");
347347
return summary;
348348
}
349349
#endregion

Smart_Summarize/SemanticKernelAI.cs renamed to Smart_Summarize/MicrosoftAIExtension.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
using SmartComponents.LocalEmbeddings;
55
namespace Smart_Summarize
66
{
7-
internal class SemanticKernelAI
7+
internal class MicrosoftAIExtension
88
{
99

1010
const string endpoint = "YOUR-AI-ENDPOINT";
1111
const string deploymentName = "YOUR-DEPLOYMENT-NAME";
1212
internal string key = string.Empty;
1313

14-
private static IChatClient clientAI;
14+
private IChatClient clientAI;
1515
public Dictionary<string, EmbeddingF32>? PageEmbeddings { get; set; }
1616

1717
/// <summary>
18-
/// Initializes a new instance of the <see cref="SemanticKernelAI"/> class.
18+
/// Initializes a new instance of the <see cref="MicrosoftAIExtension"/> class.
1919
/// </summary>
2020
/// <param name="key">Key for the semantic kernal API</param>
21-
public SemanticKernelAI(string key)
21+
public MicrosoftAIExtension(string key)
2222
{
2323
clientAI = new AzureOpenAIClient(new System.Uri(endpoint), new System.ClientModel.ApiKeyCredential(key)).AsChatClient(deploymentName);
2424
}

Smart_Summarize/Smart_Summarize.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
<ItemGroup>
1616

1717
<PackageReference Include="SmartComponents.LocalEmbeddings" Version="0.1.0-preview10148" />
18-
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="*" />
19-
<PackageReference Include="Syncfusion.SfBusyIndicator.WPF" Version="*" />
20-
<PackageReference Include="Syncfusion.Themes.Windows11Light.WPF" Version="*" />
18+
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="28.2.9" />
19+
<PackageReference Include="Syncfusion.SfBusyIndicator.WPF" Version="28.2.9" />
20+
<PackageReference Include="Syncfusion.Themes.Windows11Light.WPF" Version="28.2.9" />
2121
<PackageReference Include="Microsoft.Extensions.AI" Version="9.3.0-preview.1.25114.11" />
2222
<PackageReference Include="Azure.AI.OpenAI" Version="2.1.0" />
2323
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.3.0-preview.1.25114.11" />

0 commit comments

Comments
 (0)