Docker Labs: GenAI | No. 1
Generative AI is changing how we interact with tools. Today, we might experience this predominantly through the use of new AI-powered chat assistants, but there are other opportunities for generative AI to improve
When a developer starts working on a new project, they will need to get up to speed on the tools used in that project. A common practice is to document these practices in a project README.md and to version that documentation along with the project. Can we use generative AI to generate this content? We want this content to represent best practices for how tools should be used in general, but more importantly, how tools should be used in this particular project.
We can think of this as a kind of conversation between developers, agents representing tools used by a project, and the project itself. Let’s look at this for the Docker tool itself.
Generating Markdown in VSCode
For this project, we have written a VSCode extension that adds one new command called “Generate a runbook for this project.” See it in action here:
This combines prompts written by tool experts with knowledge about the project itself. This combined context improves the LLM’s ability to generate documentation.
Although we’re illustrating this idea on a tool that we know very well (Docker!), the idea of generating content in this manner is quite generic. Here are the prompts we’ve used for getting started with the Docker build, run, and compose. There is certainly an art to writing these prompts
There is also an essential point here. If we think of the project as a database from which we can retrieve context, then we’re effectively giving an LLM the ability to retrieve facts about the project
“I am not using Docker Compose in this project.”
That turns out to be a transformative user prompt if it’s true. This is what we’d normally learn through a conversation. However, there are certain project details that are always useful. This is why having our assistants right there in the local project can be so helpful.
Runnable Markdown
Although today markdown files are just for reading, they often contain runnable things. LLMs converse with us in text that often contains code blocks that represent actual runnable commands
In the current extension, we’ve added a code action to every code block that contains a shell command so that users can launch that command in the embedded terminal. During our exploration of this functionality, we have found that treating the markdown file as a kind of REPL (read-eval-print-loop) can help to refine the output from the LLM and improve the final content. Here’s a view of what this looks like in action:
Markdown Extends Your Editor
In the long run, nobody is going to navigate to a markdown file in order to run a command. However, we can treat these markdown files as scripts that create commands for the developer’s edit session. We can even let developers bind them to keystrokes (e.g., type ,b to run the build code block from your project runbook).
In the end, this is just the Assistant talking to itself. The Assistant recommends a command. We find the command useful. We turn it into a shortcut. The Assistant remembers this shortcut because it’s in our runbook, and then makes it available whenever we’re developing this project.
This is a real feedback loop between the Assistant
The GitHub repository and install instructions are ready for you to try today.
For more, see this demo: VSCode Walkthrough of Runnable Markdown from GenAI
Applied Cybersecurity I Strategic Planning and Policy Specialty Area I Vulnerability Analysis I Consultant
1yThank you for sharing
Cloud Software Development Engineer at Intel Corporation
1yIt's a good entry. Thanks for sharing.
--
1yThank for sharing 👍
Senior Software Engineer | Software Architect | Design Thinking Facilitator
1yFYI Mehran Davoudi Elahe Dorani
Cloud native | SysAdmin | NFV | SDN | Telco Cloud | Edge | Backend dev | Wireless Network
1yNice contents👌💥