Skip to content

Support displaying mime bundles in the chat#272

Merged
brichet merged 2 commits intojupyterlite:mainfrom
jtpio:mime-bundles
Feb 23, 2026
Merged

Support displaying mime bundles in the chat#272
brichet merged 2 commits intojupyterlite:mainfrom
jtpio:mime-bundles

Conversation

@jtpio
Copy link
Member

@jtpio jtpio commented Feb 19, 2026

Leverage jupyterlab/jupyter-chat#349

Mime bundle rendering logic

When the AI model executes a command that produces rich outputs (plots, JSON, HTML, etc.), those outputs are automatically rendered as chat messages right below the tool call widget.

This only happens for commands explicitly listed in the settings (default is jupyterlab-ai-commands:execute-in-kernel), to avoid replaying unintended outputs from inspection commands (like getting information about an executed cell).

MIME types listed in the settings for auto-render (default is text/html) are rendered with full trust, enabling things like interactive HTML. Other MIME types (JSON, images, etc.) render without needing to be trusted.

Changes

  • Parse outputs from execute-in-kernel commands to display them in the chat
  • Documentation
  • UI test
  • New settings to control mime bundles rendering:
image

Examples

Plotly

jupyterlite-ai-plotly-graph.mp4

Maps

jupyterlite-ai-rich-map.mp4

@jtpio jtpio marked this pull request as ready for review February 19, 2026 17:28
Copy link
Collaborator

@brichet brichet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jtpio, it's great !

status: 'pending',
summary
summary,
commandId
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any advantage of sending the command id ?
Regarding the use case, it seems that we could send only the shouldAutoRenderMimeBundles.

const outputAreaCompat = new RenderedMessageOutputAreaCompat({
chatPanel: widget
});

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think that every chat message should have the class jp-OutputArea ?
Is it something that could/should be fixed in Jupyterlab ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure yet. For now it seems like jupyterlab-geojson relies on jp-OutputArea: https://github.com/jupyterlab/jupyter-renderers/blob/b89c093bce24c8d7394177f08a111b3895ed6870/packages/geojson-extension/style/base.css#L23-L26

But maybe it's only the case for some isolated extensions.

- The chat UI can render rich MIME outputs as separate assistant messages.
- ${supportedMimeTypesInstruction}
- Use only MIME types from the supported list when creating MIME bundles. Do not invent MIME keys.
- Do not claim that you cannot display maps, images, or rich outputs in chat.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

@brichet
Copy link
Collaborator

brichet commented Feb 23, 2026

Thanks, LGTM

@brichet brichet merged commit 7307b7d into jupyterlite:main Feb 23, 2026
9 of 10 checks passed
@jtpio jtpio deleted the mime-bundles branch February 23, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants