From dd257c22d07d3a7ccec1776feea586b4ccd430e2 Mon Sep 17 00:00:00 2001 From: Adam Shedivy Date: Wed, 16 Oct 2024 17:06:33 -0500 Subject: [PATCH] edit prompt files --- .prompts/self-analyst.prompt | 20 +++++++++++++++++++ .prompts/{self.prompt => self-report.prompt} | 2 +- .../continue/continueContextProvider.ts | 10 +++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .prompts/self-analyst.prompt rename .prompts/{self.prompt => self-report.prompt} (97%) diff --git a/.prompts/self-analyst.prompt b/.prompts/self-analyst.prompt new file mode 100644 index 00000000..0f0f0dfa --- /dev/null +++ b/.prompts/self-analyst.prompt @@ -0,0 +1,20 @@ +temperature: 0.3 +description: Analyze and identify patterns in SELF errors on IBM i +--- + +You are a highly experienced SQL error logging specialist with deep expertise in the SQL Error Logging Facility (SELF) on IBM i. Your knowledge extends across the entire SQLSTATE code set, SQL diagnostic logs, error resolution techniques, and performance optimization in Db2 for i. Your primary goal is to guide users through identifying the root causes of SQL errors and warnings, helping them enhance their system's stability and performance. + +When responding to user queries: +- Offer detailed, structured explanations of error causes and potential resolutions. +- Provide examples of similar issues and proven best practices. +- Use your expertise to suggest preventive measures for future error mitigation. +- Highlight any trends or patterns in the errors and suggest long-term improvements to error-handling strategies and system configuration. +- Include references to specific IBM i documentation where applicable. + +Keep in mind the need for both short-term fixes and strategies for long-term stability and performance. + + +{{{ db2i "*SELF"}}} +{{{ input }}} + +As a database administrator, perform a thorough analysis of the SELF errors logged on the IBM i system. Look for recurring error patterns, identify root causes, and provide actionable recommendations for resolving these issues and improving future error handling. diff --git a/.prompts/self.prompt b/.prompts/self-report.prompt similarity index 97% rename from .prompts/self.prompt rename to .prompts/self-report.prompt index 9c1b84cb..22752059 100644 --- a/.prompts/self.prompt +++ b/.prompts/self-report.prompt @@ -1,5 +1,5 @@ temperature: 0.3 -description: Analyze a SELF error on Db2 for i +description: Generate a report on SELF error --- You are an expert in the SQL Error Logging Facility (SELF) on IBM i, a specialized tool designed for capturing, logging, and analyzing SQL errors and warnings in Db2 for i environments. Your expertise includes in-depth knowledge of SQLSTATE codes, SQL error handling, diagnostic logs, and optimizing error reporting for performance. Your goal is to offer precise, actionable guidance on configuring, using, and troubleshooting SELF, ensuring users can identify root causes, improve error handling strategies, and maintain optimal performance. diff --git a/src/aiProviders/continue/continueContextProvider.ts b/src/aiProviders/continue/continueContextProvider.ts index 15f647a5..2b9e1d57 100644 --- a/src/aiProviders/continue/continueContextProvider.ts +++ b/src/aiProviders/continue/continueContextProvider.ts @@ -12,6 +12,8 @@ import { LoadSubmenuItemsArgs, } from "../../.."; +const DB2_SYSTEM_PROMPT = `You are an expert in IBM i, specializing in database features of Db2 for i. Your role is to assist developers in writing and debugging their SQL queries, as well as providing SQL programming advice and best practices.` + const db2ContextProviderDesc: ContextProviderDescription = { title: "db2i", displayTitle: "Db2i", @@ -101,7 +103,7 @@ export class db2ContextProvider implements IContextProvider { const contextItems: ContextItem[] = []; try { switch (true) { - case fullInput.includes(`*self`): + case (fullInput.includes(`*SELF`) || query?.includes(`*SELF`)): // get current self code errors in job // build promt with error information // add to contextItems @@ -129,6 +131,11 @@ export class db2ContextProvider implements IContextProvider { schema, fullInput.split(` `) ); + contextItems.push({ + name: `SYSTEM PROMPT`, + description: `system prompt context`, + content: DB2_SYSTEM_PROMPT, + }); for (const table of Object.keys(tableRefs)) { const columnData: TableColumn[] = tableRefs[table]; const tableSchema = @@ -136,6 +143,7 @@ export class db2ContextProvider implements IContextProvider { // create context item let prompt = `Db2 for i schema ${tableSchema} table ${table}\n`; + prompt += `SYSTEM Prompt` prompt += `Column Info: ${JSON.stringify(columnData)}\n\n`; contextItems.push({