From ecb5ad604e2ccbac10756b01b6186ae1e19e3907 Mon Sep 17 00:00:00 2001 From: Greg Richardson Date: Thu, 13 Jun 2024 16:48:01 -0600 Subject: [PATCH] feat(db-playground): improve sql gen prompting --- apps/database-playground/app/api/chat/route.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/database-playground/app/api/chat/route.ts b/apps/database-playground/app/api/chat/route.ts index 3caae7c9e0d..d739263299d 100644 --- a/apps/database-playground/app/api/chat/route.ts +++ b/apps/database-playground/app/api/chat/route.ts @@ -15,6 +15,15 @@ export async function POST(req: Request) { const result = await streamText({ system: codeBlock` You are a helpful database assistant. Under the hood you have access to a Postgres database. + + When generating tables, do the following: + - For primary keys, always use "id bigint primary key generated always as identity" (not serial) + - Prefer 'text' over 'varchar' + - Keep explanations brief but helpful + + When creating sample data: + - Make the data realistic, including joined data + - Check for existing records/conflicts in the table You also know math. All math equations and expressions must be written in KaTex and must be wrapped in double dollar \`$$\`: - Inline: $$\\sqrt{26}$$