logoalt Hacker News

carom11/07/20241 replyview on HN

How do you end up handling line numbers in patches? Counting has always been a sticking point for LLMs.


Replies

jahooma11/07/2024

I wrote a custom `applyPatch` function that tries to use the line numbers, but falls back to searching for the context lines to line up the +/- patched lines.

It actually got line number not too wrong, and so they might have been helpful. (I included the line numbers for the original file in context).

Ultimately though, this approach was still error prone enough that we recently switched away.