rager_rb

gem publish test lint docs

Build continuously improving generative workflows.

Providers

Feature Providers
Chat openai (and compatible APIs)
Embedding openai (and compatible APIs)
Image generation replicate
3D mesh generation replicate
Rerank cohere (and compatible APIs)
Search jina
Templating erb (built-in)

Logging

The main reason for developing yet another library is to have an out-of-the-box compatible logging server that tracks AI workflows and outcomes. This data can be used to generate high-quality examples for few-shot prompting and fine-tuning. That server will be released soon, check back here for updates.

Installation

Add this line to your application’s Gemfile:

gem "rager", "~> 0.6.0"

Or use it in a standalone script (example uses OPENAI_API_KEY env var):

#!/usr/bin/env ruby

require "bundler/inline"

gemfile do
  source "https://rubygems.org"
  gem "async-http", "~> 0.88.0"
  gem "rager", "~> 0.6.0"
end

require "rager"

Rager.configure do |config|
  config.http_adapter = Rager::Http::Adapters::AsyncHttp.new
end

Async do
  ctx = Rager::Context.new
  prompt = ctx.template(
    "Tell me about the history of <%= topic %>:\n",
    {topic: "Ruby programming"}
  )
  chat = ctx.chat(prompt, stream: true)
  chat.out.each { |d| print d.content }
end

This library makes extensive use of sorbet-runtime for runtime type checking. To learn more, including how to disable it, please see the official Sorbet documentation.

License

MIT