From 4bc3a6094f86c9ec952331dd7afb86820a40cc81 Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Tue, 10 Sep 2024 13:49:27 +0200 Subject: [PATCH] feat(agent): make repetition checker disabled by default --- src/agents/bee/parser.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/agents/bee/parser.ts b/src/agents/bee/parser.ts index 9ae99207..8f206250 100644 --- a/src/agents/bee/parser.ts +++ b/src/agents/bee/parser.ts @@ -61,6 +61,7 @@ interface Callbacks { class RepetitionChecker { protected stash: string[] = []; + public enabled = true; constructor( protected readonly size: number, @@ -68,6 +69,10 @@ class RepetitionChecker { ) {} add(chunk: string) { + if (!this.enabled) { + return false; + } + if (this.stash.length > this.size) { this.stash.shift(); } @@ -96,6 +101,7 @@ export class BeeOutputParser { repetition: { size: 20, threshold: 10, + enabled: true, }, }; @@ -122,6 +128,7 @@ export class BeeOutputParser { BeeOutputParser.Config.repetition.size, BeeOutputParser.Config.repetition.threshold, ); + this.repetitionChecker.enabled = BeeOutputParser.Config.repetition.enabled; } async add(chunk: string) {