import { PromptTemplate } from '@langchain/core/prompts'; import { LangGraphRunnableConfig } from '@langchain/langgraph'; import { IGraphNode } from '../../../graphs'; import { LLMProvider } from '../../../types'; import { DbSchemaHelperService } from '../services'; import { DbQueryState } from '../state'; import { DbQueryConfig } from '../types'; export declare class SqlGenerationNode implements IGraphNode { private readonly sqlLLM; private readonly cheapllm; private readonly config; private readonly schemaHelper; private readonly checks?; sqlGenerationPrompt: PromptTemplate\nYou are an expert AI assistant that generates SQL queries based on user questions and a given database schema.\nYou try to following the instructions carefully to generate the SQL query that answers the question.\nDo not hallucinate details or make up information.\nYour task is to convert a question into a SQL query, given a {dialect} database schema.\nAdhere to these rules:\n- **Deliberately go through the question and database schema word by word** to appropriately answer the question\n- **DO NOT make any DML statements** (INSERT, UPDATE, DELETE, DROP etc.) to the database.\n- Never query for all the columns from a specific table, only ask for the relevant columns for the given the question.\n- You can only generate a single query, so if you need multiple results you can use JOINs, subqueries, CTEs or UNIONS.\n- Do not make any assumptions about the user's intent beyond what is explicitly provided in the prompt.\n- Ensure proper grouping with brackets for where clauses with multiple conditions using AND and OR.\n- Follow each and every single rule in the \"must-follow-rules\" section carefully while writing the query. DO NOT SKIP ANY RULE.\n\n\n{question}\n\n\n\n{dbschema}\n\n\n{checks}\n\n{exampleQueries}\n\n{feedbacks}\n\n\n{outputFormat}\n">, any>; outputFormat: string; feedbackPrompt: PromptTemplate\nWe also need to consider the users feedback on the last attempt at query generation.\nMake sure you fix the provided error without introducing any new or past errors.\nIn the last attempt, you generated this SQL query -\n\n{query}\n\n\n\n{feedback}\n\n\n{historicalErrors}\n">, any>; constructor(sqlLLM: LLMProvider, cheapllm: LLMProvider, config: DbQueryConfig, schemaHelper: DbSchemaHelperService, checks?: string[] | undefined); execute(state: DbQueryState, config: LangGraphRunnableConfig): Promise; getFeedbacks(state: DbQueryState): Promise; sampleQueries(state: DbQueryState): Promise; private _buildChecks; }