new(whatsapp.gblib): LLM SQL.

This commit is contained in:
Rodrigo Rodriguez 2024-08-13 20:26:40 -03:00
parent 9d82774544
commit fa6fe752cc

View file

@ -506,7 +506,8 @@ export class ChatServices {
const prompt = const prompt =
PromptTemplate.fromTemplate(`Based on the provided SQL table schema below, write a SQL query that would answer the user's question. 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} SCHEMA: {schema}
------------ ------------
QUESTION: {question} QUESTION: {question}
@ -525,7 +526,7 @@ export class ChatServices {
question: (input: { question: string }) => input.question question: (input: { question: string }) => input.question
}, },
prompt, prompt,
model.bind({ stop: ['\nSQLResult:'] }), model,
new StringOutputParser() new StringOutputParser()
]); ]);