using IronPdf;using IronPdf.AI;using Microsoft.SemanticKernel;using Microsoft.SemanticKernel.Connectors.OpenAI;using Microsoft.SemanticKernel.Memory;using System;using System.Threading.Tasks;// Setup OpenAIvar azureEndpoint = "<<enter your azure endpoint here>>";var apiKey = "<<enter your azure API key here>>";var builder = Kernel.CreateBuilder() .AddAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey) .AddAzureOpenAIChatCompletion("oaichat", azureEndpoint, apiKey);var kernel = builder.Build();// Setup Memoryvar memory_builder = new MemoryBuilder() // optionally use new ChromaMemoryStore("http://127.0.0.1:8000") (see https://github.com/microsoft/semantic-kernel/blob/main/dotnet/notebooks/09-memory-with-chroma.ipynb) .WithMemoryStore(new VolatileMemoryStore()) .WithAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey);var memory = memory_builder.Build();// Initialize IronAIIronDocumentAI.Initialize(kernel, memory);License.LicenseKey = "<<enter your IronPdf license key here";// Import PDF documentPdfDocument pdf = PdfDocument.FromFile("wikipedia.pdf");// Summarize the documentConsole.WriteLine("Please wait while I summarize the document...");string summary = await pdf.Summarize(); // optionally pass AI instance or use AI instance directlyConsole.WriteLine($"Document summary: {summary}\n\n");
using IronPdf;
using IronPdf.AI;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using Microsoft.SemanticKernel.Memory;
using System;
using System.Threading.Tasks;
// Setup OpenAI
var azureEndpoint = "<<enter your azure endpoint here>>";
var apiKey = "<<enter your azure API key here>>";
var builder = Kernel.CreateBuilder()
.AddAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey)
.AddAzureOpenAIChatCompletion("oaichat", azureEndpoint, apiKey);
var kernel = builder.Build();
// Setup Memory
var memory_builder = new MemoryBuilder()
// optionally use new ChromaMemoryStore("http://127.0.0.1:8000") (see https://github.com/microsoft/semantic-kernel/blob/main/dotnet/notebooks/09-memory-with-chroma.ipynb)
.WithMemoryStore(new VolatileMemoryStore())
.WithAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey);
var memory = memory_builder.Build();
// Initialize IronAI
IronDocumentAI.Initialize(kernel, memory);
License.LicenseKey = "<<enter your IronPdf license key here";
// Import PDF document
PdfDocument pdf = PdfDocument.FromFile("wikipedia.pdf");
// Summarize the document
Console.WriteLine("Please wait while I summarize the document...");
string summary = await pdf.Summarize(); // optionally pass AI instance or use AI instance directly
Console.WriteLine($"Document summary: {summary}\n\n");
ImportsMicrosoft.VisualBasicImportsIronPdfImportsIronPdf.AIImportsMicrosoft.SemanticKernelImportsMicrosoft.SemanticKernel.Connectors.OpenAIImportsMicrosoft.SemanticKernel.MemoryImportsSystemImportsSystem.Threading.Tasks' Setup OpenAIPrivate azureEndpoint = "<<enter your azure endpoint here>>"Private apiKey = "<<enter your azure API key here>>"Private builder = Kernel.CreateBuilder().AddAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey).AddAzureOpenAIChatCompletion("oaichat", azureEndpoint, apiKey)Private kernel = builder.Build()' Setup MemoryPrivate memory_builder = (New MemoryBuilder()).WithMemoryStore(New VolatileMemoryStore()).WithAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey)Private memory = memory_builder.Build()' Initialize IronAIIronDocumentAI.Initialize(kernel, memory)License.LicenseKey = "<<enter your IronPdf license key here"' Import PDF documentDim pdf AsPdfDocument = PdfDocument.FromFile("wikipedia.pdf")' Summarize the documentConsole.WriteLine("Please wait while I summarize the document...")Dim summary AsString = Await pdf.Summarize() ' optionally pass AI instance or use AI instance directlyConsole.WriteLine($"Document summary: {summary}" & vbLf & vbLf)
Imports Microsoft.VisualBasic
Imports IronPdf
Imports IronPdf.AI
Imports Microsoft.SemanticKernel
Imports Microsoft.SemanticKernel.Connectors.OpenAI
Imports Microsoft.SemanticKernel.Memory
Imports System
Imports System.Threading.Tasks
' Setup OpenAI
Private azureEndpoint = "<<enter your azure endpoint here>>"
Private apiKey = "<<enter your azure API key here>>"
Private builder = Kernel.CreateBuilder().AddAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey).AddAzureOpenAIChatCompletion("oaichat", azureEndpoint, apiKey)
Private kernel = builder.Build()
' Setup Memory
Private memory_builder = (New MemoryBuilder()).WithMemoryStore(New VolatileMemoryStore()).WithAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey)
Private memory = memory_builder.Build()
' Initialize IronAI
IronDocumentAI.Initialize(kernel, memory)
License.LicenseKey = "<<enter your IronPdf license key here"
' Import PDF document
Dim pdf As PdfDocument = PdfDocument.FromFile("wikipedia.pdf")
' Summarize the document
Console.WriteLine("Please wait while I summarize the document...")
Dim summary As String = Await pdf.Summarize() ' optionally pass AI instance or use AI instance directly
Console.WriteLine($"Document summary: {summary}" & vbLf & vbLf)
using IronPdf;using IronPdf.AI;using Microsoft.SemanticKernel;using Microsoft.SemanticKernel.Connectors.OpenAI;using Microsoft.SemanticKernel.Memory;using System;using System.Threading.Tasks;// Setup OpenAIvar azureEndpoint = "<<enter your azure endpoint here>>";var apiKey = "<<enter your azure API key here>>";var builder = Kernel.CreateBuilder() .AddAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey) .AddAzureOpenAIChatCompletion("oaichat", azureEndpoint, apiKey);var kernel = builder.Build();// Setup Memoryvar memory_builder = new MemoryBuilder() // optionally use new ChromaMemoryStore("http://127.0.0.1:8000") (see https://github.com/microsoft/semantic-kernel/blob/main/dotnet/notebooks/09-memory-with-chroma.ipynb) .WithMemoryStore(new VolatileMemoryStore()) .WithAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey);var memory = memory_builder.Build();// Initialize IronAIIronDocumentAI.Initialize(kernel, memory);License.LicenseKey = "<<enter your IronPdf license key here";// Import PDF documentPdfDocument pdf = PdfDocument.FromFile("wikipedia.pdf");// Summarize the documentConsole.WriteLine("Please wait while I summarize the document...");string summary = await pdf.Summarize(); // optionally pass AI instance or use AI instance directlyConsole.WriteLine($"Document summary: {summary}\n\n");
using IronPdf;
using IronPdf.AI;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using Microsoft.SemanticKernel.Memory;
using System;
using System.Threading.Tasks;
// Setup OpenAI
var azureEndpoint = "<<enter your azure endpoint here>>";
var apiKey = "<<enter your azure API key here>>";
var builder = Kernel.CreateBuilder()
.AddAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey)
.AddAzureOpenAIChatCompletion("oaichat", azureEndpoint, apiKey);
var kernel = builder.Build();
// Setup Memory
var memory_builder = new MemoryBuilder()
// optionally use new ChromaMemoryStore("http://127.0.0.1:8000") (see https://github.com/microsoft/semantic-kernel/blob/main/dotnet/notebooks/09-memory-with-chroma.ipynb)
.WithMemoryStore(new VolatileMemoryStore())
.WithAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey);
var memory = memory_builder.Build();
// Initialize IronAI
IronDocumentAI.Initialize(kernel, memory);
License.LicenseKey = "<<enter your IronPdf license key here";
// Import PDF document
PdfDocument pdf = PdfDocument.FromFile("wikipedia.pdf");
// Summarize the document
Console.WriteLine("Please wait while I summarize the document...");
string summary = await pdf.Summarize(); // optionally pass AI instance or use AI instance directly
Console.WriteLine($"Document summary: {summary}\n\n");
ImportsMicrosoft.VisualBasicImportsIronPdfImportsIronPdf.AIImportsMicrosoft.SemanticKernelImportsMicrosoft.SemanticKernel.Connectors.OpenAIImportsMicrosoft.SemanticKernel.MemoryImportsSystemImportsSystem.Threading.Tasks' Setup OpenAIPrivate azureEndpoint = "<<enter your azure endpoint here>>"Private apiKey = "<<enter your azure API key here>>"Private builder = Kernel.CreateBuilder().AddAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey).AddAzureOpenAIChatCompletion("oaichat", azureEndpoint, apiKey)Private kernel = builder.Build()' Setup MemoryPrivate memory_builder = (New MemoryBuilder()).WithMemoryStore(New VolatileMemoryStore()).WithAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey)Private memory = memory_builder.Build()' Initialize IronAIIronDocumentAI.Initialize(kernel, memory)License.LicenseKey = "<<enter your IronPdf license key here"' Import PDF documentDim pdf AsPdfDocument = PdfDocument.FromFile("wikipedia.pdf")' Summarize the documentConsole.WriteLine("Please wait while I summarize the document...")Dim summary AsString = Await pdf.Summarize() ' optionally pass AI instance or use AI instance directlyConsole.WriteLine($"Document summary: {summary}" & vbLf & vbLf)
Imports Microsoft.VisualBasic
Imports IronPdf
Imports IronPdf.AI
Imports Microsoft.SemanticKernel
Imports Microsoft.SemanticKernel.Connectors.OpenAI
Imports Microsoft.SemanticKernel.Memory
Imports System
Imports System.Threading.Tasks
' Setup OpenAI
Private azureEndpoint = "<<enter your azure endpoint here>>"
Private apiKey = "<<enter your azure API key here>>"
Private builder = Kernel.CreateBuilder().AddAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey).AddAzureOpenAIChatCompletion("oaichat", azureEndpoint, apiKey)
Private kernel = builder.Build()
' Setup Memory
Private memory_builder = (New MemoryBuilder()).WithMemoryStore(New VolatileMemoryStore()).WithAzureOpenAITextEmbeddingGeneration("oaiembed", azureEndpoint, apiKey)
Private memory = memory_builder.Build()
' Initialize IronAI
IronDocumentAI.Initialize(kernel, memory)
License.LicenseKey = "<<enter your IronPdf license key here"
' Import PDF document
Dim pdf As PdfDocument = PdfDocument.FromFile("wikipedia.pdf")
' Summarize the document
Console.WriteLine("Please wait while I summarize the document...")
Dim summary As String = Await pdf.Summarize() ' optionally pass AI instance or use AI instance directly
Console.WriteLine($"Document summary: {summary}" & vbLf & vbLf)
How does IronPDF ensure security when handling sensitive PDF documents?
IronPDF offers various security and encryption options to protect PDFs, including permissions and password protection. These options help secure documents before and after AI processing, ensuring sensitive information is safeguarded.
What is the role of Microsoft Semantic Kernel in IronPDF's AI extension?
Microsoft Semantic Kernel is the foundation for IronPDF's AI extension, facilitating the integration of AI services in .NET applications. It powers features like summarization and querying by providing structured support for OpenAI capabilities.
How can I optimize performance when using IronPDF's AI features?
For optimal performance with IronPDF's AI features, consider caching strategies, implementing rate limiting, and using optimized deployment configurations. The documentation also suggests techniques for managing performance with large documents and concurrent users.