From 403ddc46aa563cf45b6fc28e1cd715e5c4da8831 Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Fri, 10 Jul 2026 15:58:39 +0200 Subject: [PATCH 1/3] Use a multilines string as evalution criteria --- examples/matplotlib_exercices.ipynb | 18 ++++-------------- src/index.ts | 7 ++++--- src/utils.ts | 16 ---------------- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/examples/matplotlib_exercices.ipynb b/examples/matplotlib_exercices.ipynb index 660a778..373d8a1 100644 --- a/examples/matplotlib_exercices.ipynb +++ b/examples/matplotlib_exercices.ipynb @@ -49,10 +49,8 @@ "metadata": { "deletable": true, "editable": true, - "evaluation_criteria": [ - "Typo Correction: Correct 'np.linsapce' typo to 'np.linspace'.", - "Plot Output: Ensure the Sine and Cosine waves plot is correctly rendered without runtime errors." - ], + "evaluation_criteria": "Typo Correction: Correct 'np.linsapce' typo to 'np.linspace'.\nPlot Output: Ensure the Sine and Cosine waves plot is correctly rendered without runtime errors." + , "reference_solution": "vzcbeg zngcybgyvo.clcybg nf cyg\nvzcbeg ahzcl nf ac\nk = ac.yvafcnpr(0, 2 * ac.cv, 100)\nsvt, nk = cyg.fhocybgf(svtfvmr=(8, 4))\nnk.cybg(k, ac.fva(k), ynory='fva(k)', pbybe='eblnyoyhr')\nnk.cybg(k, ac.pbf(k), ynory='pbf(k)', pbybe='gbzngb', yvarfglyr='--')\nnk.frg_gvgyr('Fvar naq Pbfvar Jnirf')\nnk.frg_kynory('k')\nnk.frg_lynory('l')\nnk.yrtraq()\nnk.tevq(Gehr, nycun=0.3)\ncyg.gvtug_ynlbhg()\ncyg.fubj()", "slideshow": { "slide_type": "" @@ -101,11 +99,7 @@ "metadata": { "deletable": true, "editable": true, - "evaluation_criteria": [ - "Bar chart creation: Uses ax.bar with categories and values.", - "Aesthetics & Colors: Applies a different color to each bar.", - "Value Labels: Correctly loops over the bars to add text scores above each bar." - ], + "evaluation_criteria": "Bar chart creation: Uses ax.bar with categories and values.\nAesthetics & Colors: Applies a different color to each bar.\nValue Labels: Correctly loops over the bars to add text scores above each bar.", "reference_solution": "pngrtbevrf = ['Clguba', 'WninFpevcg', 'Ehfg', 'Tb', 'Whyvn']\ninyhrf = [85, 72, 58, 45, 30]\nsvt, nk = cyg.fhocybgf(svtfvmr=(8, 4))\npbybef = ['eblnyoyhr', 'gbzngb', 'zrqvhzfrnterra', 'benatr', 'zrqvhzchecyr']\nonef = nk.one(pngrtbevrf, inyhrf, pbybe=pbybef)\nnk.frg_gvgyr('Cebtenzzvat Ynathntr Fpberf')\nnk.frg_lynory('Fpber')\nsbe one va onef:\n liny = one.trg_urvtug()\n nk.grkg(one.trg_k() + one.trg_jvqgu()/2.0, liny + 1, fge(liny), un='pragre', in='obggbz')\ncyg.gvtug_ynlbhg()\ncyg.fubj()", "slideshow": { "slide_type": "" @@ -163,11 +157,7 @@ "metadata": { "deletable": true, "editable": true, - "evaluation_criteria": [ - "Random data seed: Fails to set random seed 42, generating incorrect data coordinates.", - "Colorbar & Labels: Missing colorbar, title, grid, or x/y labels on the axes.", - "Scatter aesthetic parameters: Fails to set alpha=0.6, colormap='viridis', size mapping, or color mapping." - ], + "evaluation_criteria": "Random data seed: Fails to set random seed 42, generating incorrect data coordinates.\nColorbar & Labels: Missing colorbar, title, grid, or x/y labels on the axes.\nScatter aesthetic parameters: Fails to set alpha=0.6, colormap='viridis', size mapping, or color mapping.", "reference_solution": "ac.enaqbz.frrq(42)\na = 150\nk = ac.enaqbz.enaqa(a)\nl = ac.enaqbz.enaqa(a)\nfvmrf = ac.enaqbz.havsbez(20, 200, a)\npbybef = ac.enaqbz.enaq(a)\nsvt, nk = cyg.fhocybgf(svtfvmr=(8, 6))\nfpnggre = nk.fpnggre(k, l, p=pbybef, f=fvmrf, pznc='ivevqvf', nycun=0.6)\ncyg.pbybeone(fpnggre, nk=nk, ynory='Pbybe inyhr')\nnk.frg_gvgyr('Enaqbz Fpnggre Cybg')\nnk.frg_kynory('K inyhrf')\nnk.frg_lynory('L inyhrf')\nnk.tevq(Gehr, nycun=0.3)\ncyg.gvtug_ynlbhg()\ncyg.fubj()", "slideshow": { "slide_type": "" diff --git a/src/index.ts b/src/index.ts index 11c1ba8..9e783c3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,7 +19,7 @@ import { infoIcon } from '@jupyterlab/ui-components'; import { clearItem, stopItem } from './components'; import { TUTOR_USER, TutorChatModel } from './model'; -import { decodeRot13, formatEvaluationCriteria, isContinuous } from './utils'; +import { decodeRot13, isContinuous } from './utils'; const INFO_ICON_BASE_64 = btoa(infoIcon.svgstr); @@ -282,8 +282,9 @@ const plugin: JupyterFrontEndPlugin = { typeof rawSolution === 'string' ? decodeRot13(rawSolution) : ''; // Retrieve and format evaluation_criteria from metadata - const rawCriteria = cell.model.getMetadata('evaluation_criteria'); - const evaluationCriteria = formatEvaluationCriteria(rawCriteria); + const evaluationCriteria = cell.model.getMetadata( + 'evaluation_criteria' + ); const question = errorSection ? 'Explain code and error' diff --git a/src/utils.ts b/src/utils.ts index fbaafbf..d43ce6c 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -21,19 +21,3 @@ export function decodeRot13(str: string): string { return String.fromCharCode(((c.charCodeAt(0) - base + 13) % 26) + base); }); } - -export function formatEvaluationCriteria(criteriaData: unknown): string { - if (!criteriaData) { - return ''; - } - if (typeof criteriaData === 'string') { - return criteriaData; - } - if (Array.isArray(criteriaData)) { - return criteriaData - .map(item => (typeof item === 'string' ? `- ${item.trim()}` : '')) - .filter(Boolean) - .join('\n'); - } - return ''; -} From 8a188bdad5c4d7b81a7f335a3a7a2f259ef7e746 Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Fri, 10 Jul 2026 16:05:10 +0200 Subject: [PATCH 2/3] docstring --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 9e783c3..21108ce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -281,7 +281,7 @@ const plugin: JupyterFrontEndPlugin = { const referenceSolution = typeof rawSolution === 'string' ? decodeRot13(rawSolution) : ''; - // Retrieve and format evaluation_criteria from metadata + // Retrieve evaluation_criteria from metadata const evaluationCriteria = cell.model.getMetadata( 'evaluation_criteria' ); From d8da00c393990399ac779a463253958883ae7266 Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Fri, 10 Jul 2026 16:31:31 +0200 Subject: [PATCH 3/3] Ensure evaluation criteria type --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 21108ce..d291cb0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -300,7 +300,7 @@ const plugin: JupyterFrontEndPlugin = { if (referenceSolution) { formattedBody += `\n\n\n${referenceSolution}\n`; } - if (evaluationCriteria) { + if (evaluationCriteria && typeof evaluationCriteria === 'string') { formattedBody += `\n\n\n${evaluationCriteria}\n`; }