Training a custom model to create codes

I don’t know if I opened the topic in the correct category, but let’s go.

I have a large number of codes and some of these codes have comments to help the user to understand how they work, etc. What I need to do is train a custom model, that I created before by “fine-tuning the process”, and I want that this model returns to me custom codes like ChatGPT.

To do this, I have one idea… I can prepare the file, run the Embedding process, prepare a JSON file with prompt and completion, and finally, run the fine-tuning process.

What I would like to know is. Am I in the right way? Did someone do something similar?