Skip to content

Conversation

@bjoaquinc
Copy link
Contributor

@bjoaquinc bjoaquinc commented Oct 23, 2025

📝 Summary

This adds GetCellOuputs for visual outputs, console outputs, and marimo UIElement context with configuration and signature of element. This also adds llm_context to all tools that return VariableValue.

Sample outputs:

Markdown Cell Output:

{
  "visual_output": "<h1>Sales Analysis</h1>",
  "visual_mimetype": "text/markdown",
  "stdout": [],
  "stderr": [],
}

Console Cell Output:

{
  "visual_output": "",
  "visual_mimetype": "text/plain",
  "stdout": ["Hello you!!\n"],
  "stderr": [],
}

Chart Cell Output:

{
  "visual_output": "{ Full Vega-Lite JSON spec with 9 data points }",
  "visual_mimetype": "application/vnd.vegalite.v5+json",
  "stdout": [],
  "stderr": [],
}

🔍 Description of Changes

  • Add GetCellOutputs tool
  • Register GetCellOutputs tool
  • Add console ouput cleaning methods to make it less verbose for llms witihout losing any important data

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • I have added tests for the changes made.
  • I have run the code and verified that it works as expected.

@bjoaquinc bjoaquinc requested a review from dmadisetti as a code owner October 23, 2025 00:14
@vercel
Copy link

vercel bot commented Oct 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Ready Preview Comment Oct 23, 2025 6:02pm

"""
return False

def _get_llm_context(self) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

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

could we call this _repr_ai_?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup!


md_context = f"""
### UI Element: `{component_name}`
Label: \"{label}\"
Copy link
Contributor

Choose a reason for hiding this comment

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

i would assume the LLM can see the code. im not sure how valuable it is to pass all this information.

is there a more concise version that just consist of info it cannot see. e.g

repr_args = {arg_key: repr(arg_value)[:100] for arg_key, arg_value in args}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree with this, actually I think the info it cannot see is just the defaults, which already appear in the signature. Maybe we can omit args completely?

name: str
value: Optional[str]
datatype: Optional[str]
llm_context: Optional[str] = None
Copy link
Contributor

Choose a reason for hiding this comment

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

this is going to add additional computation cost and network costs passing this over the wire, especially when it is rarely used (variables are sent over a lot).

my prefernce would be to split this feature out from the GetCellOuputsTool while we experimrent with adding this context to each variable.

ideally this can be an addon and not need to be placed in the common path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it! So we can't put llm_context in VariableValue. If ever it will need to be accessed some other way, ideally directly from the UIElement via repr_ai.

@bjoaquinc
Copy link
Contributor Author

I removed llm_context and ui_element handling for now. It will still be included in the visual output as HTML. We'll iterate on this in future PRs @mscolnick

}
referring_cells.update(
self.update_stateful_values(bound_names, value)
self.update_stateful_values(
Copy link
Collaborator

Choose a reason for hiding this comment

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

If these are now just whitespace changes, can we checkout this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On it. I'm also adding tests for the new tool

@Light2Dark Light2Dark added the enhancement New feature or request label Oct 24, 2025
@mscolnick mscolnick merged commit 4eb45fa into marimo-team:main Oct 24, 2025
34 of 37 checks passed
@bjoaquinc bjoaquinc deleted the ui-element-llm-context branch October 24, 2025 17:52
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.

4 participants