From 61966783e3314ddf265ce3a32e4d46a41a98d0dd Mon Sep 17 00:00:00 2001 From: jaakko Date: Tue, 14 Apr 2026 22:06:29 +0300 Subject: [PATCH] CodeBench: spec-simple.md pienille malleille MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Yksinkertaistettu JSON-skeema: ei sa_type/py_type, vain type-kenttä - Small-profiili käyttää automaattisesti spec-simple promptia - Vähemmän kenttiä per entity → pienempi output → 8b selviytyy --- kipina-codebench/benchmark.mjs | 9 ++++++--- kipina-codebench/prompts/spec-simple.md | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 kipina-codebench/prompts/spec-simple.md diff --git a/kipina-codebench/benchmark.mjs b/kipina-codebench/benchmark.mjs index 5c9cd58..09a41b8 100644 --- a/kipina-codebench/benchmark.mjs +++ b/kipina-codebench/benchmark.mjs @@ -48,6 +48,7 @@ function loadPrompt(name) { } const CLIENT_SYSTEM = loadPrompt('client'); const SPEC_SYSTEM = loadPrompt('spec'); +const SPEC_SIMPLE_SYSTEM = existsSync(join(__dirname, 'prompts', 'spec-simple.md')) ? loadPrompt('spec-simple') : SPEC_SYSTEM; const FIX_SYSTEM = loadPrompt('fix'); // === Mallikohtaiset profiilit === @@ -337,9 +338,11 @@ async function runPipeline(model, scenario, round = 1) { result.reqOk = true; writeFileSync(`${dir}/_requirements.txt`, req.text); - // 2. JSON-speksi - console.log(` [2/5] JSON-speksi...`); - const specResp = await ollamaChat(specModel, `${req.text}\n\nOutput a JSON spec for this project.`, SPEC_SYSTEM, 4096); + // 2. JSON-speksi (small-malleille yksinkertaistettu skeema) + const specProfile = PROFILES.models[specModel]?.profile || PROFILES.default_profile; + const specPrompt = specProfile === 'small' ? SPEC_SIMPLE_SYSTEM : SPEC_SYSTEM; + console.log(` [2/5] JSON-speksi${specProfile === 'small' ? ' (simple)' : ''}...`); + const specResp = await ollamaChat(specModel, `${req.text}\n\nOutput a JSON spec for this project.`, specPrompt, 4096); timings.push(specResp); const spec = extractJson(specResp.text); if (!spec || !spec.entities || spec.entities.length === 0) { result.error = 'JSON-speksi epäonnistui'; writeFileSync(`${dir}/_spec_raw.txt`, specResp.text); return result; } diff --git a/kipina-codebench/prompts/spec-simple.md b/kipina-codebench/prompts/spec-simple.md new file mode 100644 index 0000000..538c074 --- /dev/null +++ b/kipina-codebench/prompts/spec-simple.md @@ -0,0 +1,17 @@ +You design database schemas. Output ONLY valid JSON, no explanations. + +SCHEMA: +{"project_name":"name","entities":[{"name":"Entity","table_name":"entities","fields":[{"name":"field","type":"string","nullable":false,"default":null}]}],"relationships":[{"from":"Child","field":"parent_id","to":"Parent"}]} + +FIELD TYPES: string, text, int, float, bool, date, datetime +- Status fields: type "string", default "draft" or "pending" +- id is automatic — do NOT include it +- FK fields: type "int", name ends with _id + +RULES: +- Parent entities BEFORE children in array +- Every _id field needs a relationship entry +- Max 7 fields, max 3 entities +- English names only + +EXAMPLE: Blog → Author: name(string), email(string) / Post: title(string), content(text), author_id(int)→Author, status(string,default="draft")