From 5a973b5d6388dfd20b5e8217ac89ccafdf8b063f Mon Sep 17 00:00:00 2001 From: AnotiaWang Date: Wed, 12 Feb 2025 17:01:03 +0800 Subject: [PATCH] fix(feedback): force the AI model to generate x questions instead of "max x" --- lib/feedback.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/feedback.ts b/lib/feedback.ts index 36bd870..e47e04b 100644 --- a/lib/feedback.ts +++ b/lib/feedback.ts @@ -21,13 +21,11 @@ export function generateFeedback({ const schema = z.object({ questions: z .array(z.string()) - .describe( - `Follow up questions to clarify the research direction, max of ${numQuestions}`, - ), + .describe(`Follow up questions to clarify the research direction`), }) const jsonSchema = JSON.stringify(zodToJsonSchema(schema)) const prompt = [ - `Given the following query from the user, ask some follow up questions to clarify the research direction. Return a maximum of ${numQuestions} questions, but feel free to return less if the original query is clear: ${query}`, + `Given the following query from the user, ask ${numQuestions} follow up questions to clarify the research direction. Return a maximum of ${numQuestions} questions, but feel free to return less if the original query is clear: ${query}`, `You MUST respond in JSON with the following schema: ${jsonSchema}`, ].join('\n\n')