fix: overlength gen

This commit is contained in:
Han Xiao 2025-02-22 00:28:10 +08:00
parent c42e39f643
commit 528a6343e2
5 changed files with 11 additions and 11 deletions

View File

@ -39,15 +39,15 @@
"maxTokens": 8000 "maxTokens": 8000
}, },
"tools": { "tools": {
"coder": { "temperature": 0.7 }, "coder": { "temperature": 0.7, "maxTokens": 1000 },
"searchGrounding": { "temperature": 0 }, "searchGrounding": { "temperature": 0 },
"dedup": { "temperature": 0.1 }, "dedup": { "temperature": 0.1 },
"evaluator": {}, "evaluator": {"maxTokens": 500},
"errorAnalyzer": {}, "errorAnalyzer": {"maxTokens": 500},
"queryRewriter": { "temperature": 0.1 }, "queryRewriter": { "temperature": 0.1, "maxTokens": 500 },
"agent": { "temperature": 0.7 }, "agent": { "temperature": 0.7 },
"agentBeastMode": { "temperature": 0.7 }, "agentBeastMode": { "temperature": 0.7 },
"fallback": { "temperature": 0 } "fallback": { "temperature": 0, "maxTokens": 1000}
} }
}, },
"openai": { "openai": {

View File

@ -30,7 +30,7 @@ function getSchema(allowReflect: boolean, allowRead: boolean, allowAnswer: boole
const actions: string[] = []; const actions: string[] = [];
const properties: Record<string, z.ZodTypeAny> = { const properties: Record<string, z.ZodTypeAny> = {
action: z.enum(['placeholder']), // Will update later with actual actions action: z.enum(['placeholder']), // Will update later with actual actions
think: z.string().describe(`Explain why choose this action, what's the chain-of-thought behind choosing this action, use the first-person narrative.`) think: z.string().describe(`Explain why choose this action, what's the chain-of-thought behind choosing this action, use the first-person narrative.`).max(500)
}; };
if (allowSearch) { if (allowSearch) {

View File

@ -4,7 +4,7 @@ import {ObjectGeneratorSafe} from "../utils/safe-generator";
const responseSchema = z.object({ const responseSchema = z.object({
think: z.string().describe('Strategic reasoning about the overall deduplication approach'), think: z.string().describe('Strategic reasoning about the overall deduplication approach').max(500),
unique_queries: z.array(z.string().describe('Unique query that passed the deduplication process, must be less than 30 characters')) unique_queries: z.array(z.string().describe('Unique query that passed the deduplication process, must be less than 30 characters'))
.describe('Array of semantically unique queries').max(3) .describe('Array of semantically unique queries').max(3)
}); });

View File

@ -9,7 +9,7 @@ import {ActionTracker} from "../utils/action-tracker";
const baseSchema = { const baseSchema = {
pass: z.boolean().describe('Whether the answer passes the evaluation criteria defined by the evaluator'), pass: z.boolean().describe('Whether the answer passes the evaluation criteria defined by the evaluator'),
think: z.string().describe('Explanation the thought process why the answer does not pass the evaluation criteria') think: z.string().describe('Explanation the thought process why the answer does not pass the evaluation criteria').max(500)
}; };
const definitiveSchema = z.object({ const definitiveSchema = z.object({
@ -263,8 +263,8 @@ Answer: ${JSON.stringify(answer)}`;
const questionEvaluationSchema = z.object({ const questionEvaluationSchema = z.object({
needsFreshness: z.boolean().describe('Whether the question requires freshness check'), needsFreshness: z.boolean().describe('Whether the question requires freshness check'),
needsPlurality: z.boolean().describe('Whether the question requires plurality check'), needsPlurality: z.boolean().describe('Whether the question requires plurality check'),
think: z.string().describe('Explanation of why these checks are needed or not needed'), think: z.string().describe('Explanation of why these checks are needed').max(500),
languageStyle: z.string().describe('The language being used and the overall vibe/mood of the question'), languageStyle: z.string().describe('The language being used and the overall vibe/mood of the question').max(50),
}); });
function getQuestionEvaluationPrompt(question: string): string { function getQuestionEvaluationPrompt(question: string): string {

View File

@ -5,7 +5,7 @@ import {ObjectGeneratorSafe} from "../utils/safe-generator";
const responseSchema = z.object({ const responseSchema = z.object({
think: z.string().describe('Strategic reasoning about query complexity and search approach'), think: z.string().describe('Strategic reasoning about query complexity and search approach').max(500),
queries: z.array(z.string().describe('keyword-based search query, 2-3 words preferred, total length < 30 characters')) queries: z.array(z.string().describe('keyword-based search query, 2-3 words preferred, total length < 30 characters'))
.min(1) .min(1)
.max(3) .max(3)