forked from crmne/ruby_llm
-
Notifications
You must be signed in to change notification settings - Fork 0
Red Candle Provider #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
cpetersen
wants to merge
101
commits into
main
Choose a base branch
from
red-candle
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
orangewolf
reviewed
Sep 9, 2025
orangewolf
reviewed
Sep 9, 2025
Major improvements to Rails integration: - New acts_as API using association names instead of class names - Rails-like generator syntax: `rails g ruby_llm:install chat:ChatName message:MessageName` - Model registry always included (removed skip_model_registry option) - Clear upgrade path with use_new_acts_as configuration option Breaking changes managed through configuration: - Legacy mode (default) maintains backward compatibility - New mode enabled via `config.use_new_acts_as = true` - Legacy mode will be deprecated in v2.0 Key improvements: - More intuitive Rails-like DSL - Better association naming conventions - Simplified generator interface - Cleaner configuration approach
Replace options[:*_model_name] with instance method calls in all generator templates. This fixes the undefined method 'pluralize' error when running rails g ruby_llm:install. Also removes unused legacy migration templates and updates tests to match the new template format.
Creates a complete chat interface with: - Chat and message controllers following Rails conventions - Simple HTML views for chat list, creation, and messaging - Model selector in new chat form - Models index page showing available AI models - Background job for streaming AI responses - Turbo Stream integration for real-time message updates - Automatic broadcasting from Message model - Clean, simple controller methods The generator creates a working chat UI that can be customized while maintaining Rails best practices and simplicity.
orangewolf
approved these changes
Sep 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great!
…e in next version
## What this does Adds gpt-5, gpt-5-mini, and gpt-5-nano capabilities. I tried to run `overcommit`, but it updated more files than I expected so not sure if this is still used on every commit. I did run rubocop/tests. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Documentation - [ ] Performance improvement ## Scope check - [x] I read the [Contributing Guide](https://github.com/crmne/ruby_llm/blob/main/CONTRIBUTING.md) - [x] This aligns with RubyLLM's focus on **LLM communication** - [x] This isn't application-specific logic that belongs in user code - [x] This benefits most users, not just my specific use case ## Quality check - [ ] I ran `overcommit --install` and all hooks pass - [x] I tested my changes thoroughly - [x] I updated documentation if needed - [x] I didn't modify auto-generated files manually (`models.json`, `aliases.json`) ## API changes - [ ] Breaking change - [ ] New public methods/classes - [ ] Changed method signatures - [x] No API changes Co-authored-by: Carmine Paolino <carmine@paolino.me>
Implemented efficient streaming for the chat UI generator that appends chunks without re-transmitting entire messages. The solution uses broadcast_append_chunk to append individual chunks to message content, reducing bandwidth usage. Only one Turbo Stream subscription is maintained at the chat level, avoiding multiple subscriptions per message.
## Summary - Added visualization of tool calls in the chat UI message partial - Tool calls are displayed with function name and arguments in JSON format - Styled with monospace font and gray background for better readability ## Test plan - [ ] Generate a chat UI with the updated template - [ ] Verify tool calls are displayed correctly in messages - [ ] Check that messages without tool calls render normally <img width="730" height="554" alt="CleanShot 2025-09-21 at 22 21 23@2x" src="https://github.com/user-attachments/assets/058c0923-4081-4399-96c0-4a4e025f7244" /> 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com>
…#429) ## What this does It updates the Faraday middleware to specifically use the `:net_http` adapter instead of whatever the environment default is/was. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Documentation - [ ] Performance improvement ## Scope check - [x] I read the [Contributing Guide](https://github.com/crmne/ruby_llm/blob/main/CONTRIBUTING.md) - [x] This aligns with RubyLLM's focus on **LLM communication** - [x] This isn't application-specific logic that belongs in user code - [x] This benefits most users, not just my specific use case ## Quality check - [x] I ran `overcommit --install` and all hooks pass - [x] I tested my changes thoroughly - [ ] For provider changes: Re-recorded VCR cassettes with `bundle exec rake vcr:record[provider_name]` - [x] All tests pass: `bundle exec rspec` - [ ] I updated documentation if needed - [x] I didn't modify auto-generated files manually (`models.json`, `aliases.json`) ## API changes - [ ] Breaking change - [ ] New public methods/classes - [ ] Changed method signatures - [x] No API changes ## Related issues Fixes crmne#428
…coverage from there only.
Easier than trying to force it
… with RubyLLM.embed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this does
This PR adds support for the Red Candle provider, enabling local LLM execution using quantized GGUF models directly in Ruby without requiring external API calls.
Key Implementation Details
Red Candle is fundamentally different from other providers: While all other RubyLLM providers communicate via HTTP APIs, Red Candle runs models locally using the Candle Rust crate. This brings true local inference to Ruby, with no network
latency or API costs.
Dependency Management
Since Red Candle requires a Rust toolchain at build time, we've made it optional at two levels:
red-candle
is NOT agemspec
dependency. Users must explicitly add gem 'red-candle' to theirGemfile
to use this provider.bundle config set --local with red_candle
.Testing Strategy
We implemented a comprehensive mocking system to keep tests fast:
MockCandleModel
to simulate responses without actual inferenceRED_CANDLE_REAL_INFERENCE=true
to run actual model inference (downloads models on first run, ~4.5 GBs)Changes Made
RubyLLM::Providers::RedCandle
with full chat support including streamingred_candle_test_helper.rb
ruby_llm.rb
andspec_helper.rb
to handle optional dependencymodels_to_test.rb
to conditionally include Red Candle modelsCONTRIBUTING.md
for managing the optional dependencyHow to Test
Once
red-candle
is enabled turn it back off with:bundle config unset with
And turn it BACK on with:
bundle config set --local with red_candle
Try it out
bundle exec irb
Type of change
Scope check
Quality check
overcommit --install
and all hooks passbundle exec rake vcr:record[provider_name]
bundle exec rspec
models.json
,aliases.json
)API changes
Related issues
Fixes crmne#394