Skip to content

Commit

Permalink
feat(agent): make repetition checker disabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas2D committed Sep 10, 2024
1 parent e414674 commit 4bc3a60
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/agents/bee/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,18 @@ interface Callbacks {

class RepetitionChecker {
protected stash: string[] = [];
public enabled = true;

constructor(
protected readonly size: number,
protected threshold: number,
) {}

add(chunk: string) {
if (!this.enabled) {
return false;
}

if (this.stash.length > this.size) {
this.stash.shift();
}
Expand Down Expand Up @@ -96,6 +101,7 @@ export class BeeOutputParser {
repetition: {
size: 20,
threshold: 10,
enabled: true,
},
};

Expand All @@ -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) {
Expand Down

0 comments on commit 4bc3a60

Please sign in to comment.