SummaryLength

SummaryLength enumeration

Enumera le possibili lunghezze del riepilogo.

public enum SummaryLength

I valori

NomeValoreDescrizione
VeryShort0Prova a generare 1-2 frasi.
Short1Prova a generare 3-4 frasi.
Medium2Prova a generare 5-6 frasi.
Long3Prova a generare 7-10 frasi.
VeryLong4Prova a generare 11-20 frasi.

Esempi

Mostra come riassumere il testo utilizzando i modelli OpenAI e Google.

Document firstDoc = new Document(MyDir + "Big document.docx");
Document secondDoc = new Document(MyDir + "Document.docx");

string apiKey = Environment.GetEnvironmentVariable("API_KEY");
// Utilizza modelli linguistici generativi OpenAI o Google.
IAiModelText model = ((OpenAiModel)AiModel.Create(AiModelType.Gpt4OMini).WithApiKey(apiKey)).WithOrganization("Organization").WithProject("Project");

SummarizeOptions options = new SummarizeOptions();

options.SummaryLength = SummaryLength.Short;
Document oneDocumentSummary = model.Summarize(firstDoc, options);
oneDocumentSummary.Save(ArtifactsDir + "AI.AiSummarize.One.docx");

options.SummaryLength = SummaryLength.Long;
Document multiDocumentSummary = model.Summarize(new Document[] { firstDoc, secondDoc }, options);
multiDocumentSummary.Save(ArtifactsDir + "AI.AiSummarize.Multi.docx");

Guarda anche