Gromit: an Open Source AI Assistant for your Documentation
Here at Release we have been working on tooling to integrate with OpenAI and ChatGPT using many open source tools. We have learned a lot from integrating these tools into our product and wanted to give back to the Open Source community with our AI Assistant Gromit project.
Imagine that you built an awesome app, wrote up the documentation and laid out all the relevant tidbits of information a new or tenured user would need to know. You keep on adding to your knowledge base to explain features, functionality and process in more detail, and somehow it raises more questions. Now users are pouring over even more information you generated to find answers to their questions. You could structure your documentation differently, add more tags, do more backlinks, etc., or you could have AI help you surface the right pieces, for the right user, depending on their question. This is how the idea for Gromit came about.
Using embeddings and vector search databases we can search all of your documentation based on a question given to the AI Assistant. The relevant documentation from the search results are used to generate a prompt for OpenAI. We have an internal project called Gromit that provides a simple way to index your documentation using OpenAI’s embeddings and stores these indices in a Redis vector search database.
We have broken out the underlying Ruby code into the Gromit Ruby Gem which allows developers to create their own API on top of the basic Gromit functionality. Gromit also provides a Rails engine which can be mounted in any Rails application which will give you the basic APIs out of the box within minutes. We are pleased to give back to the community and support open source projects by contributing this Gem to the open source community.
Here is a quick example of how you can start using it:
To mount the Gromit Rails engine in your Rails project. First edit your <code inline>Gemfile</code> and add
After executing the <code inline>bundle</code> command, edit your <code inline>config/routes.rb</code> and add the following:
You will need to add an environment variable with your OpenAI API access token. Edit your <code inline>.env</code> or <code inline>.env.local</code> and add the following:
To install the redis-stack-server do the following. Note, that if you are already running Redis you will need to stop/disable the old version of redis. The redis-stack-server provides additional search indexing functionality not provided in the default Redis server.
At this point you can index all of your documentation that’s in markdown format like so:
We have also created a Gromit Example Rails Application which also includes a Nextjs OpenAI Documentation Search user interface which is hooked into the Gromit Rails Application.
Here is an example of Gromit in action using the Next.js frontend created by the folks at supabase:
At Release we are strong believers in the power of open source. In our drive to create a development platform that better serves modern development teams, our founding team has been using and contributing to the open source community for years. Founded in 2019 Release was and still is built entirely with open source software!
Test our Gromit for yourself, tell us what you think and share it with others. We look forward to sharing more fun projects with the community in the future.
Release is the simplest way to spin up even the most complicated environments. We specialize in taking your complicated application and data and making reproducible environments on-demand.
Speed up time to production with Release
Get isolated, full-stack environments to test, stage, debug, and experiment with their code freely.