Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ Style/FrozenStringLiteralComment:

Style/MultilineBlockChain:
Enabled: false

Style/Documentation:
Exclude:
- "examples/**/*"
- "spec/**/*"
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
## [2.1.0] - 2026-02-11

### Breaking Changes
- **Standalone runtime** - Removed `ruby_llm` runtime dependency. Raix now ships its own chat runtime.
- **Configuration migration** - Primary API-key setup moved to `Raix.configure` (`openai_api_key`, `openrouter_api_key`).

### Added
- Native runtime components:
- `Raix::Runtime::Client`
- `Raix::Runtime::Transport`
- `Raix::Runtime::Providers::OpenAI`
- `Raix::Runtime::Providers::OpenRouter`
- `Raix::Runtime::StreamParser`
- `Raix::Runtime::StreamAccumulator`
- `Raix::TranscriptStore` for thread-safe transcript handling without RubyLLM objects.
- Migration guide: `docs/migration/standalone-runtime-migration.md`.
- Comprehensive runtime unit tests (providers, transport, streaming parser/accumulator, transcript store, client routing).

### Changed
- `ChatCompletion` now delegates network execution to the internal runtime while preserving API compatibility.
- Predicted outputs integration test enabled for OpenAI.
- Examples and README updated to use Raix-native configuration.

### Deprecated
- Legacy `openai_client` / `openrouter_client` configuration paths.
- `ruby_llm_config` shim remains temporarily for migration and emits deprecation warnings.

## [2.0.0] - 2025-12-17

### Breaking Changes
Expand Down
21 changes: 2 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
PATH
remote: .
specs:
raix (2.0.0)
raix (2.1.0)
activesupport (>= 6.0)
faraday (~> 2.0)
faraday-retry (~> 2.0)
ostruct
ruby_llm (~> 1.9)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -37,11 +37,8 @@ GEM
drb (2.2.1)
e2mmap (0.1.0)
erubi (1.13.0)
event_stream_parser (1.0.0)
faraday (2.9.2)
faraday-net_http (>= 2.0, < 3.2)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (3.1.0)
net-http
faraday-retry (2.3.1)
Expand Down Expand Up @@ -77,10 +74,8 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
lumberjack (1.2.10)
marcel (1.1.0)
method_source (1.1.0)
minitest (5.24.0)
multipart-post (2.4.1)
mutex_m (0.2.0)
nenv (0.3.0)
net-http (0.4.1)
Expand Down Expand Up @@ -144,17 +139,6 @@ GEM
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
ruby-progressbar (1.13.0)
ruby_llm (1.9.1)
base64
event_stream_parser (~> 1)
faraday (>= 1.10.0)
faraday-multipart (>= 1)
faraday-net_http (>= 1)
faraday-retry (>= 1)
marcel (~> 1.0)
ruby_llm-schema (~> 0.2.1)
zeitwerk (~> 2)
ruby_llm-schema (0.2.5)
shellany (0.0.1)
solargraph (0.50.0)
backport (~> 1.2)
Expand Down Expand Up @@ -212,7 +196,6 @@ GEM
yard-sorbet (0.8.1)
sorbet-runtime (>= 0.5)
yard (>= 0.9)
zeitwerk (2.7.3)

PLATFORMS
arm64-darwin-21
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Raix (pronounced "ray" because the x is silent) is a library that gives you ever

Understanding how to use discrete AI components in otherwise normal code is key to productively leveraging Raix, and the subject of a book written by Raix's author Obie Fernandez, titled [Patterns of Application Development Using AI](https://leanpub.com/patterns-of-application-development-using-ai). You can easily support the ongoing development of this project by buying the book at Leanpub.

Raix 2.0 is powered by [RubyLLM](https://github.com/crmne/ruby_llm), giving you unified access to OpenAI, Anthropic, Google Gemini, and dozens of other providers through OpenRouter. Note that you can use Raix to add AI capabilities to non-Rails applications as long as you include ActiveSupport as a dependency.
Raix includes a standalone runtime with first-class support for OpenAI and OpenRouter. Note that you can use Raix to add AI capabilities to non-Rails applications as long as you include ActiveSupport as a dependency.

### Chat Completions

Expand Down Expand Up @@ -855,16 +855,16 @@ If bundler is not being used to manage dependencies, install the gem by executin

### Configuration

Raix 2.0 uses [RubyLLM](https://github.com/crmne/ruby_llm) as its backend for LLM provider connections. Configure your API keys through RubyLLM:
Configure API keys directly in Raix:

```ruby
# config/initializers/raix.rb
RubyLLM.configure do |config|
Raix.configure do |config|
config.openrouter_api_key = ENV["OPENROUTER_API_KEY"]
config.openai_api_key = ENV["OPENAI_API_KEY"]
# Optional: configure other providers
# config.anthropic_api_key = ENV["ANTHROPIC_API_KEY"]
# config.gemini_api_key = ENV["GEMINI_API_KEY"]
# Optional OpenAI headers
# config.openai_organization_id = ENV["OPENAI_ORG_ID"]
# config.openai_project_id = ENV["OPENAI_PROJECT_ID"]
end
```

Expand Down Expand Up @@ -896,7 +896,7 @@ class MyAssistant
end
```

### Upgrading from Raix 1.x
### Upgrading

If upgrading from Raix 1.x, update your configuration from:

Expand All @@ -908,7 +908,9 @@ Raix.configure do |config|
end
```

To the new RubyLLM-based configuration shown above.
To the Raix-native configuration shown above.

For migration details from RubyLLM-backed Raix 2.0, see `docs/migration/standalone-runtime-migration.md`.

## Development

Expand Down
56 changes: 56 additions & 0 deletions docs/migration/standalone-runtime-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Raix Standalone Runtime Migration Guide

This guide covers migration from RubyLLM-backed Raix 2.0 to the standalone runtime.

## What Changed

- Raix no longer depends on `ruby_llm` at runtime.
- `Raix::ChatCompletion` now uses native OpenAI/OpenRouter provider adapters.
- `Raix.configure` is now the primary API-key configuration surface.

## New Configuration

```ruby
Raix.configure do |config|
config.openai_api_key = ENV["OPENAI_API_KEY"]
config.openrouter_api_key = ENV["OPENROUTER_API_KEY"]
config.openai_organization_id = ENV["OPENAI_ORG_ID"] # optional
config.openai_project_id = ENV["OPENAI_PROJECT_ID"] # optional
end
```

## Legacy Compatibility (Temporary)

Raix still reads legacy settings for one major-version migration window:

- `config.openai_client` / `config.openrouter_client` (deprecated)
- `config.ruby_llm_config` (deprecated shim)

When legacy settings are used, Raix emits deprecation warnings.

## Provider Selection Rules

Provider selection is unchanged:

- explicit `openai: "gpt-4o"` forces OpenAI
- models starting with `gpt-` or `o` use OpenAI
- all other models use OpenRouter

## Behavior Compatibility

The following behavior is preserved:

- `chat_completion` signature and defaults
- transcript acceptance of abbreviated and standard message formats
- tool declaration/filtering/dispatch security checks
- automatic tool-call continuation loop
- `max_tool_calls` and `stop_tool_calls_and_respond!`
- `before_completion` hook order (global -> class -> instance)
- `Thread.current[:chat_completion_response]` assignment

## Suggested Upgrade Steps

1. Remove `ruby_llm` initialization from app boot code.
2. Move API keys into `Raix.configure`.
3. Run your test suite and watch for deprecation warnings.
4. Remove deprecated legacy client or RubyLLM config usage.
Loading