From b83b54eee1e733ee2be050faabfb936a094a6407 Mon Sep 17 00:00:00 2001 From: Piyush Gupta <56182734+gupta-piyush19@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:42:01 +0530 Subject: [PATCH] fix: improved AI insights generation prompt (#4330) --- apps/web/app/api/(internal)/insights/lib/document.ts | 2 +- apps/web/app/api/(internal)/pipeline/lib/documents.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/app/api/(internal)/insights/lib/document.ts b/apps/web/app/api/(internal)/insights/lib/document.ts index e3e1e30f3e..0b9d647135 100644 --- a/apps/web/app/api/(internal)/insights/lib/document.ts +++ b/apps/web/app/api/(internal)/insights/lib/document.ts @@ -37,7 +37,7 @@ export const createDocument = async ( const { object } = await generateObject({ model: llmModel, schema: ZGenerateDocumentObjectSchema, - system: `You are an XM researcher. You analyse a survey response (survey name, question headline & user answer) and generate insights from it. The insight title (1-3 words) should concicely answer the question, e.g. "What type of people do you think would most benefit" -> "Developers". You are very objective, for the insights split the feedback in the smallest parts possible and only use the feedback itself to draw conclusions. You must output at least one insight.`, + system: `You are an XM researcher. You analyse a survey response (survey name, question headline & user answer) and generate insights from it. The insight title (1-3 words) should concisely answer the question, e.g., "What type of people do you think would most benefit" -> "Developers". You are very objective. For the insights, split the feedback into the smallest parts possible and only use the feedback itself to draw conclusions. You must output at least one insight. Always generate insights and titles in English, regardless of the input language.`, prompt: `Survey: ${surveyName}\n${documentInput.text}`, temperature: 0, experimental_telemetry: { isEnabled: true }, diff --git a/apps/web/app/api/(internal)/pipeline/lib/documents.ts b/apps/web/app/api/(internal)/pipeline/lib/documents.ts index 61526a9cfd..2a408d0ecd 100644 --- a/apps/web/app/api/(internal)/pipeline/lib/documents.ts +++ b/apps/web/app/api/(internal)/pipeline/lib/documents.ts @@ -43,7 +43,7 @@ export const createDocumentAndAssignInsight = async ( ), isSpam: z.boolean(), }), - system: `You are an XM researcher. You analyse a survey response (survey name, question headline & user answer) and generate insights from it. The insight title (1-3 words) should concicely answer the question, e.g. "What type of people do you think would most benefit" -> "Developers". You are very objective, for the insights split the feedback in the smallest parts possible and only use the feedback itself to draw conclusions. You must output at least one insight.`, + system: `You are an XM researcher. You analyse a survey response (survey name, question headline & user answer) and generate insights from it. The insight title (1-3 words) should concisely answer the question, e.g., "What type of people do you think would most benefit" -> "Developers". You are very objective. For the insights, split the feedback into the smallest parts possible and only use the feedback itself to draw conclusions. You must output at least one insight. Always generate insights and titles in English, regardless of the input language.`, prompt: `Survey: ${surveyName}\n${documentInput.text}`, temperature: 0, experimental_telemetry: { isEnabled: true },