From fa6fe752cc6e0836e9233d2362bc916caca24d13 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Tue, 13 Aug 2024 20:26:40 -0300 Subject: [PATCH] new(whatsapp.gblib): LLM SQL. --- packages/gpt.gblib/services/ChatServices.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/gpt.gblib/services/ChatServices.ts b/packages/gpt.gblib/services/ChatServices.ts index ca1ce8bf..8909dcf1 100644 --- a/packages/gpt.gblib/services/ChatServices.ts +++ b/packages/gpt.gblib/services/ChatServices.ts @@ -506,7 +506,8 @@ export class ChatServices { const prompt = PromptTemplate.fromTemplate(`Based on the provided SQL table schema below, write a SQL query that would answer the user's question. - ------------ + VERY IMPORTANT: Return just the generated SQL command, nothing else. + ------------ SCHEMA: {schema} ------------ QUESTION: {question} @@ -525,7 +526,7 @@ export class ChatServices { question: (input: { question: string }) => input.question }, prompt, - model.bind({ stop: ['\nSQLResult:'] }), + model, new StringOutputParser() ]);