Repository navigation
Keep a PDF's title once and never print a chart marker as text - #271
Merged
Merged
Conversation
Asked for a report with the charts of the conversation, gpt-4.1 sent the
title heading with create_pdf and again at the start of add_pdf_content,
and wrote "[chart:Refer to chart marker above]" as a paragraph under each
chart's heading. The file opened with its title twice and printed that
line where each chart should be.
- A heading that repeats the heading right before it, with nothing
between, is left out, within a call and against the block the new
content follows, and the agent is told to send only what is new.
- A paragraph that is a whole [chart:{...}] marker is drawn as that chart.
Any other chart marker in a paragraph, heading or list fails the call
with the ways to add a chart and the charts of the conversation.
- Content converted from a file is not changed by either rule.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Asked for a report with the charts of the conversation, gpt-4.1 produced a PDF that:
create_pdfand again at the start ofadd_pdf_content;[chart:Refer to chart marker above]under each chart heading where the chart should be: it wrote a placeholder marker as a paragraph, and text is printed as written. Only image and chart blocks were checked for chart markers.Changes
In
PdfBlockPreparer, for blocks the model writes (content converted from a file is not changed):add_pdf_contentpasses that block for append, insert and replace. The agent is told the heading was left out and to send only new content. A heading used again later, with content between, is kept.[chart:{…}]marker with plottable data becomes that chart. Any other chart marker in a paragraph, heading, title or list fails the call ("Nothing was added") and lists the ways to add a chart, includingconversation_chart, and the charts of the conversation. Code blocks are left as written.Tests
PdfRepeatedContentTests(new): title repeated acrosscreate_pdfandadd_pdf_content, the same heading twice in one call, a heading used again with content between (kept), the placeholder marker (refused), a whole marker as a paragraph (drawn as the chart), and a marker inside a sentence (refused). Five of the six failed before the fix.-warnaserror -p:TreatWarningsAsErrors=true -p:RunAnalyzers=true; the docs build passes.