Your documentation search assitant
Make sure to provide your OpenAI token using the OPENAPI_ACCESS_TOKEN
environment variable.
To mount the Gromit engine in Rails 7, require the engine from your Gemfile
:
gem "gromit", require: "gromit/engine"
And add this line to your routes:
Rails.application.routes.draw do
mount Gromit::Engine => "/"
end
Gromit provides the following routes:
Routes for Gromit::Engine:
healthcheck GET /healthcheck(.:format) gromit/gromit#healthcheck {:format=>:json}
search POST /search(.:format) gromit/gromit#search {:format=>:json}
upsert POST /upsert(.:format) gromit/gromit#upsert {:format=>:json}
To index your documentation locally you can use gromit-reindexer
. This will update redis-stack-server
running on your machine.
bundle exec gromit-reindexer -s /path/to/your/docs
To remotely upsert your documentation you can use gromit-uploader
.
BASE_URL=https://gromit-rails.example.com bundle exec gromit-uploader -s /path/to/your/docs
For a working example of a Rails 7 application using Gromit check out: https://github.com/releasehub-com/gromit-example
Add this line to your application's Gemfile:
gem "gromit"
And then execute:
$ bundle
Or install it yourself as:
$ gem install gromit
Contribution directions go here.
The gem is available as open source under the terms of the MIT License.
Made with love by the folks @ release.com