]> git.giacomolli.uk - onechat/blobdiff - rebuild.go
Give the rebuild its own call limit
[onechat] / rebuild.go
index 52c0861eabfac5463057319bba263a80755bd295..91b5ae516498da3e5b91d2f4aed898c7230a7b02 100644 (file)
@@ -15,6 +15,11 @@ import (
        "time"
 )
 
+// rebuildCallLimit is the most model calls of a rebuild. A rebuild summarizes
+// the whole merged log, which can need more calls than a probe sample, and the
+// quota stop of the build run still guards the account.
+const rebuildCallLimit = 1500
+
 // rebuild merges added messages with the log of agent, in date order, and
 // builds a new memory beside it. The caller holds the token lock. The model
 // uses the original agent prompt and cache key. A failed or stopped build
@@ -55,7 +60,7 @@ func rebuild(ctx context.Context, agent *Agent, added []DatedMessage, client *Mo
                return "", fmt.Errorf("open rebuilt memory: %w", err)
        }
 
-       client.LimitCalls(buildCallLimit)
+       client.LimitCalls(rebuildCallLimit)
 
        run := BuildRun{
                memory:    memory,