rager_rb
Build continuously improving generative workflows.
Examples are available in the examples/
folder.
Installation
Add this line to your application's Gemfile:
gem "rager", "~> 0.7.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.7.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
Providers
Modalities that take a URL parameter (chat, embedding, rerank) support compatible services, allowing you to use alternative providers that support the same interface.
Feature | Providers |
---|---|
Chat | openai |
Embedding | openai |
Image generation | replicate |
3D mesh generation | replicate |
Reranking | cohere |
Search | jina |
Templating | erb ,mustache |
Logging
The main reason for creating yet another library is to have out-of-the-box logging for workflows and outcomes. The logged data can then be used for few-shot prompting and fine-tuning. This logging server is being developed at rager.cloud
and is closed while I work on it. Contact me if you would like access.