new(basic.gblib): New batch features.

This commit is contained in:
Rodrigo Rodriguez 2024-08-16 13:02:27 -03:00
parent 6ff24f7fcb
commit c86934e646

View file

@ -475,31 +475,33 @@ export class ChatServices {
question
});
} else if (LLMMode === 'sql') {
// const con = min[`llmconnection`];
const con = min[`llmconnection`];
// const dialect = con['storageDriver'];
// const host = con['storageServer'];
// const port = con['storagePort'];
// const storageName = con['storageName'];
// const username = con['storageUsername'];
// const password = con['storagePassword'];
const dataSource = new DataSource({
type: 'sqlite',
database: '/home/gbadmin3910/DATA/BotServer/work/frukigbot1.gbai/data.db'
});
// const dataSource = new DataSource({
// type: dialect as any,
// host: host,
// port: port,
// database: storageName,
// username: username,
// password: password,
// synchronize: false,
// logging: true,
// });
const dialect = con['storageDriver'];
const host = con['storageServer'];
const port = con['storagePort'];
const storageName = con['storageName'];
const username = con['storageUsername'];
const password = con['storagePassword'];
let dataSource;
if (dialect === 'sqlite') {
dataSource = new DataSource({
type: 'sqlite',
database: storageName
});
} else {
dataSource = new DataSource({
type: dialect as any,
host: host,
port: port,
database: storageName,
username: username,
password: password,
synchronize: false,
logging: true
});
}
const db = await SqlDatabase.fromDataSourceParams({
appDataSource: dataSource
});
@ -575,7 +577,7 @@ export class ChatServices {
},
{
result: finalResponsePrompt.pipe(model).pipe(new StringOutputParser()),
// Pipe the query through here unchanged so it gets logged alongside the result.
sql: previousStepResult => previousStepResult.query
}
@ -586,7 +588,6 @@ export class ChatServices {
});
GBLogEx.info(min, `LLM SQL: ${result.sql}`);
result = result.result;
} else if (LLMMode === 'nochain') {
result = await (tools.length > 0 ? modelWithTools : model).invoke(`
${systemPrompt}