chore: migrate from responseSchema to use responseJsonSchema. (#4814)

This commit is contained in:
Wanlin Du
2025-08-11 16:04:58 -07:00
committed by GitHub
parent c7fd4c4a96
commit f52d073dfb
6 changed files with 28 additions and 36 deletions

View File

@@ -9,7 +9,6 @@ import { GeminiEventType, ServerGeminiStreamEvent } from '../core/turn.js';
import { logLoopDetected } from '../telemetry/loggers.js';
import { LoopDetectedEvent, LoopType } from '../telemetry/types.js';
import { Config, DEFAULT_GEMINI_FLASH_MODEL } from '../config/config.js';
import { SchemaUnion, Type } from '@google/genai';
const TOOL_CALL_LOOP_THRESHOLD = 5;
const CONTENT_LOOP_THRESHOLD = 10;
@@ -341,16 +340,16 @@ Please analyze the conversation history to determine the possibility that the co
...recentHistory,
{ role: 'user', parts: [{ text: prompt }] },
];
const schema: SchemaUnion = {
type: Type.OBJECT,
const schema: Record<string, unknown> = {
type: 'object',
properties: {
reasoning: {
type: Type.STRING,
type: 'string',
description:
'Your reasoning on if the conversation is looping without forward progress.',
},
confidence: {
type: Type.NUMBER,
type: 'number',
description:
'A number between 0.0 and 1.0 representing your confidence that the conversation is in an unproductive state.',
},