]> git.giacomolli.uk - onechat/blobdiff - compactor.go
Separate multiline Go statements
[onechat] / compactor.go
index 2b239015ce763f56d1a23a4621647f056023b07b..6738955143a59125c77f01dd73a938eb0a3dd203 100644 (file)
@@ -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)
@@ -125,6 +125,7 @@ func compactorTask(task Task) (string, error) {
 <input>
 %s
 </input>`, task.Index, nodeBytes, compactorRuler, task.Input[0])
+
                if len(task.Images) > 0 {
                        text += "\nKeep each [image FILE] name and describe its kind, visible text, amounts, names, and context."
                }