Implement loop check with LLM (#4337)

Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
Sandy Tao
2025-07-18 09:33:46 -07:00
committed by GitHub
parent c5761317f4
commit 9dadf22958
5 changed files with 296 additions and 34 deletions
+7
View File
@@ -324,6 +324,13 @@ This is the cursor position in the file:
}
const turn = new Turn(this.getChat(), prompt_id);
const loopDetected = await this.loopDetector.turnStarted(signal);
if (loopDetected) {
yield { type: GeminiEventType.LoopDetected };
return turn;
}
const resultStream = turn.run(request, signal);
for await (const event of resultStream) {
if (this.loopDetector.addAndCheck(event)) {