Skip to content

Commit 836d865

Browse files
authored
Documentation (#23)
* Add configuration traits in README * Add some how to doc * Quick note about setting up Jupyternaut * Update doc * Fix description
1 parent 6a85d88 commit 836d865

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,46 @@ It currently relies on [jupyter-ai-jupyternaut](https://github.com/jupyter-ai-co
1111

1212
Once Jupyterlab started, the model must be configured via the menu `Settings>Jupyternaut settings` (model and API key).
1313

14-
See Jupyternaut [documentation](https://jupyter-ai.readthedocs.io/en/v3/users/jupyternaut/index.html#model-selection) to set it up.
14+
See Jupyternaut [documentation](https://jupyter-ai.readthedocs.io/en/v3/users/jupyternaut/index.html#model-selection) for details about setting up the agent.
15+
16+
## How it works
17+
18+
Each code cell in a notebook gets an **Explain Code** button in its toolbar ![info icon](./info.png) \
19+
Clicking it opens a chat panel on the right side and sends the following context to the AI:
20+
21+
- The **cell source code** and its **kernel language**
22+
- Any **error output** produced by the cell (traceback included)
23+
- **Preceding code cells and markdown cell** (up to the previous markdown cell), used as the exercise description
24+
- An optional **reference solution** and **evaluation criteria** stored in the cell metadata (the solution is ROT13-encoded to keep it hidden from students)
25+
26+
The AI replies using a configurable **system prompt** (`TUTOR.md`) that shapes its pedagogical behavior. By default the extension looks for a `TUTOR.md` file walking up from the notebook's directory to the server root, so different courses or folders can each have their own tutor persona.
27+
28+
## Configuration
29+
30+
### TUTOR
31+
32+
The extension can be configured via `jupyter_server_config.py` (or any traitlets CLI config):
33+
34+
```python
35+
c.JupyterAITutorApp.discover_tutor_md = True # default
36+
c.JupyterAITutorApp.tutor_md = "" # default (uses built-in TUTOR.md)
37+
c.JupyterAITutorApp.debug = False # default
38+
```
39+
40+
| Parameter | Type | Default | Description |
41+
| ------------------- | ---- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
42+
| `discover_tutor_md` | bool | `True` | When enabled, the extension searches for a `TUTOR.md` file starting from the active notebook's directory and walking up to the server root. The first file found takes precedence over the configured system prompt. |
43+
| `tutor_md` | str | `""` | Path to a Markdown file used as the system prompt. When empty, falls back to the built-in `TUTOR.md` shipped with the extension. |
44+
| `debug` | bool | `False` | When enabled, prompts and model replies are logged to `jupyter-ai-tutor` temp directory for debugging purposes. |
45+
46+
### Jupyternaut
47+
48+
The default model and API key used with Jupyternaut agent can be setup via `jupyter_server_config.py` (or any traitlets CLI config):
49+
50+
```python
51+
c.AiExtension.initial_language_model=mistral/devstral-latest
52+
c.AiExtension.default_api_keys={'MISTRAL_API_KEY': '***'}
53+
```
1554

1655
## Requirements
1756

info.png

1.02 KB
Loading

0 commit comments

Comments
 (0)