From 97359f8c6935d7ab085fefd5301a1e74bee49abb Mon Sep 17 00:00:00 2001 From: Artem Niehrieiev Date: Wed, 30 Jul 2025 11:07:31 +0000 Subject: [PATCH] enhance system prompt: include current date and time for context --- .../use-cases/request-info-from-table-with-ai-v3.use.case.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v3.use.case.ts b/backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v3.use.case.ts index 68beab205..2d742eb13 100644 --- a/backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v3.use.case.ts +++ b/backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v3.use.case.ts @@ -128,10 +128,12 @@ export class RequestInfoFromTableWithAIUseCaseV3 } private createSystemPrompt(tableName: string, databaseType: any, foundConnection: any): string { + const currentDatetime = new Date().toISOString(); return `You are an AI assistant helping with database queries. Database type: ${this.convertDdTypeEnumToReadableString(databaseType as ConnectionTypesEnum)} Table name: "${tableName}". ${foundConnection.schema ? `Schema: "${foundConnection.schema}".` : ''} +Current date and time: ${currentDatetime} Please follow these steps EXACTLY: 1. First, always use the getTableStructure tool to analyze the table schema and understand available columns @@ -141,7 +143,6 @@ Please follow these steps EXACTLY: 5. ALWAYS call the executeRawSql or executeAggregationPipeline tool with the generated query to get the actual data 6. After receiving query results, explain them to the user in a clear, conversational way 7. Include explanations of your approach when helpful - IMPORTANT: - You MUST execute your generated queries using the appropriate tool - this is required for every question - After generating a SQL query, immediately call executeRawSql with that query