Raix provides Ruby developers with discrete, composable AI components for integrating Large Language Models (LLMs) into applications. It extracts core functionality from the Olympia AI platform, enabling developers to add AI capabilities to existing Ruby projects, particularly those using ActiveSupport.
How It Works
Raix offers modular mixins for Ruby classes, starting with ChatCompletion
for managing conversation transcripts and interacting with LLMs. It supports multiple AI providers (OpenAI, OpenRouter) via an adapter pattern, with OpenRouter as the default. Key features include flexible transcript formatting, prompt caching for efficiency, JSON mode for structured output, and robust tool/function dispatching that allows AI to call and execute Ruby functions seamlessly within a conversation.
Quick Start & Requirements
- Install via RubyGems:
gem install raix
or add gem 'raix'
to your Gemfile
.
- Requires ActiveSupport.
- Configuration involves setting API access tokens for providers like OpenRouter and OpenAI, typically in an initializer.
- See Raix GitHub for detailed setup and configuration examples.
Highlighted Details
- Function Dispatch: Declarative DSL for defining and integrating Ruby functions that LLMs can call, with automatic execution, transcript updates, and optional tool call limiting.
- Prompt Declarations: Enables building complex "Prompt Chains" with conditional execution, callbacks, streaming, and custom parameters.
- Predicate Module: Simplifies handling yes/no/maybe questions with AI, allowing for specific response handlers.
- Experimental MCP & ResponseFormat: Integrates with the Model Context Protocol for remote tool discovery and allows defining JSON schemas for AI responses.
Maintenance & Community
- Developed by OlympiaAI, creators of the "world's leading virtual AI team platform."
- Contributions are welcome via GitHub.
- Adheres to a Contributor Code of Conduct.
Licensing & Compatibility
- Licensed under the MIT License.
- Compatible with commercial and closed-source applications.
Limitations & Caveats
- The Model Context Protocol (MCP) integration is experimental.
- While Rails is not a hard dependency, ActiveSupport is required, limiting standalone use outside of Ruby environments that provide it.