Class PdfChatGpt
Именује се: Aspose.Pdf.Plugins Састанак: Aspose.PDF.dll
Представља ПдфцхатГпт плугин.
public sealed class PdfChatGpt : IPlugin, IDisposable
Inheritance
Implements
Наслеђени чланови
object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Пример показује како да користите ПдфцхатГпт плугин додавањем порука у захтев.
using (var plugin = new PdfChatGpt())
{
var options = new PdfChatGptRequestOptions();
options.AddOutput(new FileDataSource("PdfChatGPT_output.pdf")); // Add the output file path.
options.ApiKey = "Your API key."; // You need to provide the key to access the API.
options.MaxTokens = 1000; // The maximum number of tokens to generate in the chat completion.
// Add the request messages.
options.Messages.Add(new Message
{
Content = "You are a helpful assistant.",
Role = Role.System
});
options.Messages.Add(new Message
{
Content = "What is the biggest pizza diameter ever made?",
Role = Role.User
});
// Process the request.
var result = await plugin.ProcessAsync(options);
var fileResultPath = result.ResultCollection[0].Data;
var chatCompletionObject = result.ResultCollection[1].Data as ChatCompletion; // The ChatGPT API chat completion object.
}
Пример показује како да користите ПдфцхатГпт плугин додавањем једне поруке у захтев.
using (var plugin = new PdfChatGpt())
{
var options = new PdfChatGptRequestOptions();
options.AddOutput(new FileDataSource("PdfChatGPT_output.pdf")); // Add the output file path.
options.ApiKey = "Your API key."; // You need to provide the key to access the API.
options.MaxTokens = 1000; // The maximum number of tokens to generate in the chat completion.
// Add the request message.
// In this case, the system message with Content = "You are a helpful assistant." is added by default.
// The role of the query message is "user" by default.
options.Query = "What is the lowest temperature recorded on the Earth?";
// Process the request.
var result = await plugin.ProcessAsync(options);
var fileResultPath = result.ResultCollection[0].Data;
var chatCompletionObject = result.ResultCollection[1].Data as ChatCompletion; // The ChatGPT API chat completion object.
}
Пример показује како да користите ПдфцхатГпт плугин додавањем датотеке(а) као извор поруке(а).
using (var plugin = new PdfChatGpt())
{
var options = new PdfChatGptRequestOptions();
options.AddOutput(new FileDataSource("PdfChatGPT_output.pdf")); // Add the output file path.
// Add the PDF text source.
// In case of multiple sources, the text from each document will be added to the request message collection
// as a separate message with the role "user".
options.AddInput(new FileDataSource("TextSource.pdf"));
options.ApiKey = "Your API key."; // You need to provide the key to access the API.
options.MaxTokens = 1000; // The maximum number of tokens to generate in the chat completion.
// Add the request message.
// In this case, the system message with Content = "You are a helpful assistant." is added by default.
// The role of the query message is "user" by default.
options.Query = "How many letters in the provided text?";
// Process the request.
var result = await plugin.ProcessAsync(options);
var fileResultPath = result.ResultCollection[0].Data;
var chatCompletionObject = result.ResultCollection[1].Data as ChatCompletion; // The ChatGPT API chat completion object.
}
Remarks
Objekt Aspose.Pdf.Plugins.PdfChatGpt se koristi za slanje zahteva ChatGPT-u direktnoили додавањем извора ПДФ датотеке и сачувањем одговора на извор извора.
Constructors
PdfChatGpt()
public PdfChatGpt()
Methods
Dispose()
Имплементација ИДИ недоступна. у ствари, то није потребно за ПдфцхатГпт.
public void Dispose()
Process(ИПЛУГИНОПЦИЈА)
Метода нема синхронску верзију. уместо тога користите методу ProcessAsync.
public ResultContainer Process(IPluginOptions options)
Parameters
options
IPluginOptions
Опција објекат са упутствима за ПдфцхатГпт.
Returns
Exceptions
ProcessAsync(ИПЛУГИНОПЦИЈА)
Почиње обрада ПдфцхатГпт са одређеним параметрима.
public Task<resultcontainer> ProcessAsync(IPluginOptions options)
Parameters
options
IPluginOptions
Опција објекат са упутствима за ПдфцхатГпт.
Returns
Task < ResultContainer >
Предмет задатака представља асинхронну операцију.
Exceptions
SetCancellationToken(CancellationToken)
Поставите токен за укидање.
public void SetCancellationToken(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationToken
Токен за укидање.