code-narrator icon indicating copy to clipboard operation
code-narrator copied to clipboard

Unexpected Open AI response for files that exceed 6823 char length

Open mattiNFT opened this issue 2 years ago • 3 comments

Hello,

i'm using your code-narrator tool to generate a documentation for a SDK i'm developing. Great tool, but there is an unexpected behavior that happens when the files it process are very long in term of char length.

For example i have a file class with a total of 244630 chars (it's a class that has 7300 lines of code, so it's not very big but it's not so small in the same time), but when i look the documentation generated by the OpenAI API it looks uncomplete, it considers only the first imports of the class and it ignores everything else.

The CLI shows a warning when this situation happens and the message is the following: "Warning - Content to long: I had to trim a file, only using first 6823 character".

So i'm guessing what happens when a file is too big for the OpenAI API? Your tool generates the documentation considering only the first batch of 6823 chars or it queries multiple times OpenAI in order to give it all the text necessary to create the response?

In any case, the documentation that generates it's not complete. So... what i should do in this case?

Thanks

mattiNFT avatar Sep 08 '24 14:09 mattiNFT

It just cuts the text, it won't do another query for the rest of code.

Basically it won't work properly for such a large file

ingig avatar Sep 08 '24 14:09 ingig

I see, thanks for the fast answer. So what happens? It could be something that you can consider to improve in the future or is there a technical limitation? To be honest i think your tool could be super useful in the case it saves someone to create a documentation for large files because it saves a lot of time.

mattiNFT avatar Sep 08 '24 14:09 mattiNFT

I would not hold my breath of me fixing it. My headspace is in another project that needs by attention and I am not sure of a simple way to solve this, so it would take up time I unfortunately don't have.

The current status of the project is that it wont change for unseeable future.

ingig avatar Sep 10 '24 09:09 ingig