[Part 2] Pair Programming With LLMs on the Example of Image Generation Service (Distillery)
Series to unlock full power of coding with LLMs for non-developers
Hello FollowFox Community!
We are continuing our LLM Pair Programming series on the example of Distillery.dev. Let’s recap what this series is about:
In these posts, we will learn how to master programming with LLMs to understand and create sophisticated services even if you are not a developer. This series will be all about the journey from how we start from a pretty large codebase and with the help of LLMs, learn how it works, what are all the individual parts, and how to improve, document, and contribute to it while being a non-developer.
We will continue right from where we left off in part 1. You can check out the previous post here (link).
Starting Public Documentation
In the first post, we managed to pass the whole codebase to the LLM in a way that it started providing super useful answers. However, we realized that there is a lot of output coming from LLMs during these convos and neither the LLM chat interface nor the blog post like this is a good way to organize and save all that output. So we decided to look into solutions that will allow us to better organize this knowledge.
There are a few good options on how that can be done and in fact we already have some experience doing this when we set up Distillery’s user documentation (link). Material for MkDocs looks great but from our experience as the complexity goes up the maintenance costs also quickly scale up.
We started to look for alternatives and in the end, we decided to use Obsidian (link). It is a very flexible note-taking solution that we hope to adapt to our needs. We asked ChatGPT how to get started, how to create a new vault, and what settings to use and soon we were up and running.
We also decided to go with the simplest option to publish this to the web and for now, we are using their in-house Publish service. As a result, now we have the documentation page started (mostly empty for now) with the outline that follows part 1 of this series.
https://publish.obsidian.md/distillery-technichal-documentation/Distillery
As a reminder, our end goal is not to create the documentation but rather the journey itself so that we master the pair programming in the process. That’s why we will be gradually building this out rather than asking LLM to more aggressively generate the whole thing (which is totally possible).
Setting up Documentation Structure
As the first step we wanted to set up a structure that we can follow and fill up as we proceed with this journey. That’s kind of what we did in the previous post so we ended up creating three main sections for the documentation:
Getting Started: this will contain generally useful and helpful information about the documentation and Distillery
System Overview: This pretty much contains the same things as we discussed in part 1 of this series
Components - this will be the heaviest part of the documentation where we will do the deep dives into individual components of the Distillery.
Creating Style Guide for Distillery
The main contributor to Distillery’s code (Felipe) has told us many times that he has a specific style of writing code that has sometimes even been criticized as “non-pythonic”. So we decided to assign the task of extracting and documenting Felipe’s style of code and thus establish Distillery Codebase Style Guide. Claude did surprisingly well and we find this guide useful not only in case if you want to contribute to this codebase, but also makes it easier to read the code.
We think that having such style guides created by LLMs for codebases can be a useful part of the documentation.
You can see it on this link.
Documenting Distillery Bot
This is the first real deep dive into Distillery’s code where we documented almost everything related to the Discord Bot side of Distillery. The documentation revolves around five key parts and has a detailed explanation of the code along with the code itself:
Distillery Bot Initialization (link): contains all the critical information on how the bot is initialized. We even created a cool What Does Initialization Mean to make it more non-coder-friendly.
Slash Commands and DistilleryCog (link): detailed description how Discord commands are being created for Distillery.
Image Sending Routine (link): How does the bot handle the retrieval of generated images (and other stuff) and send it to users back on Discord.
Check Queue and Send Task (link): A routine that makes sure that all the requests are being processed.
Utilities and Helpers (link) - misc useful code parts that enable specific additional functionalities.
What’s next?
We will continue with this path. In the next few posts, we have to do a few more deep-dives for worker, master, commands, and configuration files. Once all of that is documented and well understood, we will consider some practical applications in the form of direct contribution to the code.
great work! thanks.