rager_rb
Build continuously improving generative workflows.
Logging
Why yet another library? The main reason is to have an out-of-the-box logging server that records workflows and outcomes to use in few-shot prompts and fine-tuning. It’s live at rager.cloud, though public signups are paused until I roll out usage-based billing.
Providers
Modalities that take a URL parameter (chat, embedding, rerank) support compatible services, allowing you to use alternative providers that support the interface.
| Feature | Providers |
|---|---|
| Chat | openai |
| Embedding | openai |
| Image generation | replicate |
| 3D mesh generation | replicate |
| Reranking | cohere |
| Search | jina |
| Templating | erb,mustache |
Installation
Add this line to your application's Gemfile:
gem "rager", "~> 0.8.0"
Or use it in a standalone script (requires OPENAI_API_KEY set):
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "async-http", "~> 0.88.0"
gem "rager", "~> 0.8.0"
end
require "rager"
Rager.configure do |config|
config.http_adapter = Rager::Http::Adapters::AsyncHttp.new
end
PROMPT = ARGV[0] || "Ruby programming"
Async do
ctx = Rager::Context.new
prompt = ctx.template("Tell me about the history of <%= topic %>", {topic: PROMPT})
chat = ctx.chat(prompt, stream: true)
chat.stream.each { |d| print d.content }
end