mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-05 19:01:12 -07:00
fix(core): update loop detection LLM schema fields (#12091)
This commit is contained in:
@@ -413,18 +413,21 @@ export class LoopDetectionService {
|
||||
const schema: Record<string, unknown> = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
reasoning: {
|
||||
unproductive_state_analysis: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Your reasoning on if the conversation is looping without forward progress.',
|
||||
},
|
||||
confidence: {
|
||||
unproductive_state_confidence: {
|
||||
type: 'number',
|
||||
description:
|
||||
'A number between 0.0 and 1.0 representing your confidence that the conversation is in an unproductive state.',
|
||||
},
|
||||
},
|
||||
required: ['reasoning', 'confidence'],
|
||||
required: [
|
||||
'unproductive_state_analysis',
|
||||
'unproductive_state_confidence',
|
||||
],
|
||||
};
|
||||
let result;
|
||||
try {
|
||||
@@ -442,10 +445,13 @@ export class LoopDetectionService {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof result['confidence'] === 'number') {
|
||||
if (result['confidence'] > 0.9) {
|
||||
if (typeof result['reasoning'] === 'string' && result['reasoning']) {
|
||||
debugLogger.warn(result['reasoning']);
|
||||
if (typeof result['unproductive_state_confidence'] === 'number') {
|
||||
if (result['unproductive_state_confidence'] > 0.9) {
|
||||
if (
|
||||
typeof result['unproductive_state_analysis'] === 'string' &&
|
||||
result['unproductive_state_analysis']
|
||||
) {
|
||||
debugLogger.warn(result['unproductive_state_analysis']);
|
||||
}
|
||||
logLoopDetected(
|
||||
this.config,
|
||||
@@ -456,7 +462,7 @@ export class LoopDetectionService {
|
||||
this.llmCheckInterval = Math.round(
|
||||
MIN_LLM_CHECK_INTERVAL +
|
||||
(MAX_LLM_CHECK_INTERVAL - MIN_LLM_CHECK_INTERVAL) *
|
||||
(1 - result['confidence']),
|
||||
(1 - result['unproductive_state_confidence']),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user