]> git.giacomolli.uk - onechat/blobdiff - compactor.go
Name and order the model client code
[onechat] / compactor.go
index e899c094ee58ad0036cdd7443fac632a9b903df9..48b855b743ae56cf6793e175be5543e8ef4ba1d5 100644 (file)
@@ -28,16 +28,16 @@ var ruler = strings.Repeat("-", nodeBytes)
 // because the view measures the real sizes. A call that fails before any line
 // fails the build, and the core tries it again at the next message.
 type Compactor struct {
-       client       *Client
+       client       *ModelClient
        model        ModelConfig
        instructions func() (string, error)
-       tools        []Tool
+       tools        []ModelTool
 }
 
 // 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, so a build sends the same prompt as the turns of that time.
-func newCompactor(client *Client, instructions func() (string, error), model ModelConfig) *Compactor {
+func newCompactor(client *ModelClient, instructions func() (string, error), model ModelConfig) *Compactor {
        return &Compactor{
                client:       client,
                model:        model,
@@ -67,13 +67,13 @@ func (c *Compactor) Summarize(ctx context.Context, task Task) (string, error) {
                        parts = append(parts, note)
                }
 
-               var response Response
-               response, err = c.client.Create(ctx, Request{
+               var response ModelResponse
+               response, err = c.client.Create(ctx, ModelRequest{
                        Model:        c.model.Model,
                        Effort:       c.model.Effort,
                        Instructions: instructions,
                        Tools:        c.tools,
-                       Input:        []any{userMessage(parts...)},
+                       Input:        []any{modelUserMessage(parts...)},
                        Node:         &nodeKey{task.Level, task.Index},
                })
                if err != nil {