SummaryLength

SummaryLength enumeration

Enumera las longitudes posibles del resumen.

public enum SummaryLength

Valores

NombreValorDescripción
VeryShort0Intenta generar 1-2 oraciones.
Short1Intenta generar 3-4 oraciones.
Medium2Intenta generar 5-6 oraciones.
Long3Intenta generar entre 7 y 10 oraciones.
VeryLong4Intenta generar entre 11 y 20 oraciones.

Ejemplos

Muestra cómo resumir texto utilizando OpenAI y modelos de Google.

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

string apiKey = Environment.GetEnvironmentVariable("API_KEY");
// Utilice modelos de lenguaje generativo de 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");

Ver también