The democratization of AI over the past year has unlocked two big opportunities for developers – making it incredibly easy to integrate cutting-edge AI into their projects and bringing AI-driven efficiencies into their development process.
Sublayer, a Ruby based AI agent framework, demonstrates the power and efficiency of the Gemini API by integrating our 1.5 models into their core developer offering as well as within their own tooling workflows.
Keeping the Sublayer documentation up-to-date with Gemini
One of the opportunities with AI for developers is to enable teams, especially within small, early stage startups, to do more with less. For many, this could be in something as simple yet crucial as documentation. In their own workflows, Sublayer tackles this by integrating their library with Gemini 1.5 Pro and building AI automations to support the work of keeping their documentation up to date and identifying areas of improvement.
“It all came about because Gemini’s massive context window really gives you the breathing room to try out new ideas without getting bogged down in complex, optimized implementations up front,” says Scott Werner, CEO of Sublayer, who recently wrote about this concept in Waste Inferences!
The process works like this:
- Any time a PR is merged into the main Sublayer repository, it triggers an agent to get to work updating the documentation.
2. The agent generates a prompt that contains the entire contents of the library, the entire contents of the documentation, and all the relevant contents of the PR along with instructions explaining the task and sends it to Gemini.
3. Gemini then responds with structured outputs containing the file paths, names, and contents which the Sublayer library converts into an object to use.
4. Finally, the agent takes the structured information it received and uses it to create a new branch, make the requested changes to the files, and submit a new PR.
# Get the diff from the PR
diff = GithubGetDiffAction.new(repo: repo, pr_number: pr_number).call
# Get the contents of the library repository and docs repository
code_context = GetContextAction.new(path: code_repo_path).call
doc_context = GetContextAction.new(path: doc_repo_path).call
# Use Gemini 1.5 Pro to decide whether this PR requires a documentation update
result = DocUpdateNecessityGenerator.new(
code_context: code_context,
doc_context: doc_context,
diff: diff
).generate
# Use Gemini 1.5 Pro to generate suggested changes to the documentation
doc_update_suggestions = DocUpdateSuggestionGenerator.new(
code_context: code_context,
doc_context: doc_context,
context_ignore_list: context_ignore_list,
diff: diff
).generate
# Use Gemini 1.5 Pro to generate the changes to the suggested files
file_updates = DocUpdateGenerator.new(
code_context: code_context,
suggestions: suggestions,
doc_context: doc_context,
context_ignore_list: context_ignore_list
).generate
# Update each of the files returned by Gemini 1.5 Pro and create a new PR
See the complete workflow code in Sublayer’s open source examples
After the success of this first project they have expanded further into agents that monitor separate resource repositories to focus on keeping a specific catalog page of their docs up to date. There’s even a similar task that runs overnight where Gemini analyzes the current documentation, identifies a few areas of improvement, ranks them based on impact, and generates a single PR for the Sublayer team to wake up to and review every morning.
Bringing AI to the Ruby developer community with Gemini models
Outside of making their own developer infrastructure and tooling more efficient, Sublayer also supports Gemini models within their core product functionality.
Sublayer’s mission is to empower individual developers and small teams to tackle ambitious projects that were previously out of reach due to cost or complexity. They’re focused on automating tedious, time-consuming, and repetitive tasks – the perfect use case for AI. This can range from large-scale code migrations, where similar operations need to be repeated thousands of times, to day-to-day efficiencies achieved by automating small tasks on a checklist that drain time and energy.
A primary challenge for Sublayer is supporting the Ruby developer community, which has been relatively underserved in the AI ecosystem. Integrating Gemini allowed them to meet the increasing demand for Gemini support within their tools. Sublayer’s Gemini implementation is highly efficient, requiring only about 60 lines of code thanks to their abstraction layer. They use structured outputs, interacting with models in a single-turn iterative process. This approach simplifies development and debugging, helping developers build robust applications.
“When building LLM-based apps, break the problem down into the smallest possible components,” advises Werner. “You want to design your programs to handle any model output effectively, which may even mean intentionally adding steps for a person to review and edit before moving on.”
LLMs, a core piece of the AI infrastructure puzzle
To Sublayer, LLMs like Gemini are essential pieces of infrastructure, akin to databases. Their framework is designed to seamlessly integrate calls to both Gemini 1.5 Pro and Gemini 1.5 Flash, retrieving structured data that developers can readily utilize in their applications. This approach opens up a world of possibilities, from extracting insights from diverse data sources to generating code and transforming codebases across languages and libraries. Sublayer even uses the Gemini models to enable users to generate new functional components within the framework itself. This “self-assembling” characteristic encourages experimentation and allows users to explore novel ideas rapidly.
“Gemini is great at solving all the problems our framework is designed to make easy – code generation, task decomposition, following instructions, and generating new data structures based on examples,”
– Scott Werner, CEO of Sublayer
What’s next
Looking ahead, Sublayer is getting ready to launch Augmentations.ai, a platform that makes the automations they’re creating available to all development teams. Their initial release will feature two tools powered by Gemini 1.5 Pro: Semantic Linting, which allows teams to create AI-powered code review rules that understand context and enforce evolving best practices, and Weekly Summaries, which turns development activity across multiple repositories and product management tools into actionable insights for leadership.
They plan to continue utilizing a mix of Gemini 1.5 Pro for more complex tasks and Gemini 1.5 Flash for the more latency-sensitive, user-facing, functionality as they release more tools on the Augmentations platform. This work will also feed back into their open source framework, enabling the Ruby community to take advantage of new Gemini functionality as it comes out, while being driven by real-world use by the Sublayer team.
Sublayer’s story showcases the transformative potential of the Gemini API. It’s a testament to how easily developers can integrate Gemini into their workflows, opening up a world of opportunities for innovation and automation. To start building with Gemini models, read our API documentation.