Skip to content

Add tool calling support and expand model catalog#6

Merged
cpetersen merged 6 commits into
mainfrom
tool-calling
Mar 24, 2026
Merged

Add tool calling support and expand model catalog#6
cpetersen merged 6 commits into
mainfrom
tool-calling

Conversation

@cpetersen
Copy link
Copy Markdown
Member

Summary

Adds tool/function calling support to the red-candle RubyLLM provider, enabling local models to invoke tools through RubyLLM's standard tool interface.

New: Tool Calling

  • supports_functions? now returns true
  • New Tools module bridges RubyLLM::ToolCandle::Tool
  • perform_tool_completion! routes tool-bearing requests through red-candle's chat_with_tools with execute: false (RubyLLM manages the execution loop)
  • Generated UUIDs for tool call IDs (red-candle doesn't generate them)
  • Default max_length: 1000 for tool calls (Qwen3 needs room for <think> blocks)
  • Compatible with RubyLLM 1.10 through 1.14 (handles tool_prefs/thinking kwargs)

Verified

chat = RubyLLM.chat(model: "MaziyarPanahi/Qwen3-4B-GGUF")
chat.with_tool(PriceLookup)
response = chat.ask("What is the price of a widget?")
# => Tool called: price_lookup(product: "widget")
# => "The unit price of a widget is $9.99."

Expanded Model Catalog (22 models)

Added all models supported by red-candle 1.5:

  • Qwen3 (0.6B, 4B), SmolLM2 (360M), Yi-1.5, Granite (7B, 4.0 Micro), GLM-4
  • Phi-3 GGUF, Phi-4 GGUF, Mistral v0.3
  • TinyLlama safetensors

Dependencies

  • red-candle ~> 1.5 (requires tool calling support)
  • ruby_llm >= 1.10 (tested compatible through 1.14)

Test plan

  • 129 plugin specs pass, 0 failures
  • Provider registration works across RubyLLM 1.10-1.14
  • Chat generation works across RubyLLM 1.10-1.14
  • Tool calling verified end-to-end with Qwen3-4B through RubyLLM

🤖 Generated with Claude Code

cpetersen and others added 6 commits March 24, 2026 06:43
Tool calling:
- New Tools module bridging RubyLLM::Tool <-> Candle::Tool
- Enable supports_functions? capability
- perform_tool_completion! routes tool-bearing requests through
  red-candle's chat_with_tools (execute: false, RubyLLM manages loop)
- Handle tool_prefs/thinking kwargs for RubyLLM 1.14 compatibility
- Default max_length: 1000 for tool calls (Qwen3 needs room for <think>)

Models:
- Add all red-candle 1.5 supported models (22 total)
- Qwen3 0.6B/4B, SmolLM2, Yi, Granite 7B/4.0, GLM-4, Phi-4, Mistral v0.3

Dependencies:
- red-candle ~> 1.5 (tool calling support)
- ruby_llm >= 1.10 (verified compatible with 1.10-1.14)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Triggers on semver tags, verifies version matches, builds gem,
pushes to RubyGems, and creates GitHub Release.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The models spec expected 5 models but the catalog now has 20.
Schema validation failed because RubyLLM wraps schemas in
{name:, schema:, strict:} format — now unwrapped before validation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cpetersen cpetersen merged commit 3546b0d into main Mar 24, 2026
1 check passed
@cpetersen cpetersen deleted the tool-calling branch March 24, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant