AUDIT / src /lib /agentLoop /toolDefs /toolDefsData.ts
Arypulka98's picture
feat(audit): deploy full backend cluster node (part 3)
95eb75a verified
Raw
History Blame Contribute Delete
1.97 kB
// ─── Data & database tools — execute_sql, database_query ───────────────────────────────────────────────────────────
// P3-4 split da toolDefinitions.ts — DO NOT edit toolDefinitions.ts directly
// Tools (2): execute_sql, database_query
import type { ChatCompletionTool } from "openai/resources/chat/completions";
export const DATA_TOOLS: (ChatCompletionTool | undefined)[] = [
{
type: "function",
function: {
name: "execute_sql",
description: "Esegue query SQL su dati JSON in-memory (SQLite virtuale) senza bisogno di un database reale. Ottimo per analisi, aggregazioni, JOIN su dati forniti. Passa i dati come array di oggetti JSON.",
parameters: {
type: "object",
properties: {
sql: { type: "string", description: "Query SQL da eseguire (SELECT, INSERT, CREATE TABLE, ecc.)" },
data: { type: "array", description: "Dati di input come array di oggetti JSON (es. [{id:1, nome:'Alice'}])" },
read_only: { type: "boolean", description: "Se true, blocca INSERT/UPDATE/DELETE (default: false per in-memory)" },
},
required: ["sql"],
},
},
},
{
type: "function",
function: {
name: "database_query",
description: "Esegue query SQL su database PostgreSQL configurato nel backend (DATABASE_URL). Usa per leggere/scrivere dati persistenti. read_only:true per SELECT sicure senza rischi di modifica.",
parameters: {
type: "object",
properties: {
sql: { type: "string", description: "Query SQL da eseguire" },
params: { type: "array", description: "Parametri posizionali ($1, $2, ecc.)" },
read_only: { type: "boolean", description: "Se true, accetta solo SELECT (default: true)" },
},
required: ["sql"],
},
},
},
];