Skip to content

Latest commit

 

History

History
65 lines (34 loc) · 2.74 KB

README.md

File metadata and controls

65 lines (34 loc) · 2.74 KB

SimpleRag

Screenshot

Simple Rag is a lightweight library that showcases the entire RAG architecture in a gem. No need for a vector database. All you need are a few light dependencies and a Mistral API key!

The purpose of simple RAG is to showcase how RAG systems work by using the simplest tools possible to lower the friction to learning. This is not a gem to be used in production and I will likely be adding additional breaking changes to the code.

Wait what...can you explain how it works?

Sure, here is a high level run through of the RAG architecture:

simple_rag walkthrough

Installation

Install the gem and add to the application's Gemfile by executing:

bundle add simple_rag

If bundler is not being used to manage dependencies, install the gem by executing:

gem install simple_rag

You will also need to install all dependencies required by the faiss gem under the installation section.

Lastly, run the following command and add a mistral-ai. You can create one my setting up a Mistral AI account.

Usage

To run the exe locally type:

exe/simple_rag

You can press enter when prompted to retrieve a default text. You can also search project gutenberg for an html text like Frankenstein by Mary Shelly. This process of fetching text given a url could take some time as the text, once fetched get's passed to an embedding model which converts text chunks into vectors.

Screen.Recording.2024-08-12.at.4.25.18.PM.mov

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Inspirations and Acknowledgements

This code was inspired by mistral's guide on Basic Rag

Andrei for making me excited about vector search with his talks on langchain.rb!

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/thedayisntgray/simple_rag.