Skip to content

fix: Evaluate prints plain text truncation note outside notebooks - #10982

Open
Mansi2221 wants to merge 1 commit into
stanfordnlp:mainfrom
Mansi2221:fix/evaluate-html-truncation-note
Open

Mansi2221 wants to merge 1 commit into
stanfordnlp:mainfrom
Mansi2221:fix/evaluate-html-truncation-note

Conversation

@Mansi2221

Copy link
Copy Markdown

Summary

  • Evaluate(display_table=N) always renders the truncation note as HTML via display(HTML(...)), dumping raw markup in a terminal
  • Added is_in_ipython_notebook_environment() check (already used by display_dataframe) before the HTML path
  • Falls back to plain print() outside notebooks

Test Plan

  • In a terminal, truncation note prints as plain text: ... 2 more rows not displayed ...
  • In a Jupyter notebook, truncation note renders as styled HTML (unchanged)

Closes #10912

🤖 Generated with Claude Code

_display_result_table always rendered the "more rows not displayed"
note as HTML via display(HTML(...)), which dumps raw markup in a
terminal. Now checks is_in_ipython_notebook_environment() first
and falls back to plain print() outside notebooks, matching how
display_dataframe already handles the table itself.

Closes stanfordnlp#10912

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5 · The PR appears safe to merge, with a non-blocking request for regression tests.RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The change only reaches the evaluation table display workflow.

The PR appears safe to merge, with a non-blocking request for regression tests.

Findings

  1. P2 New output branches lack tests ▶

Summary

Evaluate now prints the hidden-row note as plain text outside notebooks.

  • Evaluation tables show the truncation note in the right format for each environment.

Reviews (1) · Last reviewed commit: "fix: Evaluate prints plain text truncati..." · Reviewed by Greptile

Comment thread dspy/evaluate/evaluate.py
Comment on lines +290 to +303
if is_in_ipython_notebook_environment():
message = f"""
<div style='
text-align: center;
font-size: 16px;
font-weight: bold;
color: #555;
margin: 10px 0;'>
... {truncated_rows} more rows not displayed ...
</div>
"""
display(HTML(message))
else:
print(f"\n... {truncated_rows} more rows not displayed ...\n")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 New output branches lack tests

test_evaluate_display_table uses one example with display_table set to True, False, or 1, so it never reaches either changed branch. A later change could bring back HTML in terminal output without failing the tests.

Add a test with more examples than displayed rows. Check that terminal output contains the plain note without HTML and that notebook output still calls display with HTML.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

This branch has not been deployed

No deployments
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.

[Bug] Evaluate(display_table=N) prints raw HTML for the truncation note outside notebooks

1 participant