Summarizer.Summarize

Summarizer Summarize method. Generates summary for the document with options to control the summary length and other settings.

Summarize(string, string, AiModelSummarizeOptions)

Generates summary for the document, with options to control the summary length and other settings.

public static void Summarize(string inputFile, string outputFile, AiModel model, 
    SummarizeOptions options = null)
ParameterTypeDescription
inputFileStringThe input file name.
outputFileStringThe output file name.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
optionsSummarizeOptionsOptional set of options used when summarizing a document with AI.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.

Examples

Shows how to create custom OpenAiModel and perform document summarization.

string apiUrl = Environment.GetEnvironmentVariable("CUSTOM_OPENAI_URL", EnvironmentVariableTarget.User);
string apiName = Environment.GetEnvironmentVariable("CUSTOM_OPENAI_NAME", EnvironmentVariableTarget.User);
string apiKey = Environment.GetEnvironmentVariable("CUSTOM_OPENAI_KEY", EnvironmentVariableTarget.User);

AiModel model = OpenAiModel.Create(apiUrl, apiName, apiKey);

SummarizeOptions options = new SummarizeOptions() { SummaryLength = SummaryLength.VeryShort };

Summarizer.Summarize(MyDir + "SimpleAI.docx", ArtifactsDir + "Summarize.docx", model, options);

See Also


Summarize(string[], string, AiModelSummarizeOptions)

Generates summaries for an array of documents, with options to control the summary length and other settings. This method utilizes the connected AI model for processing each document in the array.

public static void Summarize(string[] inputFiles, string outputFile, AiModel model, 
    SummarizeOptions options = null)
ParameterTypeDescription
inputFilesString[]The input file names.
outputFileStringThe output file name.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
optionsSummarizeOptionsOptional set of options used when summarizing a document with AI.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.

See Also


Summarize(string, string, SaveFormatAiModelSummarizeOptions)

Generates summary for the document, with options to control the summary length and other settings.

public static void Summarize(string inputFile, string outputFile, SaveFormat saveFormat, 
    AiModel model, SummarizeOptions options = null)
ParameterTypeDescription
inputFileStringThe input file name.
outputFileStringThe output file name.
saveFormatSaveFormatThe save format.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
optionsSummarizeOptionsOptional set of options used when summarizing a document with AI.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.

See Also


Summarize(string[], string, SaveFormatAiModelSummarizeOptions)

Generates summaries for an array of documents, with options to control the summary length and other settings. This method utilizes the connected AI model for processing each document in the array.

public static void Summarize(string[] inputFiles, string outputFile, SaveFormat saveFormat, 
    AiModel model, SummarizeOptions options = null)
ParameterTypeDescription
inputFilesString[]The input file names.
outputFileStringThe output file name.
saveFormatSaveFormatThe save format.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
optionsSummarizeOptionsOptional set of options used when summarizing a document with AI.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.

See Also


Summarize(Stream, Stream, SaveFormatAiModelSummarizeOptions)

Generates summary for the document, with options to control the summary length and other settings.

public static void Summarize(Stream inputStream, Stream outputStream, SaveFormat saveFormat, 
    AiModel model, SummarizeOptions options = null)
ParameterTypeDescription
inputStreamStreamThe input stream.
outputStreamStreamThe output stream.
saveFormatSaveFormatThe save format.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
optionsSummarizeOptionsOptional set of options used when summarizing a document with AI.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.

See Also


Summarize(Stream[], Stream, SaveFormatAiModelSummarizeOptions)

Generates summaries for an array of documents, with options to control the summary length and other settings. This method utilizes the connected AI model for processing each document in the array.

public static void Summarize(Stream[] inputStreams, Stream outputStream, SaveFormat saveFormat, 
    AiModel model, SummarizeOptions options = null)
ParameterTypeDescription
inputStreamsStream[]The input streams.
outputStreamStreamThe output stream.
saveFormatSaveFormatThe save format.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
optionsSummarizeOptionsOptional set of options used when summarizing a document with AI.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.

See Also