We are excited to introduce the Documentize ChatGPT for .NET plugin, a powerful tool that enables you to seamlessly integrate the ChatGPT API with your PDF applications. This innovative solution allows developers to generate chat responses based on user input and save the results in a structured PDF format. It’s perfect for creating interactive reports, conversational interfaces, or automating text analysis tasks directly within PDFs.
Key Features
- Chat Completions: Easily generate chat responses using the ChatGPT API based on user input or custom queries.
- System & User Messages: Provide context and user input to simulate dynamic and interactive conversations.
- PDF Output: Automatically save generated chat responses into a well-structured PDF format.
- Asynchronous Processing: Handle chat completions asynchronously to ensure responsive performance in your .NET applications.
Generate Chat Responses and Save to PDF
The ChatGPT for .NET plugin simplifies the process of generating chat responses and saving them as PDFs. Follow these steps to get started with this .NET ChatGPT PDF document generation library:
- Create an instance of the
PdfChatGptRequestOptions
class to configure your request settings. - Add your input and output PDF files.
- Set your API key and other parameters such as token limits and the input query.
- Run the
ProcessAsync
method to generate the chat response and save it to the PDF.
Here’s a sample code snippet:
var options = new PdfChatGptRequestOptions();
options.ApiKey = "sk-******"; // Set your API key
options.MaxTokens = 1000; // Set the maximum number of tokens
options.Query = "Analyze this text for key themes.";
// Add the input PDF file
options.AddInput(new FileDataSource("input.pdf"));
// Specify where to save the output PDF with chat responses
options.AddOutput(new FileDataSource("output.pdf"));
// Create an instance of the PdfChatGpt plugin
var plugin = new PdfChatGpt();
// Run the process asynchronously
var result = await plugin.ProcessAsync(options);
Adding System and User Messages
To create more dynamic conversations, you can easily add system and user messages. The system message defines the context of the conversation, while the user message serves as input for the ChatGPT model.
Here’s how to add these messages:
var options = new PdfChatGptRequestOptions();
options.ApiKey = "sk-******"; // Set your API key
// Add system message for context
options.AddSystemMessage("You are an AI trained to summarize text.");
// Add user message to query the ChatGPT model
options.AddUserMessage("Please summarize the attached document.");
// Add input and output PDFs
options.AddInput(new FileDataSource("input.pdf"));
options.AddOutput(new FileDataSource("output.pdf"));
// Process the request asynchronously
var plugin = new PdfChatGpt();
var result = await plugin.ProcessAsync(options);
Public API Changes
In this release, we’ve introduced several important API changes:
- The
PdfChatGptRequestOptions
class now includes methods for setting system and user messages. - The
AddInput
andAddOutput
methods support adding multiple files for both input and output PDF processing. - The
ProcessAsync
method has been optimized for faster performance, especially when handling large input data.
Documentize ChatGPT for .NET Resources
To help you make the most of the Documentize ChatGPT for .NET plugin, here are some valuable resources:
- Home page for Documentize ChatGPT for .NET
- Download Documentize ChatGPT for .NET
- Documentize product family forum - Join the community to post your technical questions and get support.
- Documentize ChatGPT for .NET online documentation – Access help docs and API references.
- Enable Blog Subscription – Stay updated with the latest news on Documentize APIs, new features, and updates.
- Documentize ChatGPT for .NET Examples – Explore code examples for better understanding and implementation.
We hope you enjoy this new release, which brings conversational AI capabilities directly into your PDF applications. With easy .NET ChatGPT API integration, developers can quickly enhance their existing PDF projects. Whether you’re looking to add ChatGPT functionality to your .NET PDF software or automate document processing, this solution provides the best practices for achieving your goals.