X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/a5c83e92d7feea2e104b5515043a76c8c4c56c60..f5c601f1801aaa276f8c335fcb51c373edc0b50c:/compactor.go?ds=inline diff --git a/compactor.go b/compactor.go index 2b23901..e101428 100644 --- a/compactor.go +++ b/compactor.go @@ -15,20 +15,6 @@ const compactorTries = 5 // bytes, and a sample line as the ruler gets its content copied. var compactorRuler = strings.Repeat("-", nodeBytes) -// newCompactor returns the compactor of an agent, which sends its calls through -// client with model. instructions gives the system prompt of the agent at each -// build. tools are the tools of that agent, so a build sends the same prompt -// and tools as its turns. -func newCompactor(client *ModelClient, instructions func() (string, error), model ModelConfig, tools []ModelTool, images *ImageStore) *Compactor { - return &Compactor{ - client: client, - model: model, - instructions: instructions, - tools: tools, - images: images, - } -} - // Compactor builds the nodes of one agent with a model. A compaction is a call // like a turn, with the same system prompt and tools, so it reads them from the // prompt cache of the turns. The tools are never called. After them comes one @@ -52,6 +38,20 @@ type Compactor struct { images *ImageStore } +// newCompactor returns the compactor of an agent, which sends its calls through +// client with model. instructions gives the system prompt of the agent at each +// build. tools are the tools of that agent, so a build sends the same prompt +// and tools as its turns. +func newCompactor(client *ModelClient, instructions func() (string, error), model ModelConfig, tools []ModelTool, images *ImageStore) *Compactor { + return &Compactor{ + client: client, + model: model, + instructions: instructions, + tools: tools, + images: images, + } +} + // Summarize returns the line of the node of task. func (c *Compactor) Summarize(ctx context.Context, task Task) (string, error) { text, err := compactorTask(task)