RubyLLM Integration
Expose an approved component catalog through an optional RubyLLM tool.
After reading this guide, you will know:
- Load the adapter explicitly.
- Bound the catalog and correlate real tool calls.
Load Only When Needed
Add ruby_llm to the host Gemfile, then load the adapter explicitly:
require "rails_tool_views/adapters/ruby_llm"
The core does not require RubyLLM or a provider. The current adapter has offline coverage against RubyLLM 2.1.0. Configure provider credentials through the host’s RubyLLM setup, not through RailsToolViews.
Build the Approved Tool
After registering the tutorial component with expose_to: [:agent] and creating its authorized scope:
# docs-example: tool
present_ui = RailsToolViews::Adapters::RubyLLM::PresentUI.new(
keys: [:choice_card], scope: scope, context: "conversation:demo")
Pass this instance to the host chat’s RubyLLM tool registration. Keep keys, scope, and context server-owned. The catalog applies discovery policy and exposes bounded schemas. Execution validates the exact selected component and current digest again.
The adapter requires a real RubyLLM::ToolCall with the correct tool name. Do not invent correlation IDs in model output. Durable presentation receipts deduplicate tool retries. references is request-local browser reference collection, separate from the acknowledgment returned to the model.
Next Steps
- Agent Continuation resumes after user input.
- Registering Components explains discovery policies.