Remove code snippets instead of redacting them in trimming#1136
Remove code snippets instead of redacting them in trimming#1136calyptobai merged 2 commits intomainfrom
Conversation
ggordonhall
left a comment
There was a problem hiding this comment.
In testing this works well, but this is largely because the model rarely generates either QuotedCode or GeneratedCode: it prefers markdown code blocks so it's tricky to evaluate the effects of this change.
| ) | ||
| } | ||
| }) | ||
| let xml = fixup_xml_code(xml); |
There was a problem hiding this comment.
Do we need to do this work at all if we're returning an empty string?
There was a problem hiding this comment.
We do need to do this for partially generated messages. E.g. if a message generates with <GeneratedCode><Code>foo, we need to call fixup_xml_code to complete the block so that it can still be parsed on the line right below. If parsing fails here (e.g. there is a different kind of XML block, perhaps HTML in the markdown), we know the block is not a code chunk and should be kept.
Remove code chunks instead of redacting them. This should hopefully reduce the frequency at which we see
[REDACTED]in model output.Closes BLO-1842