2
$\begingroup$

I am a Data Engineer, and I am currently assigned a task to refactor an outdated code and rectify any bugs present. However, I am unable to comprehend the code written in the existing codebase. Furthermore, the developers who worked on this codebase did not provide any documentation. Consequently, I am inquiring if there is a feasible method to convert the entire codebase into an extensive text document. Subsequently, I would like to utilize ChatGPT to translate the codebase into a comprehensive document(very long text, with folder structure tree and code inside src) that I can use to embedding. I do not require an in-depth explanation of the code; rather, I am seeking a more abstract-level understanding, such as the purpose of specific files, the functionality of particular folders, etc.

$\endgroup$
2
  • $\begingroup$ Very curious to know, if you could get this to work practically? Can you please share your experiences? $\endgroup$ Jul 4 at 4:22
  • $\begingroup$ wrose than plain search, if you try gpt4 and feed large amount of data, thats costly $\endgroup$
    – Yiffany
    Jul 4 at 5:02

1 Answer 1

2
$\begingroup$

Sure, many people have done that.

You can also ask it to add comments or try to find bugs.

Just take into account that LLMs are known for generating bullshit, so the explanations could be mere fabrications and the generated code may not work (in evident or subtle ways).

I myself have tried chatGPT for generating code, but I had to iterate a few times until I got it working. I suggest you prepare some unit tests and integration tests to ensure that everything is working as before chatGPT's suggested changes.

Take into account that the amount of text/code an LLM can use as context is not that large, so you may need to ask multiple times regarding different parts of the code base.

There may also be privacy concerns regarding the fact that you are basically sending the source code of your company to a third party, which is something many employers would frown upon.

$\endgroup$
1
  • $\begingroup$ Good suggestions. I might only use it for query some questions about the relationship of those files with other files. learning langchain for asking more complexed questions. $\endgroup$
    – Yiffany
    Mar 27 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.