Skip to content

Implement debug mode and improve context and metadata collection #14

Open
Yahiewi wants to merge 2 commits into
QuantStack:mainfrom
Yahiewi:debug
Open

Implement debug mode and improve context and metadata collection #14
Yahiewi wants to merge 2 commits into
QuantStack:mainfrom
Yahiewi:debug

Conversation

@Yahiewi

@Yahiewi Yahiewi commented Jul 3, 2026

Copy link
Copy Markdown
Member

This PR brings 3 majors changes:
-Context collection now works as agreed, by traversing backwards from the code cell to the nearest markdown cell and gathering it and all intermediate cells.
-Added a debug mode which logs the prompts and answers under /tmp/jupyter-ai-tutor. This can be activated by running jupyter lab --JupyterAITutorApp.debug=True.
-Implemented ROT13 decoding for the reference_solution found in the cell's metadata, as well as formatting for the evaluation criteria from the metadata into more readable prose for the LLM.
-Added metadata examples for the matplotlib_exercices.ipynb example to test these changes.
-The payload sent to the LLM now follows this structure:

=== SYSTEM PROMPT === 
This is the prompt from `AGENT.md`
=====================
=== USER MESSAGE ===
<student_context> The context related to the code cell from which the 'help' command was ran. <student_context> 
<student_answer> The active cell (which the student might have changed) <student_answer>
<reference_solution> Decoded using the ROT13 decoder from the cell metadata <reference_solution> 
<evaluation_criteria> Formatted from the cell metadata <evaluation_criteria>
====================
Screencast.from.2026-07-03.14-14-52.mp4

In this screencast, we inspect the two test files so we can see what exactly was the prompt sent to the LLM and the answer it generated.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Binder 👈 Launch a Binder on branch Yahiewi/jupyter-ai-tutor/debug

@Yahiewi Yahiewi marked this pull request as ready for review July 3, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant