Module: Axn::RubyLLM

Extended by:
Configurable, Tools::AdapterRoots
Includes:
Mountable
Defined in:
lib/axn/ruby_llm.rb,
lib/axn/ruby_llm/ask.rb,
lib/axn/ruby_llm/rspec.rb,
lib/axn/ruby_llm/version.rb,
lib/axn/ruby_llm/tool_adapter.rb

Defined Under Namespace

Modules: RSpec, ToolAdapter Classes: Ask, DeprecatedConfigProxy

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.configurationObject

DEPRECATED backward-compatible aliases for the pre-DSL API. The Axn::Configurable DSL standardizes on .config / reset_config!. These keep older callers working but emit a deprecation warning and are scheduled for removal in the next minor version (see DEPRECATIONS.md).



59
60
61
62
# File 'lib/axn/ruby_llm.rb', line 59

def configuration
  _warn_deprecated_alias("Axn::RubyLLM.configuration", "Axn::RubyLLM.config")
  DeprecatedConfigProxy.new(config)
end

.enabled?Boolean

enabled accepts a Boolean OR a callable — the documented production-gating idiom is c.enabled = -> { Rails.env.production? }. axn's Configurable used to invoke an assigned callable on read via callable: true; that kwarg was removed upstream (PRO-3017) and an assigned Proc is now returned as-is, so resolve it here. Without this the DSL-generated config.enabled? is !!some_proc — always true — and production gating dies silently. This (Axn::RubyLLM.enabled?), NOT config.enabled?, is the supported reader.

Returns:

  • (Boolean)


50
51
52
53
# File 'lib/axn/ruby_llm.rb', line 50

def enabled?
  value = config.enabled
  value.respond_to?(:call) ? !!value.call : !!value
end

.reset_configuration!Object



64
65
66
67
# File 'lib/axn/ruby_llm.rb', line 64

def reset_configuration!
  _warn_deprecated_alias("Axn::RubyLLM.reset_configuration!", "Axn::RubyLLM.reset_config!")
  reset_config!
end

.toolsObject

Every Axn registered as a :ruby_llm tool -- via tool/tool :ruby_llm, residency under one of the configured tool_roots, or a configure(:ruby_llm) bag (see Axn::Tools::Registry#member?) -- each already wrapped as a ::RubyLLM::Tool, so a consumer builds its whole chat tool list in one call: chat.with_tools(*Axn::RubyLLM.tools). Mirrors the shared GemName.tools contract with Axn::MCP.tools; the same Axn class resolves to the same tool_name across both surfaces.



191
192
193
# File 'lib/axn/ruby_llm/tool_adapter.rb', line 191

def tools
  Axn::Tools.for(:ruby_llm).map { |axn| wrap(axn) }
end

.wrapObject



182
183
184
# File 'lib/axn/ruby_llm/tool_adapter.rb', line 182

def wrap(...)
  ToolAdapter.wrap(...)
end