Line numbers need to be built-in using non-AI

This feature request obviously applies for ChatGPT, but more broadly should be built into the core API. This is the ability to for the GPT to accurately refer to line numbers in user input. When dealing with code, especially, it is essential to communicate line numbers easily and accurately, but GPT hallucinates line numbers most of the time given a non-tiny input. This makes it impossible to communicate about line numbers properly and makes GPT a pathological code assist. But it’s not just code. This applies to anything.

API should be able to know the line numbers using a traditional, non-AI algorithm that simply keeps track of them.

One more additional request on top of this for ChatGPT and other GUI tools: Often times, a line is inserted or deleted by the user. Maybe they copy/pasted from a section of code. It should be trivial for the user to offset the line numbers that GPT would naturally deduce, to realign with the full body of text. For example, if I copy/paste code from line 261 to 300 into GPT as quoted or back-ticked code (or even if not quoted or back-ticked–GPT should automatically deduce that too for me), GPT would count that by default as line 1 to 40. I should be able to tell it that actually, count lines starting from 261. Really, the UI for GPT should automatically ADD those line numbers after automatically creating a code window for the user when entering three or four backticks in a row. And then a UI element should be built-in for the user to quickly offset those numbers. And GPT should be able to read those and use them as reference. But even in the API without a GUI, it should still be able to deduce line numbers and should still accept verbal commands to do the offset.

1 Like


Hear me out.


You can just populate the line numbers yourself by matching any text found within a code-block and then enumerating for each linebreak.

GPT has 1 job: To return a ChatCompletionResponse. It can return a markdown-representation of text but there is no function in markdown to include line numbers & it doesn’t make sense to train the model to accommodate this when simple programming logic suffices.

So, no. Not in the core API, or OpenAI’s responsibility. BUT you can build it yourself (relatively easily) and see if it helps in your coding.

1 Like

Nah. I disagree. It’s a major problem that solving would pay off in dividends. It’s too fundamental to leave to higher layers.

I’m not sure what you mean by higher layers.

If it’s critical to progress then it would be worth implementing it and sharing the code here for others to use. Maybe OpenAI will notice and implement it themselves (as you are hoping for).

Again, this would be fairly straightforward to implement.


The AI cannot understand what it cannot see.

It is quite easy to add what you want, and then to do parsing and number stripping on copy.

User input would be harder to make sense of; this is numbered by Notepad++ to preserve the original position.

1 Like