Class LlamaSummaryCopilot

LlamaSummaryCopilot class

Provides functionality for getting document summaries using AI models. Example usage of creating an Llama client, configuring options, and using the summary copilot. Note: This copilot uses completion API, so the total amount of text that can be sent is limited by the model context window.

// Create AI client.
var llamaClient = LlamaClient
   .CreateWithApiKey(ApiKey) // Create Llama client with the API key.
   .Build();

// Create copilot options.
var options = LlamaSummaryCopilotOptions
   .Create() // Create options like this, or...
   //.Create(options => { options.Model = LlamaModels.Llama13BChat; }) // ...create using delegate.
   .WithTemperature(0.5) // Configure other optional parameters.
   .WithDocument("DocumentInputPath") // .WithDocument methods allows to add text, pdf and paths to documents.
   .WithDocuments(new List<TextDocument>()); // .WithDocuments methods allows to add text, pdf and path collections.

// Create summary copilot.
var summaryCopilot = AICopilotFactory.CreateSummaryCopilot(llamaClient, options);

// Get summary text.
string summaryText = await summaryCopilot.GetSummaryAsync();

// Get summary document.
Document summaryDocument = await summaryCopilot.GetSummaryDocumentAsync();

// Get summary document with page info.
Document summaryDocumentWithPageInfo = await summaryCopilot.GetSummaryDocumentAsync(new PageInfo());

// Save summary as PDF document.
await summaryCopilot.SaveSummaryAsync("outputPath");

// Save summary with specified format.
await summaryCopilot.SaveSummaryAsync("outputPath", SaveFormat.DocX);
public class LlamaSummaryCopilot : ISummaryCopilot

Constructors

NameDescription
LlamaSummaryCopilot(ILlamaClient, ISummaryCopilotOptions<LlamaSummaryCopilotOptions>)Initializes a new instance of the LlamaSummaryCopilot class.

Properties

NameDescription
HasContext { get; }

Methods

NameDescription
GetSummaryAsync(CancellationToken?)
GetSummaryDocumentAsync(CancellationToken?)
GetSummaryDocumentAsync(PageInfo, CancellationToken?)
SaveSummaryAsync(string, CancellationToken?)
SaveSummaryAsync(string, SaveFormat, CancellationToken?)

See Also