Make a Translator with ChatGPT

For quite some time I wanted to translate a book I’ve written to English. The book is created in LaTeX and has quite a bit of special formatting instructions, it is placed in many files and I always thought it is an extremely hard task even to get some variant for future work.
I decided to give at a shot and asked ChatGPT to create a console .NET program which would use ChatGPT API for translation. As a result I got a console program. It used an outdated API version and .NET version, but overall it looked good. Actually I ran the same request 3 times to get 3 different versions of the code and chose the best one.
Instead of trying to get the whole program out of the AI, I’ve send the input and output JSONs and asked to generated C# models. They have small issues like using restricted property names, but I just sent the errors to the chat and got the corrected code.
Running the code revealed API limitation: it does not support parallel requests. Again, one query and I’ve got a sequential version. By the way, for small pieces of code it was easier to use GitHub Copilot, another great AI tool which has a great integration with Visual Studio Code.
In about an hour I had a version which produced translation, again via ChatGPT. Of course it has some issues. For one story in the book ChatGPT even put different version of the ending along with an actual translation. But it is amazing. Using one general API I have created a program and translated a book. And the most important thing: it was fun.
You can check the code here: link.
The most awesome things of programming with ChatGPT:
- It's one API for any task. You just formulate what you need in a natural language and that's it;
- You can easily hand to ChatGPT the most boring part of coding;
- Having a ChatGPT is like having a teammate for pair programming, you can get a piece of advice or a different implementation of an algorithm;
- You are getting a feeling that the future has come.