mirror of
https://github.com/Mintplex-Labs/anything-llm
synced 2026-04-26 01:25:15 +02:00
Support SQL Agent skill (#1411)
* Support SQL Agent skill * add MSSQL agent connector * Add frontend to agent skills remove FAKE_DB mock reset skills to pickup child-skill dynamically * add prompt examples for tools on untooled * add better logging on SQL agents * Wipe toolruns on each chat relay so tools can be used within the same session * update comments
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
module.exports.SqlAgentListDatabase = {
|
||||
name: "sql-list-databases",
|
||||
plugin: function () {
|
||||
const { listSQLConnections } = require("./SQLConnectors");
|
||||
return {
|
||||
name: "sql-list-databases",
|
||||
setup(aibitat) {
|
||||
aibitat.function({
|
||||
super: aibitat,
|
||||
name: this.name,
|
||||
description:
|
||||
"List all available databases via `list_databases` you currently have access to. Returns a unique string identifier `database_id` that can be used for future calls.",
|
||||
examples: [
|
||||
{
|
||||
prompt: "What databases can you access?",
|
||||
call: JSON.stringify({}),
|
||||
},
|
||||
{
|
||||
prompt: "What databases can you tell me about?",
|
||||
call: JSON.stringify({}),
|
||||
},
|
||||
{
|
||||
prompt: "Is there a database named erp-logs you can access?",
|
||||
call: JSON.stringify({}),
|
||||
},
|
||||
],
|
||||
parameters: {
|
||||
$schema: "http://json-schema.org/draft-07/schema#",
|
||||
type: "object",
|
||||
properties: {},
|
||||
additionalProperties: false,
|
||||
},
|
||||
handler: async function () {
|
||||
this.super.handlerProps.log(`Using the sql-list-databases tool.`);
|
||||
this.super.introspect(
|
||||
`${this.caller}: Checking what are the available databases.`
|
||||
);
|
||||
|
||||
const connections = (await listSQLConnections()).map((conn) => {
|
||||
const { connectionString, ...rest } = conn;
|
||||
return rest;
|
||||
});
|
||||
return JSON.stringify(connections);
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user